I have hundreds of README.org files. Almost every project I write has one, and every SRFI repo has one, too. There are often three or four open in my Emacs
session at a time. When I look at a buffer, knowing the path, not just
the buffer name, helps me tell them apart. An obvious idea is to put
the path in the mode line, but paths are often too long to fit
comfortably. My mode-line-path package abbreviates paths to make them fit. It shortens them further
using environment variables.
I use short environment variable names to identify many directories.
For example, Emacs configuration is in /home/arthur/.emacs.d/. If the environment variable e points to that directory, I can open /home/arthur/.emacs.d/lisp/init.el by doing C-x C-f $e/lisp/init.el RET. (See this Emacs Info page.) My mode-line-path package takes advantage of such environment variables, and displays $e/lisp in the mode line. That abbreviated path fits even in narrow windows.
If there isn't a suitable environment variable, mode-line-path uses ellipses instead, e.g. .../.emacs.d/lisp.
Since I wrote the package in 2013, I've used it every day. It's time to share it. I've cleaned up the code, and added caching, customization variables, and tests.
After the package is loaded, configuration is as simple as:
(setq-default mode-line-buffer-identification
'("%b" " (" mode-line-path ")"))
I've submitted mode-line-path to MELPA. If it is approved, I'll update this blog post. Here is the README.org.