Emacs does a wonderful job of disambiguating buffer names when I have several files with the same name open. That is, if I open a single
main.cpp, the buffer is simply called
main.cpp, but if I open two of them, then one will be
main.cpp<foo> and the other
bar are directories).
This is all fine and good. But there are some file names that are, frankly, worthless on their own. If I'm writing a Python project,
__init__.py tells me nothing about what file I'm looking at, and I probably have a couple hundred files with that name in my repo, so I've often had the thought that it would be nice if
__init__.py buffers always showed the directory they're in. Likewise, Rust has
mod.rs which serves the same purpose and is, as a filename, equally useless.
Is there a whitelist or a regexp that I can use to tell Emacs to always include the directory in the buffer name for files with certain names, even if it's the only file with that name I happen to have open?