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

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

Re: How to set mode line to show full path of current file


From: Kevin Rodgers
Subject: Re: How to set mode line to show full path of current file
Date: Wed, 19 Jan 2011 23:55:13 -0700
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 1/18/11 12:05 PM, Ashwin Purohit wrote:
I'd like to set the mode line to show the full path of the current file, but
only to _replace_ the filename with the fullpath, instead of wiping the entire
mode line and replacing it by just the filepath. There are other things, like
line position and time that I would like to keep on the mode line.

What I'm currently using:
;; set mode line to show full path of current file
(setq-default mode-line-format
    (list '((buffer-file-name " %f"
               (dired-directory
                dired-directory
                 (revert-buffer-function " %b"
                ("%b - Dir: " default-directory)))))))

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

(add-hook 'dired-mode-hook
          (lambda ()
            ;; TODO: handle (DIRECTORY FILE ...) list value for dired-directory
            (setq mode-line-buffer-identification
                  ;; emulate "%17b" (see dired-mode):
                  '(:eval
                    (propertized-buffer-identification
                     (if (< (length default-directory) 17)
                         (concat default-directory
                                 (make-string (- 17 (length default-directory))
                                              ?\s))
                       default-directory))))))
--
Kevin Rodgers
Denver, Colorado, USA




reply via email to

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