3

从 Emacs 21.2 升级到 23.2 的挑战仍在继续……在我的 .emacs 中,我非常方便:

(global-set-key (quote [f4]) (quote dired-omit-toggle))

它从 Emacs 18 开始就可以工作......但它不再在 Emacs 23.2 中工作:

Lisp 错误:(void-function dired-omit-toggle)

知道如何在 Emacs 23.2 中替换此功能吗?

EmacsWiki说:

要使用此模式,请将以下内容添加到您的 InitFile。

  (add-hook 'dired-load-hook
            (function (lambda () (load "dired-x"))))

这正是我这些年来一直拥有的。但是 Emacs 23.2 不再喜欢这个了。知道什么可以在 Emacs 23.2 中取代它吗?

4

2 回答 2

3

从 Emacs 22 开始,您需要调用dired-omit-mode而不是dired-omit-toggle. 您仍然需要加载dired-x. 来自NEWS.22

*** 在 Dired-x 中,省略文件现在是次要模式,即 dired-omit-mode。

模式切换命令绑定到 Mo。一个新的命令 dired-mark-omitted,绑定到 *O,标记省略的文件。变量 dired-omit-files-p 已过时,请改用模式切换功能。

于 2010-08-18T22:32:26.937 回答
0

由于我从 Emacs 21 升级到 23 是循序渐进的,必须为多个系统维护相同的 .emacs,其中一些使用 Emacs 21,一些使用 Emacs 23,我想出了以下代码:

(GNUEmacs21
 (global-set-key (quote [f4]) (quote dired-omit-toggle))
)

(GNUEmacs22
 (global-set-key (quote [f4]) (quote dired-omit-mode))
)

(GNUEmacs23
 (global-set-key (quote [f4]) (quote dired-omit-mode))
)

GNUEmacs21、GNUEmacs22 和 GNUEmacs23 在前面的 .emacs 文件中定义为:

(defmacro GNUEmacs23 (&rest body)
  (list 'if (string-match "GNU Emacs 23" (version))
        (cons 'progn body)))

(defmacro GNUEmacs22 (&rest body)
  (list 'if (string-match "GNU Emacs 22" (version))
        (cons 'progn body)))

(defmacro GNUEmacs21 (&rest body)
  (list 'if (string-match "GNU Emacs 21" (version))
        (cons 'progn body)))
于 2010-08-18T22:47:58.440 回答