unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to set mode line to show full path of current file
@ 2011-01-18 19:05 Ashwin Purohit
  2011-01-20  6:55 ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: Ashwin Purohit @ 2011-01-18 19:05 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

Hi all,

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)))))))

Thanks!

[-- Attachment #2: Type: text/html, Size: 934 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to set mode line to show full path of current file
  2011-01-18 19:05 How to set mode line to show full path of current file Ashwin Purohit
@ 2011-01-20  6:55 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2011-01-20  6:55 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-20  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-18 19:05 How to set mode line to show full path of current file Ashwin Purohit
2011-01-20  6:55 ` Kevin Rodgers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).