tags:

views:

130

answers:

4

Hello

GNU Emacs 23.1.1

I am wondering is there a way to display the path of the file in the status bar, instead of just the filename.

I have to open many files in many directories, and sometimes I forget what directory they are in. Just easier to display the some of the path in the status bar if that is possible.

Sometimes my directory paths are very long.

for example

/projects/clientserver/trunk/src/client/client.c

like this in the status bar, just display the last two directories.

/src/client/client.c

Many thanks for any suggestions,

+2  A: 

See the documentation for the variable 'frame-title-format' It will point you to the variable 'mode-line-format' which details the options for setting your title

Chris McMahan
+4  A: 

Uniquify should pretty much do what you want.

Thomas Kappler
+5  A: 

What you are asking is to change the buffer name. You can customize how buffers are named using uniquify. It has several methods for making unique buffer names. The most obvious choice for you is 'forward' which gives exactly what you ask -- prefix the buffer name with part of the path as a prefix.

However, this has a potentially unwanted side effect. Normally, buffer names are made unique by appending a suffix. When you do 'c-x b' to switch buffers, if you type "foo" and you have both "foo" and "foo<1>" you will be shown the common prefix and be given the ability to supply the suffix. So, 'c-x b foo' will let you do completion where you see a list of all of the "foo" buffers.

If you use uniqueify in 'forward' mode, you'll have buffer names of the form "bar/foo" and "baz/foo". Now, 'c-x b foo' won't take you to a foo buffer, or allow you to do completion to get a list of foo buffers. You must remember the prefix that is added to each buffer name.

My advice is to use the 'reverse' mode of uniqify, which uses the directory path as a suffix. It's perhaps slightly less intuitive, but easier to use in practice. So now you would have buffers like "foo\bar" and "foo\baz", again giving you the advantage of being able to do 'c-x b foo' and getting a list of all buffers with a filename of "foo".

So, add this to your .emacs file and see if you like the behavior:

(require 'uniquify)
(setq uniqueify-buffer-name-style 'reverse)
Bryan Oakley
+1  A: 

This one works well for me for setting the full path in the frame:

(setq frame-title-format
  '(:eval
    (if buffer-file-name
        (replace-regexp-in-string
         "\\\\" "/"
         (replace-regexp-in-string
          (regexp-quote (getenv "HOME")) "~"
          (convert-standard-filename buffer-file-name)))
      (buffer-name))))
mortenee