If you ever work in Emacs with different files that all have the same name, this tip may be very useful for you. In my experience, this most often happens when working with Makefiles from multiple projects or directories. Assuming you have a buffer visiting a file called Makefile, by default Emacs will call the second buffer Makefile<2>. This is not very useful for figuring out which one is which.
The uniquify package
Enter the uniquify package. It offers several options for making buffer names unique. In my .emacs, I have the following two lines of code.
(require 'uniquify) (setq uniquify-buffer-name-style 'forward)
You can set the value to any of the following options, nil being the default. These examples are taken from the help file within Emacs. They use the information from the directories the files are located in to make the names unique. The first buffer called “name” is visiting a file in the directory bar/mumble/, and the second buffer is visiting a file called “name” in directory quux/mumble.
|value||first buffer called “name”||second buffer called “name”|