When you open a file in emacs, the buffer gets the name of that file. That's
all fine, but what if you open multiple files with the same name? At least for
me, it's a fairly common to have a number of different
Makefile.am<3> etc., but that does really help to find the right one
at the same time. Emacs does make those names unique –
To do that, emacs provides
uniquify – it makes buffer names unique. In your
(require 'uniquify) (setq uniquify-buffer-name-style 'post-forward uniquify-separator ":")
This is emacs, so you can influence the way in which the names are made
unique. I prefer
post-forward, and as separator I use a
: rather than the
|. Note, instead of
post-forward there are other bizarre styles,
please see the documentation.
Anyway, now, when opening ('visiting') files
their buffers get the names
foo:b. In other words, the name
followed by a colon and part of the path. I think it's much clearer than the
foo<2>. One could ask why emacs should not use
uniquify as its default behavior; it seems a clear improvement.
Uniquify is a small convenience that's been a documented part of emacs for 20 years. Still, somehow I missed it until this year. I suspect I am not the only one - which is why I write this.