From 47eb9af8f826e7fcf70adbb96bfc31eecc9f05b8 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Tue, 22 Oct 2024 19:59:00 +0200 Subject: [PATCH] (dired-yank): New command --- lisp/dired-aux.el | 12 ++++++++++++ lisp/dired.el | 1 + 2 files changed, 13 insertions(+) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 1be8b9334bd..47caba6fe97 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3992,6 +3992,18 @@ case, the VERBOSE argument is ignored." (setq model (vc-checkout-model backend only-files-list)))) (list backend files only-files-list state model))) +;;;###autoload +(defun dired-yank (target) + (interactive (list (dired-current-directory)) dired-mode) + (let ((files (split-string-and-unquote (current-kill 0)))) + (dolist (file files) + (unless (file-name-absolute-p file) + (user-error "Found non-filename in top of kill-ring")) + (message "Pasting file %s..." file) + (dired-copy-file file target 0) + (dired-add-file (expand-file-name (file-name-nondirectory file)) dired-marker-char)) + (message "Pasted %d files from clipboard" (length dired-clipboard)))) + (provide 'dired-aux) diff --git a/lisp/dired.el b/lisp/dired.el index a8421a67995..62e968c62c5 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2402,6 +2402,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." " " #'dired-undo " " #'dired-undo " " #'dired-vc-next-action + " " #'dired-yank ;; thumbnail manipulation (image-dired) "C-t d" #'image-dired-display-thumbs "C-t t" #'image-dired-tag-files -- 2.39.5