Dired Tricks #2

Here are some random Dired mode tips:

1 Want to include the names of files in a document?

w       copies names of marked files to kill ring.
C-0 w   copies absolute file name
C-u     copies names relative to Dired’s current directory

Here’s an example of this in action:

Bob Hall is a leading British boogie-woogie pianist. Here are the tracks off his album What Goes Round

  1. I Can’t Get My Ass in Gear.mp3
  2. Road of No Return.mp3
  3. Running with the Blues.mp3
  4. Bloodhound Blues.mp3
  5. What Goes Round Comes Back.mp3
  6. The All Star Medicine Show.mp3
  7. Backwater Blues.mp3
  8. Alone with the Blues.mp3
  9. One More Road.mp3
  10. Back on the Valley.mp3
  11. Same Old Place.mp3

2 Fed up with deleting Dired buffers as you navigate through structures?

Pressing a rather than enter will close the current dired buffer as Emacs opens the next one.

3 Hiding Uninteresting Files

Here’s a partial view of a directory:

-rw-rw-r--  1 ***** *****  110537 Mar 24 13:07 planner.org
-rw-rw-r--  1 ***** *****   60688 Sep  3  2013 planner.org.~1~
-rw-rw-r--  1 ***** *****   60688 Sep  3  2013 planner.org.~2~
-rw-rw-r--  1 ***** *****  112046 Mar 18 16:37 planner.org.~860~
-rw-rw-r--  1 ***** *****  112079 Mar 18 16:40 planner.org.~861~
-rw-rw-r--  1 ***** *****  112133 Mar 18 16:55 planner.org.~862~
-rw-rw-r--  1 ***** *****  112133 Mar 18 16:55 planner.org.~863~
-rw-rw-r--  1 ***** *****  112196 Mar 20 15:16 planner.org.~864~

As I use force backups on all my files, all those ~backups clutter things up. I used to do the following remove them:

% m ~   Mark all backup files
k       Remove them from view

Then I discovered dired-omit-mode, part of dired-x.

Place the following in your .emacs file

(require 'dired-x)
(setq dired-omit-mode t)

Now hit M-o to toggle uninteresting files like backup files on and off.

4 And finally…

Something that I always forget when I need it: to create a new file with non existent parent directories from current directory:

M-x make-directory RET RET

Related Posts

Dired Tricks #1

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s