7
votes

What is your single most useful example of using dired mode in Emacs? Any nice tricks? Please one example per answer.

5
Edit your question and check the community wiki box. Community wiki questions don't garner reputation. That's the accepted mode for questions that act like polls and, I assume, what you want for this question.tvanfosson

5 Answers

10
votes

For me wdired is one of the nicest feature to be used with dired, it allows to do all sorts of emacs editing magic things on a directory to be able to rename the files, see some of the documentation on the emacswiki's page :

http://www.emacswiki.org/emacs/WDired

6
votes

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.

link text

2
votes

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).

2
votes

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)
    ))
0
votes

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.