初识Emacs,被网上的众多“最强”的配置文件(~/.emacs)弄得云山雾罩,找不着北。在不知所措时,硬着头皮,读了Emacs、org-mode和color-theme的文档,并做了简单的配置,觉得作为文档编辑、HTML编辑和日常应用已经足够,日后只有在战争中学习战争,完善其功能。
现将最简单的配置晒晒,请各位老鸟多指教。
;;author: 一意孤行
;;e-mail: zz55109@gmail.com
;;------------------环境设置-------------------------------
;;color-theme设置
(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0/")
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-deep-blue)))
;;关闭开机画面
(setq inhibit-startup-message t)
;; 在标题栏提示你目前在什么位置
(setq frame-title-format "一意孤行@%b")
;;显示行号
(global-linum-mode 1)
;;高亮当前行:hi-line.el,emacs自己带的
(require 'hl-line)
(global-hl-line-mode t)
;;设置sentence-end可以识别中文标点
(setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
;;让emacs可以直接打开和显示图片
(auto-image-file-mode)
;;显示时间设置
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)
;;以 y/n代表 yes/no
(fset 'yes-or-no-p 'y-or-n-p)
;;iimage mode
(autoload 'iimage-mode "iimage" "Support Inline image minor mode." t)
(autoload 'turn-on-iimage-mode "iimage" "Turn on Inline image minor mode." t)
;;org-mode配置
(require 'org-install)
(require 'org-publish)
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-hook 'org-mode-hook 'turn-on-font-lock)
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-publish-project-alist
'(("note-org"
:base-directory "/home/org/org"
:publishing-directory "/home/org/publish"
:base-extension "org"
:recursive t
:publishing-function org-publish-org-to-html
:auto-index nil
:index-filename "index.org"
:index-title "index"
:link-home "index.html"
:section-numbers nil
:style "<link rel=\"stylesheet\"
href=\"./style/emacs.css\"
type=\"text/css\"/>")
("note-static"
:base-directory "/home/org/org"
:publishing-directory "/home/org/publish"
:recursive t
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|swf\\|zip\\|gz\\|txt\\|el"
:publishing-function org-publish-attachment)
("note"
:components ("note-org" "note-static")
:author "zz55109@gmail.com"
)))
;;org-mode自动换行
(add-hook 'org-mode-hook
(lambda () (setq truncate-lines nil)))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(display-time-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:family "文泉驿正黑" :foundry "unknown" :slant normal :weight normal :height 143 :width normal)))))
各位和我一样的初学者,Emacs24对于新手的亲和力,其内置了org-mode,默认就能够正常工作,所要做的配置并不多。
color-theme是对Emacs应用风格显示的一些设定,按照其文档说明做一些简单的设置即可。PATH路径,得准确。