3

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?

7

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 ": "
            (:eval
             (if buffer-file-name
                 (abbreviate-file-name buffer-file-name)
               "%b"))))

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

| improve this answer | |
  • +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’). – Kaushal Modi Jun 8 '17 at 16:52
0

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:

#!/bin/bash
xdotool getactivewindow windowmove 2201 251 windowsize 774 568

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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