Function: dired-narrow--internal
dired-narrow--internal is a natively compiled function defined in
dired-narrow.el.
Signature
(dired-narrow--internal FILTER-FUNCTION)
Documentation
Narrow a dired buffer to the files matching a filter.
The function FILTER-FUNCTION is called on each line: if it returns non-nil, the line is kept, otherwise it is removed. The function takes one argument, which is the current filter string read from minibuffer.
Source Code
;; Defined in /nix/store/xm3gi4y4qlmhgrb87qrgpns677w7ls45-emacs-packages-deps/share/emacs/site-lisp/elpa/dired-narrow-20250511.2303/dired-narrow.el
(defun dired-narrow--internal (filter-function)
"Narrow a dired buffer to the files matching a filter.
The function FILTER-FUNCTION is called on each line: if it
returns non-nil, the line is kept, otherwise it is removed. The
function takes one argument, which is the current filter string
read from minibuffer."
(let ((dired-narrow-buffer (current-buffer))
(dired-narrow-filter-function filter-function)
(disable-narrow nil))
(unwind-protect
(progn
(dired-narrow-mode 1)
(add-to-invisibility-spec :dired-narrow)
(setq disable-narrow (read-from-minibuffer
(pcase dired-narrow-filter-function
('dired-narrow--regexp-filter
"Regex Filter:\s")
('dired-narrow--fuzzy-filter
"Fuzzy Filter:\s")
(_ "Filter:\s"))
nil dired-narrow-map))
(let ((inhibit-read-only t))
(dired-narrow--remove-text-with-property :dired-narrow))
;; If the file no longer exists, we can't do anything, so
;; set to nil
(unless (dired-utils-goto-line dired-narrow--current-file)
(setq dired-narrow--current-file nil)))
(with-current-buffer dired-narrow-buffer
(unless disable-narrow (dired-narrow-mode -1))
(remove-from-invisibility-spec :dired-narrow)
(dired-narrow--restore))
(cond
((equal disable-narrow "dired-narrow-enter-directory")
(dired-narrow-find-file)
(dired-narrow--internal filter-function))
(t
(when (and disable-narrow
dired-narrow--current-file
dired-narrow-exit-action)
(funcall dired-narrow-exit-action)))))))