emacs/var/elfeed/db/data/38/38e088ef50244f6b047819c61783ce9dc0e479ba
2022-01-03 12:49:32 -06:00

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 (&amp;optional arg) (interactive &quot;P&quot;) (let ((delete-by-moving-to-trash (xor arg delete-by-moving-to-trash))) (dired-do-flagged-delete))) (defun my/dired-do-delete (&amp;optional arg) (interactive &quot;P&quot;) (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&#39;t care, because I never used it. Others might think differently about that.</p> </div><!-- SC_ON --> &#32; submitted by &#32; <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> &#32; <span><a href="https://www.reddit.com/r/emacs/comments/ra9or2/toggle_trash_with_direddeletioncommands/">[comments]</a></span>