【问题标题】:Emacs folding mode errorEmacs 折叠模式错误
【发布时间】:2010-08-27 19:44:53
【问题描述】:
我希望能够使用来自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
【问题讨论】:
标签:
emacs
elisp
dot-emacs
emacs23
【解决方案1】:
有两个问题:
您不必为乳胶模式重新声明标记,因为这已经在 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 局部变量放在要打开的文件的第一行,例如,在 lisp 中:
;; -*- 折叠文件:t; -*-
有了这个局部变量,以及.emacs 中的(folding-mode-add-find-file-hook) 命令,folder-mode 已启用,并且在区域上调用folding-fold-region 时不再有问题。
做一个 C-h f folding-mode-add-find-file-hook RET 来解释这个机制。