Emacs折叠模式错误

标签 emacs elisp dot-emacs emacs23

我希望能够使用来自 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/

相关文章:

Emacs 组织模式 : How to set date and time on the first Wednesday of month

regex - 用于将 PCRE 正则表达式转换为 emacs 正则表达式的 Elisp 机制

emacs - 验证一行中正确的字段数?

emacs:如何使用标记环?

emacs - 在 OS X 上的 Emacs 中同时设置 `fullheight` 和 `width`

Emacs:如何消除自动完成弹出窗口中的空白模式?

matlab - 你如何让 emacs 将 .m 文件识别为 Matlab 文件,而不是 objective-C 文件?

regex - Emacs交互式正则表达式替换

emacs - 如何让 Emacs 显示空格?

linux - 多缓冲区可以有自己的 etags 标记堆栈吗?