help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying the Mode Line


From: Kevin Rodgers
Subject: Re: Modifying the Mode Line
Date: Fri, 11 Mar 2005 10:58:18 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Pascal Bourguignon wrote:
> John Laiosa <jlaiosa@draper.com> writes:
>>2.) I want to add the full path as it appears in the buffer list so I know
>>what directory the file came from.
>
> See the variable: default-mode-line-format

Which leads you to mode-line-format, which leads you to
mode-line-buffer-identification:

,----
| mode-line-buffer-identification's value is shown below.
|
| Documentation:
| Mode-line control for identifying the buffer being displayed.
| Its default value is ("%12b").
| Major modes that edit things other than ordinary files may change this
| (e.g. Info, Dired,...)
|
| Defined in `bindings'.
|
| Value:
| (#("%12b" 0 4
|    (face
|     (:weight bold)
|     help-echo "mouse-1: previous buffer, mouse-3: next buffer" local-map
|     (keymap
|      (header-line keymap
|                   (mouse-3 . mode-line-bury-buffer)
|                   (down-mouse-3 . ignore)
|                   (mouse-1 . mode-line-unbury-buffer)
|                   (down-mouse-1 . ignore))
|      (mode-line keymap
|                 (mouse-3 . mode-line-bury-buffer)
|                 (mouse-1 . mode-line-unbury-buffer)
|                 (down-mouse-1 . ignore))))))
`----

If you do the obvious thing

(setq mode-line-buffer-identification
      '(buffer-file-name "%12f" "%12b"))

I suspect you'll lose all those useful text properties (not to mention
it's a buffer-local variable, but not documented as such).  But
bindings.el shows how to do it right:

(setq-default mode-line-buffer-identification
              (list 'buffer-file-name
                    (propertized-buffer-identification "%12f")
                    (propertized-buffer-identification "%12b")))

Another alternative is to change the way buffers are named, to include
enough parts of the directory to keep them distinct:

(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)

--
Kevin Rodgers


reply via email to

[Prev in Thread] Current Thread [Next in Thread]