manpagez: man pages & more
info emacs
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

24.7.1 Making Buffer Names Unique

When several buffers visit identically-named files, Emacs must give the buffers distinct names. The usual method for making buffer names unique adds ‘<2>’, ‘<3>’, etc. to the end of the buffer names (all but one of them).

Other methods work by adding parts of each file's directory to the buffer name. To select one, customize the variable uniquify-buffer-name-style (see section Easy Customization Interface).

To begin with, the forward naming method includes part of the file's directory name at the beginning of the buffer name; using this method, buffers visiting the files ‘/u/rms/tmp/Makefile’ and ‘/usr/projects/zaphod/Makefile’ would be named ‘tmp/Makefile’ and ‘zaphod/Makefile’, respectively (instead of ‘Makefile’ and ‘Makefile<2>’).

In contrast, the post-forward naming method would call the buffers ‘Makefile|tmp’ and ‘Makefile|zaphod’, and the reverse naming method would call them ‘Makefile\tmp’ and ‘Makefile\zaphod’. The nontrivial difference between post-forward and reverse occurs when just one directory name is not enough to distinguish two files; then reverse puts the directory names in reverse order, so that ‘/top/middle/file’ becomes ‘file\middle\top’, while post-forward puts them in forward order after the file name, as in ‘file|top/middle’.

Which rule to follow for putting the directory names in the buffer name is not very important if you are going to look at the buffer names before you type one. But as an experienced user, if you know the rule, you won't have to look. And then you may find that one rule or another is easier for you to remember and apply quickly.

© 2000-2017
Individual documents may contain additional copyright information.