2010-08-27 39 views
3

我希望能夠將使用emacs摺疊由folding.el提供模式從http://www.emacswiki.org/emacs/FoldingModeEmacs的摺疊模式錯誤

我把我的.emacs文件中的以下內容:

(setq load-path (cons (concat (getenv "HOME") "/.emacs.d") load-path)) 
(load "folding") 
(folding-mode-add-find-file-hook) 
(folding-add-to-marks-list 'latex-mode "%{" "%}" nil t) 

然後,當我選擇一個區域,然後運行

M-x folding-fold-region 

我得到的錯誤

Wrong type argument: char-or-string-p, nil 

回答

5

有兩個問題:

  • 你不必爲乳膠模式重新申報商標,因爲這已經在folder.el line 4411完成。因此您應該刪除該行(folding-add-to-marks-list 'latex-mode "%{" "%}" nil t)

  • folder-mode未啓用時,您會收到錯誤Wrong type argument: char-or-string-p, nil。添加行(folding-mode-add-find-file-hook)不足以在默認情況下打開folder-mode中的文件。要在folder-mode打開,你也應該把folded-file局部變量,你要打開的文件的第一行,例如,在口齒不清:

;; -*- folded-file: t; -*-

有了這個局部變量,而(folding-mode-add-find-file-hook)命令在您的.emacsfolder-mode已啓用,並且您在區域上撥打folding-fold-region時不再有問題。

做一個C-H˚Ffolding-mode-add-find-file-hookRET有這個機制的解釋。

+0

很酷,謝謝!!! – forefinger 2010-08-28 01:28:32