hatmatrix
hatmatrix

Reputation: 44862

ido-mode distinguish dired-mode buffer names

does anyone know of a good way to distinguish dired-mode buffer names from other types of buffers in the minibuffer while using ido-mode? For instance... showing a forward-slash at end of a dired-mode buffer name?

Upvotes: 6

Views: 375

Answers (1)

Trey Jackson
Trey Jackson

Reputation: 74420

You could simply change the dired-mode buffers to always have /s at the end of their names. This code does that.

(add-hook 'dired-mode-hook 'ensure-buffer-name-ends-in-slash)
(defun ensure-buffer-name-ends-in-slash ()
  "change buffer name to end with slash"
  (let ((name (buffer-name)))
    (if (not (string-match "/$" name))
        (rename-buffer (concat name "/") t))))

Upvotes: 7

Related Questions