Hi, 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?
+3
A:
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))))
Trey Jackson
2010-04-25 16:53:17
One problem though: it doesn't resolve name conflicts nicely when two directories have the same name.
Wei Hu
2010-04-25 18:32:26
@WeiHu - Of course not, the question wasn't asking for a solution to that problem. I personally use uniquify for resolving similarly named buffers: http://www.gnu.org/software/emacs/manual/html_node/emacs/Uniquify.html
Trey Jackson
2010-04-25 18:59:15
@Trey, my point was that with your solution, opening two directories with identical names would issue an annoying error message, and the one opened later wouldn't have `/` at the end.
Wei Hu
2010-04-26 02:10:28
@WeiHu Got it, fixed. Thanks
Trey Jackson
2010-04-26 02:55:42
Beautiful! Thank you.
Stephen
2010-04-26 09:36:25