diff options
-rw-r--r-- | emacs/.emacs.d/init/ycp-dired.el | 2 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-dired.el | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/emacs/.emacs.d/init/ycp-dired.el b/emacs/.emacs.d/init/ycp-dired.el index a0892ab..badd8ed 100644 --- a/emacs/.emacs.d/init/ycp-dired.el +++ b/emacs/.emacs.d/init/ycp-dired.el @@ -55,6 +55,8 @@ "<return>" #'my-dired-find-or-alternate "r" #'my-dired-do-rename-and-symlink-back "s" #'my-dired-toggle-sorting) + (advice-add 'dired-do-delete :around 'my-dired-do-delete) + (advice-add 'dired-do-rename :around 'my-dired-do-rename) ) ;;; dired-aux 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 |