diff options
author | Yuchen Pei <id@ypei.org> | 2023-06-26 17:19:43 +1000 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2023-06-26 17:19:43 +1000 |
commit | 6c3fb77a11f3cf76f66de4e760de5430dad83439 (patch) | |
tree | 750632d1287256e94f073841ad593a5b094169bd /emacs/.emacs.d/lisp/my | |
parent | e13c4fb1d8303affa0f64e5a5ba06e9b3b03d475 (diff) |
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
Diffstat (limited to 'emacs/.emacs.d/lisp/my')
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-dired.el | 20 |
1 files changed, 16 insertions, 4 deletions
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 |