Function: trashed-tag-files-regexp

trashed-tag-files-regexp is a natively compiled function defined in trashed.el.

Signature

(trashed-tag-files-regexp TAG &optional REGEXP PROMPT)

Documentation

TAG all files matching regular expression REGEXP.

If REGEXP is nil, read it using read-regexp with a prompt beginning with PROMPT.

Source Code

;; Defined in /nix/store/7ppdacjhnynz276lxxnfw8sdz6r2k6h2-emacs-packages-deps/share/emacs/site-lisp/elpa/trashed-20230811.157/trashed.el
(defun trashed-tag-files-regexp (tag &optional regexp prompt)
  "TAG all files matching regular expression REGEXP.
If REGEXP is nil, read it using `read-regexp' with a prompt beginning with
PROMPT."
  (let ((n 0))
    (or regexp
        (setq regexp
              (read-regexp
               (concat prompt " files (regexp): ")
               ;; Add more suggestions into the default list
               (cons nil
                     (and (tabulated-list-get-id)
                          (list (aref (tabulated-list-get-entry) 3)
                                (concat
                                 (regexp-quote
                                  (file-name-extension
                                   (aref (tabulated-list-get-entry) 3) t))
                                 "\\'"))))
               'trashed-regexp-history)))
    (save-excursion
      (trashed-reset-vpos)
      (while (tabulated-list-get-id)
        (when (string-match regexp (aref (tabulated-list-get-entry) 3))
          (tabulated-list-put-tag (char-to-string tag))
          (setq n (1+ n)))
        (forward-line)))
    (message "%d matching files." n)))