天天看點

windows下emacs安裝配置,我的emacs第一天

我的emacs:

第一天:下載下傳http://www.gnu.org/software/emacs/

emacs-22.3-bin-i386

配置:

1,在D盤根目錄下建立一個檔案夾,取名Emacs22.3(也可以是其他路徑,随個人喜好而定),将emacs-22.2-bin-i386.zip裡的檔案解壓到這個目錄下,這樣在d:\Emacs22.3\下就有bin, tec, info, leim, lisp, site-lisp等目錄。

輕按兩下bin檔案夾裡的runemacs.exe啟動。注意到bin目錄裡還有個檔案是emacs.exe,輕按兩下它也可以啟動,但是會出現一個控制台視窗.,

2,打開系統資料庫,找到HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs(如果沒有則手動添加項),在此項下添加字元串值,名稱為HOME,值為D:\Emacs22.3。

3,建立.emacs.d目錄和.emacs檔案,啟動emacs,用滑鼠點選Options菜單,随便點選一兩個選項,比如點選一下Active Region Highlighting,然後點選Save Options。先不要擔心你會破壞了什麼東西,這樣做的目的是讓emacs自動建立.emacs.d目錄以及.emacs檔案!觀察你的Emacs視窗最後一行,是否顯示“Wrote d:/Emacs22.2/.emacs”?如果是的話就對了,當你選擇Save Options的時候,Emacs會在home路徑下産生.emacs檔案,并把配置資訊寫進這個檔案。現在看看你的d:\Emacs22.2\目錄下是否産生了這兩個東西?

4,加載.el檔案,lisp目錄下存放着lisp源檔案(*.el)和已編譯的lisp檔案(*.elc),以後你也可以将自己的.el檔案放在這個目錄下,然後還要在.emacs檔案插入相關語句。比如你有一個檔案叫做abcd.el,将它複制到lisp目錄下,然後打開.emacs檔案插入一句(require 'abcd)就可以了(包括圓括号,不需要擴充名.el)。

如果你不喜歡lisp檔案夾,也可以自己建立一個,比如在home目錄下建一個檔案夾叫做xyz,然後把abcd.el放在xyz目錄下,在.emacs檔案插入以下兩句:

(setq load-path (cons "~/xyz" load-path))

(require 'abcd)

第一句告訴emacs先加載你的xyz目錄,第二句再加載abcd.el。注意“~/”是linux系統的用法,表示home目錄。

最後貼一下,我的.emacs(目前使用了一個顯示行号的el,linum.el下載下傳位址:

http://linux.cuit.edu.cn/tos-content/2009/06/linum.el)配置:

[quote]

(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.

;;不顯示工具欄

'(tool-bar-mode nil)

'(transient-mark-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.

)

;;更改el檔案的預設存放路徑

;;(setq load-path (cons "d:/soft/green_soft/ntemacs23/site-lisp/" load-path))

;;----------------------------華麗的分割線-------------------------------------

;;去掉啟動歡迎界面

(setq inhibit-startup-message t)

;;不要總是沒完沒了的問yes or no, 為什麼不能用 y/n

(fset 'yes-or-no-p 'y-or-n-p)

;;不要生成臨時檔案

(setq-default make-backup-files nil)

;;括号比對時顯示另外一邊的括号,而不是煩人的跳到另一個括号。

(show-paren-mode t)

(setq show-paren-style 'parentheses)

;;打開高亮 #M-x global-font-lock-mode

(global-font-lock-mode t)

;;把title設定為“檔案名@LC's Emacs"

(setq frame-title-format

'("GNU/Emacs - [ " (buffer-file-name "%f \]"

(dired-directory dired-directory "%b \]"))))

;;光标靠近滑鼠的時候,讓滑鼠自動讓開,别擋住視線

(mouse-avoidance-mode 'animate)

;; 自動存盤

(setq auto-save-mode t)

;; 反顯選中區域

(transient-mark-mode t)

;;(require 'wb-line-number)

;;預設顯示行号

;;(wb-line-number-enable)

;;顯示行号 #M-x wb-line-number-toggle

;;另外一個顯示行号的插件,個人更喜歡的風格

(require 'linum)

(global-linum-mode t)

[/quote]

繼續閱讀