As I’ve mentioned many times, I write my blog posts in Emacs and publish them with org2blog
. After I push the post to WordPress, I have a buffer and file with the HTML that I no longer need. I used to clean that up by opening a Dired buffer and using the 【% m】 command to ask that files be marked by a regular expression. When prompted for the regexp, I would specify \.html$
. Then a 【D】 command would delete any html files and ask if I wanted the buffers deleted too. That’s a quick and easy way to get rid of leftover files and buffers.
Somewhere along the line, I discovered an easier way to mark those files in Dired. Instead of 【% m】 use the command 【* .】 to ask that buffers be marked by their extension and then just specify html
when prompted.
Today I read that this command is not well known so I thought I’d share. If you think about it, we often want to delete files this way. Think of how many times you’ve typed something like
rm *.o
Here are some other useful commands in the marking family:
Key Sequence | Command |
---|---|
【* /】 | Mark Directories |
【* @】 | Mark Symlinks |
【* *】 | Mark Executables |
【* t】 | Invert Marking |
【* s】 | Mark Files in Current Subdir |
【* %】 | Mark Files Matching Regexp |
【* (】 | Mark Files For Which an Elisp Expression Returns t (Dired+) |
Update: Several commenters have reported that the 【* .】 command is available only when dired+.el is loaded. I’ve been using Dired+ for a long time and can recommend it whether or not you need this particular command.