How do I show the path to a file in Emacs mode?

The mode line displays the name of the buffer I'm working with (argf.rb):

enter image description here

For a buffer visiting a file, is it possible to display the absolute name of the file (i.e. include the path)?


source to share

1 answer

First, you see the name of the buffer, not the name of the file. Try opening two files with the same name (in different directories) and see what I mean.

Secondly, yes, I'm sure it is possible - just configure mode-line-format


Third, it might not be such a great idea - the mode line is already quite crowded, and the long way just doesn't fit. I know it sounds great now, but the next day you will hate it.

Instead, put the path in the title bar:

(setq frame-title-format
      '(buffer-file-name "%b - %f" ; File buffer
        (dired-directory dired-directory ; Dired buffer
         (revert-buffer-function "%b" ; Buffer Menu
          ("%b - Dir: " default-directory))))) ; Plain buffer




All Articles