Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ido-mode distinguish dired-mode buffer names

Tags:

emacs

elisp

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?

like image 620
hatmatrix Avatar asked Apr 25 '10 13:04

hatmatrix


People also ask

What is Ido mode?

ido-mode enhances emacs switch buffer command and opening file command. It automatically show list of choices as you type (no need to press Tab first). Alt + x ido-mode. Toggle it on/off. ido-mode enhances emacs switch buffer command and opening file command.

What is IDO mode Emacs?

There are many ways of improving your productivity when you use Emacs, and Ido (or “Interactively DO things”) is one of those packages that you enable and then never, ever turn off again.


1 Answers

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))))
like image 133
Trey Jackson Avatar answered Oct 06 '22 01:10

Trey Jackson