Where did dired-omit-toggle disappear in Emacs 23.2?
The challenge of upgrading from Emacs 21.2 to 23.2 continues... In my .emacs I have the very convenient:
(global-set-key (quote [f4]) (quote dired-omit-toggle))
It used to work since Emacs 18... but it no longer works in Emacs 23.2:
Lisp error: (void-function dired-omit-toggle)
Any idea how I can replace this functionality in Emacs 23.2?
EmacsWiki says:
To use this mode add the following to your InitFile.
(add-hook 'dired-load-hook (function (lambda () (load "dired-x"))))
and this is exactly what I have been having all these years. But Emacs 23.2 doesn't like this anymore. Any idea what could have replace开发者_JAVA百科d it in Emacs 23.2?
Since Emacs 22, you need to call dired-omit-mode
instead of dired-omit-toggle
. You still need to load dired-x
. From NEWS.22
:
*** In Dired-x, Omitting files is now a minor mode, dired-omit-mode.
The mode toggling command is bound to M-o. A new command dired-mark-omitted, bound to * O, marks omitted files. The variable dired-omit-files-p is obsoleted, use the mode toggling function instead.
Since my upgrade from Emacs 21 to 23 is gradual, having to maintain the same .emacs for several systems, some of which use Emacs 21, and some use Emacs 23, I came up with the following code:
(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 and GNUEmacs23 are defined earlier in the .emacs file as:
(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)))
精彩评论