1 line
1.3 KiB
Plaintext
1 line
1.3 KiB
Plaintext
<!-- SC_OFF --><div class="md"><p>I use dired with the variable <code>delete-by-moving-to-trash</code> set to <code>t</code>. But sometimes I want to delete a file (or directory) without sending it to trash. Here is how I modified the dired-deletion-commands to toggle their trashing-behavior when called with a prefix.</p> <pre><code>(defun my/dired-do-flagged-delete (&optional arg) (interactive "P") (let ((delete-by-moving-to-trash (xor arg delete-by-moving-to-trash))) (dired-do-flagged-delete))) (defun my/dired-do-delete (&optional arg) (interactive "P") (let ((delete-by-moving-to-trash (xor arg delete-by-moving-to-trash))) (dired-do-delete))) </code></pre> <p>All I have to do now is bind these functions to <code>x</code> and <code>D</code> in <code>dired-mode-map</code></p> <p>Of course after that, the default reaction to prefixes is lost. Personally I don't care, because I never used it. Others might think differently about that.</p> </div><!-- SC_ON -->   submitted by   <a href="https://www.reddit.com/user/Gallipo"> /u/Gallipo </a> <br/> <span><a href="https://www.reddit.com/r/emacs/comments/ra9or2/toggle_trash_with_direddeletioncommands/">[link]</a></span>   <span><a href="https://www.reddit.com/r/emacs/comments/ra9or2/toggle_trash_with_direddeletioncommands/">[comments]</a></span> |