Function: dired-omit-expunge
dired-omit-expunge is an interactive and byte-compiled function
defined in dired-x.el.gz.
Signature
(dired-omit-expunge &optional REGEXP LINEP INIT-COUNT)
Documentation
Erase all unmarked files whose names match REGEXP.
With a prefix arg (non-nil LINEP when called from Lisp), match REGEXP against the whole line. Otherwise, match it against the file name.
If REGEXP is nil, use dired-omit-files, and also omit file names
ending in dired-omit-extensions.
Do nothing if REGEXP is the empty string, dired-omit-mode(var)/dired-omit-mode(fun) is nil, or
if called from Lisp and buffer is bigger than dired-omit-size-limit.
Optional arg INIT-COUNT is an initial count tha'is added to the number
of lines omitted by this invocation of dired-omit-expunge, in the
status message.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/dired-x.el.gz
(defun dired-omit-expunge (&optional regexp linep init-count)
"Erase all unmarked files whose names match REGEXP.
With a prefix arg (non-nil LINEP when called from Lisp), match REGEXP
against the whole line. Otherwise, match it against the file name.
If REGEXP is nil, use `dired-omit-files', and also omit file names
ending in `dired-omit-extensions'.
Do nothing if REGEXP is the empty string, `dired-omit-mode' is nil, or
if called from Lisp and buffer is bigger than `dired-omit-size-limit'.
Optional arg INIT-COUNT is an initial count tha'is added to the number
of lines omitted by this invocation of `dired-omit-expunge', in the
status message."
(interactive "sOmit files (regexp): \nP")
;; Bind `dired-marker-char' to `dired-omit-marker-char',
;; then call `dired-do-kill-lines'.
(if (and dired-omit-mode
(or (called-interactively-p 'interactive)
(not dired-omit-size-limit)
(< (buffer-size) dired-omit-size-limit)
(progn
(when dired-omit-verbose
(message "Not omitting: directory larger than %d characters."
dired-omit-size-limit))
(setq dired-omit-mode nil)
nil)))
(let ((omit-re (or regexp (dired-omit-regexp)))
(old-modified-p (buffer-modified-p))
(count (or init-count 0)))
(unless (string= omit-re "")
(let ((dired-marker-char dired-omit-marker-char))
(when dired-omit-verbose (message "Omitting..."))
(if (not (if linep
(dired-mark-if
(and (= (following-char) ?\s) ; Not already marked
(string-match-p
omit-re (buffer-substring
(line-beginning-position)
(line-end-position))))
nil)
(dired-mark-unmarked-files
omit-re nil nil dired-omit-localp
(dired-omit-case-fold-p (if (stringp dired-directory)
dired-directory
(car dired-directory))))))
(when dired-omit-verbose (message "(Nothing to omit)"))
(setq count (+ count
(dired-do-kill-lines
nil
(if dired-omit-verbose "Omitted %d line%s" "")
init-count)))
(force-mode-line-update))))
;; Try to preserve modified state, so `%*' doesn't appear in
;; `mode-line'.
(set-buffer-modified-p (and old-modified-p
(save-excursion
(goto-char (point-min))
(re-search-forward dired-re-mark nil t))))
count)))