我希望能够使用来自 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
最佳答案
有两个问题:
您不必为 latex 模式重新声明标记,因为这已经在 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 中:
;; -*- folded-file: t; -*-
有了这个局部变量,以及 .emacs
中的 (folding-mode-add-find-file-hook)
命令 folder-mode
已启用,在区域上调用 folding-fold-region
时不再有问题。
执行 C-h f folding-mode-add-find-file-hook
RET 来获得对该机制的解释。
关于Emacs折叠模式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3587622/