Emacs折叠模式错误

发布于 2024-09-16 18:40:46 字数 566 浏览 2 评论 0原文

我希望能够使用 http://www.emacswiki 中的 Folding.el 提供的 emacs 折叠模式.org/emacs/FoldingMode

我将以下内容放入我的 .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

I want to be able to use the emacs folding mode provided by folding.el from http://www.emacswiki.org/emacs/FoldingMode

I put the following in my .emacs file:

(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)

Then, when I select a region and run

M-x folding-fold-region

I get the error

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她说她爱他 2024-09-23 18:40:46

有两个问题:

  • 您不必重新声明乳胶模式的标记,因为这已经在 folder.el 第 4411 行。因此,您应该删除行 (folding-add-to-marks-list 'latex-mode "%{" "%}" nil t)

  • 您收到错误 类型错误参数:char-or-string-p, nil(当未启用folder-mode 时)。默认情况下,添加行 (folding-mode-add-find-file-hook) 不足以在 folder-mode 中打开文件。要以文件夹模式打开,您还应该将折叠文件局部变量放在要打开的文件的第一行,例如在 lisp 中:< /p>

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

:这个局部变量,以及 .emacs 中的 (folding-mode-add-find-file-hook) 命令,folder-mode 是启用后,在区域上调用 folding-fold-region 时不再有问题。

执行 Ch f folding-mode-add-find-file-hook RET 对此进行解释机制。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文