Function: dired-omit-mode

dired-omit-mode is an autoloaded, interactive and byte-compiled function defined in dired-x.el.gz.

Signature

(dired-omit-mode &optional ARG)

Documentation

Toggle omission of uninteresting files in Dired (Dired-Omit mode).

With prefix argument ARG, enable Dired-Omit mode if ARG is positive, and disable it otherwise.

If called from Lisp, enable the mode if ARG is omitted or nil.

Dired-Omit mode is a buffer-local minor mode.

When enabled in a Dired buffer, Dired does not list files whose filenames match regexp dired-omit-files, files ending with extensions in dired-omit-extensions, or files listed on lines matching dired-omit-lines.

To enable omitting in every Dired buffer, you can put this in your init file:

  (add-hook 'dired-mode-hook (lambda () (dired-omit-mode)))

See Info node (dired-x) Omitting Variables for more information.

Probably introduced at or before Emacs version 29.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired-x.el.gz
;;;###autoload
(define-minor-mode dired-omit-mode
  "Toggle omission of uninteresting files in Dired (Dired-Omit mode).
With prefix argument ARG, enable Dired-Omit mode if ARG is positive,
and disable it otherwise.

If called from Lisp, enable the mode if ARG is omitted or nil.

Dired-Omit mode is a buffer-local minor mode.

When enabled in a Dired buffer, Dired does not list files whose
filenames match regexp `dired-omit-files', files ending with
extensions in `dired-omit-extensions', or files listed on lines
matching `dired-omit-lines'.

To enable omitting in every Dired buffer, you can put this in
your init file:

  (add-hook \\='dired-mode-hook (lambda () (dired-omit-mode)))

See Info node `(dired-x) Omitting Variables' for more information."
  :group 'dired-x
  (if (not dired-omit-mode)
      (revert-buffer)
    (let ((dired-omit-size-limit  nil)
          (file-count 0))
      ;; Omit by file-name match, then omit by line match.
      ;; Use count of file-name match as INIT-COUNT for line match.
      ;; Return total count.  (Return value is not used anywhere, so far).
      (setq file-count (dired-omit-expunge))
      (when dired-omit-lines
        (dired-omit-expunge dired-omit-lines 'LINEP file-count)))))