What is your single most useful example of using dired mode in Emacs? Any nice tricks? Please one example per answer.
5 Answers
wdired mode is cool for renaming photographs and so on. If you learn how to embed lisp code in your regular expression you can do interesting things with dates and names etc.
M-x dired
(navigate to the folder)
M-x wdired-change-to-wdired-mode
M-x replace-regexp
(enter search and replace expressions)
C-c C-c
I have a few more tips on dired on my blog.
I often find it useful to run find-grep-dired
to get a list of files in the tree which contain a given patten, and then using t
to mark them all in dired (or more selectively if necessary) and Q
to run an interactive search and replace on all the marked files (typically for that same pattern, in order to change it everywhere).
On Windows, I bind this function to a key (C-c C-o). Then I need just this one key to open every kind of file (pdf, ps, dvi, jpg, au, wmv,... you name it).
(defun dired-w32-shell-open ()
"Open file in Win32."
(interactive)
(let ((file (w32-convert-filename (dired-get-filename))))
(w32-shell-execute "open" file)
))
I don't know about 'single most' but the gnus-dired.el
module has some nifty utilities to quickly add attachments to mails you're composing. I've found it quite useful in the past.
http://www.koders.com/lisp/fidF2236488FD787692D0859F1D23403E205AEFE048.aspx?s=zombie
Here is Sacha Chua's snippet on some useful functions.