I often have many dired buffers open, including some for folders that have identical names. Occasionally, this causes me to switch to the wrong one, so I am looking for a way to fix this.

Currently, if I have multiple identically-named folders open in dired, then my buffer list looks something like this:


I would like to include the full path (or some portion of it) in the buffer name so I can see which folder I am actually switching to. I would prefer to do it like this:


and so on. I could also settle for e.g.:


but I would prefer the former, because it will usually be easier to find the buffer I want by folder name first, and full path second. How can this be done?

2 Answers 2


You can get this behavior by using uniquify with the following settings:

(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets
      uniquify-min-dir-content 999)

Note however that uniquify works globally, not only on dired buffers.

  • Cool, thanks! I will wait and see if there is a solution that does give a full path before I accept an answer. Commented Oct 14, 2014 at 0:03
  • 1
    I just added a note about uniquify-min-dir-content, which should help you with that. Note however, that this is a global setting: it applies to all buffers, not just dired buffers!
    – paprika
    Commented Oct 14, 2014 at 0:06

In my .emacs I set full paths for Dired buffers this way:

(add-hook 'dired-after-readin-hook
      (lambda ()
        ;; Set name of dired buffers to absolute directory name.
        ;; Use `generate-new-buffer-name' for vc-directory
        ;; which creates duplicate buffers.
        (rename-buffer (generate-new-buffer-name dired-directory))))
  • 1
    One advantage of this: you can customize how you name dired buffers, such as with a "dired: " prefix or something
    – Amory
    Commented Mar 18, 2021 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.