Emacs折叠模式错误

Emacs折叠模式错误,emacs,elisp,dot-emacs,emacs23,Emacs,Elisp,Dot Emacs,Emacs23,我希望能够使用来自的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) 然后,当我选择一个区域并运行

我希望能够使用来自的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模式重新声明标记,因为这已在中完成。因此,您应该删除行
    (折叠添加到标记列表'latex mode'%{”“%}“nil t)

  • 如果未启用
    文件夹模式
    ,则会得到错误的
    类型参数:char-or-string-p,nil
    。默认情况下,添加行
    (折叠模式添加查找文件挂钩)
    不足以在
    文件夹模式下打开文件。要在
    文件夹模式下打开
    ,还应将
    折叠文件
    局部变量放置在要打开的文件的第一行,例如,在lisp中:

;; -*- 折叠锉:t-*- 使用此局部变量和
.emacs
中的
(折叠模式添加查找文件挂钩)
命令,将启用
文件夹模式
,并且在区域上调用
折叠区域
时不再有问题

执行C-h f
折叠模式添加find file hook
RET以解释此机制

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