Function: treemacs-delete-marked-files
treemacs-delete-marked-files is an autoloaded, interactive and
byte-compiled function defined in treemacs-file-management.el.
Signature
(treemacs-delete-marked-files &optional ARG)
Documentation
Delete all marked files.
A delete action must always be confirmed. Directories are deleted recursively. By default files are deleted by moving them to the trash. With a prefix ARG they will instead be wiped irreversibly.
For marking files see treemacs-bulk-file-actions.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-file-management.el
;;;###autoload
(defun treemacs-delete-marked-files (&optional arg)
"Delete all marked files.
A delete action must always be confirmed. Directories are deleted recursively.
By default files are deleted by moving them to the trash. With a prefix ARG
they will instead be wiped irreversibly.
For marking files see `treemacs-bulk-file-actions'."
(interactive "P")
(treemacs-block
(let ((delete-by-moving-to-trash (not arg))
(to-delete (-filter #'file-exists-p treemacs--marked-paths)))
(treemacs-error-return-if (null treemacs--marked-paths)
"There are no marked files")
(unless (yes-or-no-p (format "Really delete %s marked files?"
(length to-delete)))
(treemacs-return (treemacs-log "Cancelled.")))
(treemacs--without-filewatch
(dolist (path to-delete)
;; 2nd check in case of recursive deletes
(when (file-exists-p path)
(cond
((or (file-symlink-p path) (file-regular-p path))
(delete-file path delete-by-moving-to-trash))
((file-directory-p path)
(delete-directory path t delete-by-moving-to-trash))))
(treemacs--on-file-deletion path)
(treemacs-without-messages
(treemacs-run-in-every-buffer
(treemacs-delete-single-node path)))
(run-hook-with-args 'treemacs-delete-file-functions path))
(treemacs--evade-image)
(setf treemacs--marked-paths (-difference treemacs--marked-paths to-delete))
(treemacs-log "Deleted %s files." (length to-delete))))))