Function: dired-narrow--update

dired-narrow--update is a natively compiled function defined in dired-narrow.el.

Signature

(dired-narrow--update FILTER)

Documentation

Make the files not matching the FILTER invisible.

Return the count of visible files that are left after update.

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--update (filter)
  "Make the files not matching the FILTER invisible.

Return the count of visible files that are left after update."

  (let ((inhibit-read-only t)
        (visible-files-cnt 0))
    (save-excursion
      (goto-char (point-min))
      ;; TODO: we might want to call this only if the filter gets less
      ;; specialized.
      (dired-narrow--restore)
      (while (dired-hacks-next-file)
        (if (funcall dired-narrow-filter-function filter)
            (progn
              (setq visible-files-cnt (1+ visible-files-cnt))
              (when (fboundp 'dired-insert-set-properties)
                (dired-insert-set-properties (line-beginning-position) (1+ (line-end-position)))))
          (put-text-property (line-beginning-position) (1+ (line-end-position)) :dired-narrow t)
          (put-text-property (line-beginning-position) (1+ (line-end-position)) 'invisible :dired-narrow))))
    (unless (dired-hacks-next-file)
      (dired-hacks-previous-file))
    (unless (dired-utils-get-filename)
      (dired-hacks-previous-file))
    visible-files-cnt))