3

http://www.emacswiki.org/emacs/FoldingModeのfolding.elが提供するemacsフォールディングモードを使用できるようにしたい

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

1 に答える 1

5

There are two problems :

  • you don't have to re-declare marks for latex-mode as this is already done in folder.el line 4411. Thus you should remove the line (folding-add-to-marks-list 'latex-mode "%{" "%}" nil t)

  • You get the error Wrong type argument: char-or-string-p, nil when the folder-mode is not enabled. Adding the line (folding-mode-add-find-file-hook) is not enough to open a file in folder-mode by default. To open in folder-mode, you should also place the folded-file local variable in the first line of the file you want to open, for example, in lisp :

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

With this local variable, and the (folding-mode-add-find-file-hook) command in your .emacs the folder-mode is enabled and you don't have problem anymore when calling folding-fold-region on a region.

Do a C-h f folding-mode-add-find-file-hook RET to have the explanation of this mechanism.

于 2010-08-27T21:29:07.670 に答える