在Emacs 23.2中,dired-omit-toggle在哪里消失了?

时间:2010-08-18 22:18:23

标签: emacs elisp dot-emacs dired

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

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

自Emacs 18以来它曾经工作过......但它不再适用于Emacs 23.2:

  

Lisp错误:( void-function   dired-省略肘节)

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

EmacsWiki说:

  

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

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

这正是我这么多年来一直在做的事情。但是Emacs 23.2不再喜欢这个了。知道在Emacs 23.2中可以替换它的东西吗?

2 个答案:

答案 0 :(得分:3)

自Emacs 22起,您需要拨打dired-omit-mode而不是dired-omit-toggle。您仍需要加载dired-x。来自NEWS.22

  

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

     

模式切换命令绑定到M-o。一个新的命令   dired-mark-ignored,绑定到* O,标记省略的文件。变量   dired-omit-files-p已废弃,使用模式切换功能   代替。

答案 1 :(得分: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)))