Windows 10, Emacs 25.1.

Suppose I open file D:/temp/test/myfile.txt. But in the in the mode line show only file name (myfile.txt).

But I need to show FULL path to file: D:/temp/test/myfile.txt

This path can show on mode line OR in the frame title. How I can do this?

3 Answers 3


The variable buffer-file-name contains an absolute path of the file you are visiting.

To use in frame title:

    (setq frame-title-format
          '("" invocation-name ": "
             (if buffer-file-name
                 (abbreviate-file-name buffer-file-name)

To use it in the mode-line you can do the same, but for mode-line-format variable. If you need more help see C-h v mode-line-format

You can also use %f, like (setq-default frame-title-format "%b (%f)")

For a more thorough explanation see here and here

  • +1 for mentioning C-h v mode-line-format. I would only add that that same docstring explains the meaning of identifiers like %b, %f, and many more, which apply to both mode-line-format and frame-title-format. From C-h v frame-title-format: This variable has the same structure as ‘mode-line-format’, except that the %c, %C, and %l constructs are ignored. It is used only on frames for which no explicit name has been set (see ‘modify-frame-parameters’). Jun 8, 2017 at 16:52

To show the current file path in the minibuffer you can do this:

(setq-default mode-line-buffer-identification
              (list 'buffer-file-name
                    (propertized-buffer-identification "%12f")
                    (propertized-buffer-identification "%12b")))
  • 1
    Thank you for sharing!! This should be the official answer b/c it actually answers the question, rather than answering another question and redirecting to dense documentation.
    – aec
    Nov 10, 2022 at 2:32

Did as follows:

Began installing xdotool package via apt install xdotool.

Then ran it via xdotool getactivewindow getwindowgeometry to get desired destination position, which gave me following output:

Window 69206023
  Position: 2201,251 (screen: 0)
  Geometry: 774x568

Entered it in a script, as:

xdotool getactivewindow windowmove 2201 251 windowsize 774 568

Finally copied into /usr/bin/moveright and binded it on desired keystroke.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.