如何让Dired不显示某些文件?

时间:2011-05-05 02:54:07

标签: emacs elisp dired

例如,我希望它不显示符合模式*~

的所有文件

编辑:以下工作:

(add-hook 'dired-load-hook
      (lambda ()
        (load "dired-x")
        ;; Set dired-x global variables here.  For example:
        ;; (setq dired-guess-shell-gnutar "gtar")
        ;; (setq dired-x-hands-off-my-keys nil)
        ))
(setq dired-omit-files "^#\\|~$")
(add-hook 'dired-mode-hook
      (lambda ()
        ;; Set dired-x buffer-local variables here.  For example:
        (dired-omit-mode 1)
        ))

2 个答案:

答案 0 :(得分:1)

如果您使用dired-x,read here或fir dired,请阅读this discussion。在dired的情况下,建议的解决方案采用正则表达式来过滤掉要显示的内容并仅显示那些文件。在你的情况下,这可能有点棘手。

答案 1 :(得分:1)

在SuperUser上回答,但我也会在这里回答。使用dired-omit

Dired-Omit minor mode (indicator Omit):
Toggle Dired-Omit mode.
With numeric ARG, enable Dired-Omit mode if ARG is positive, disable
otherwise.  Enabling and disabling is buffer-local.
If enabled, "uninteresting" files are not listed.
Uninteresting files are those whose filenames match regexp `dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'.

dired-omitdired-x的一部分。