Function: trashed-do-action

trashed-do-action is a natively compiled function defined in trashed.el.

Signature

(trashed-do-action ACTION)

Documentation

Restore/delete all marked files when ACTION is restore/delete.

Source Code

;; Defined in /nix/store/7ppdacjhnynz276lxxnfw8sdz6r2k6h2-emacs-packages-deps/share/emacs/site-lisp/elpa/trashed-20230811.157/trashed.el
(defun trashed-do-action (action)
  "Restore/delete all marked files when ACTION is restore/delete."
  (let ((n (trashed-num-tagged-files trashed-marker-char))
        (trash-file-name (tabulated-list-get-id))
        c marked-file)
    (if (= n 0)
        (if trash-file-name
            (progn (save-excursion
                     (setq c (progn (beginning-of-line) (char-after)))
                     (tabulated-list-put-tag (char-to-string
                                              trashed-marker-char)))
                   (setq n 1
                         marked-file (expand-file-name trash-file-name
                                                       trashed-files-dir)))
          (error "No file on this line")))
    (unwind-protect
        (if (and (> n 0) (apply trashed-action-confirmer
                                (list (format "%s %c [%d item(s)] "
                                              (capitalize (symbol-name action))
                                              trashed-marker-char n))))
            (trashed-do-execute-internal action))
      (and marked-file (file-exists-p marked-file)
           (save-excursion (tabulated-list-put-tag (char-to-string c)))))))