From 6c3fb77a11f3cf76f66de4e760de5430dad83439 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 26 Jun 2023 17:19:43 +1000 Subject: Override dired-do-delete and dired-do-rename - delete: don't move to trash with prefix arg - rename: don't use vc with prefix arg --- emacs/.emacs.d/lisp/my/my-dired.el | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'emacs/.emacs.d/lisp/my/my-dired.el') diff --git a/emacs/.emacs.d/lisp/my/my-dired.el b/emacs/.emacs.d/lisp/my/my-dired.el index a2485ab..d80c1c8 100644 --- a/emacs/.emacs.d/lisp/my/my-dired.el +++ b/emacs/.emacs.d/lisp/my/my-dired.el @@ -118,14 +118,26 @@ With a prefix arg, toggle `my-dired-reverse-sorting' instead." (delete-directory trash-files-dir t) (delete-directory trash-info-dir t))) -(defun my-dired-do-delete (&arg) - "Trash or (with a prefix arg) delete files." +(defun my-dired-do-delete (delete-fun &optional arg) + "Wrapper of `dired-do-delete'. + +With a prefix-arg, delete without moving to trash." (interactive "P") (if arg (let ((delete-by-moving-to-trash nil)) - (call-interactively 'dired-do-delete)) - (call-interactively 'dired-do-delete)) + (funcall delete-fun)) + (delete-fun)) ) +(defun my-dired-do-rename (rename-fun &optional arg) + "Wrapper on `dired-do-rename' + +With a prefix-arg, call it without using `vc-rename-file'." + (interactive "P") + (if arg + (let ((dired-vc-rename-file nil)) + (funcall rename-fun)) + (funcall rename-fun))) + (provide 'my-dired) ;;; my-dired.el ends here -- cgit v1.2.3