From: dodd@mycenae.cchem (Lawrence R. Dodd)
Newsgroups: gnu.emacs.help
Subject: Re: display directory in mode line
Date: 13 Apr 92 13:00:28 GMT
Article-I.D.: mycenae.DODD.92Apr13080028
	<ROLAND.92Apr3235405@geech.gnu.ai.mit.edu>
Organization: /home/dodd/.organization
NNTP-Posting-Host: mycenae.cchem.berkeley.edu
In-reply-to: roland@gnu.ai.mit.edu's message of 4 Apr 92 04:54:05 GMT



>>>>> On 4 Apr 92 04:54:05 GMT, roland@gnu.ai.mit.edu (Roland McGrath)
>>>>> said:

  Roland> Article-I.D.: geech.ROLAND.92Apr3235405

  Roland> I like to see the directory in file buffers, shell buffers,
  Roland> and compilation buffers.  I use this:

  Roland> (setq-default mode-line-format
  Roland> 	      '("" mode-line-modified mode-line-buffer-identification " "
  Roland> 		"%[(%p" minor-mode-alist "%n" mode-line-process ")%]"
  Roland> 		(truncate-lines "$" "-")
  Roland> 		"-" global-mode-string
  Roland> 		;; Show the current directory if the buffer is visiting a file,
  Roland> 		;; or is a compilation or shell buffer.
  Roland> 		(buffer-file-name
  Roland> 		 default-directory
  Roland> 		 (compilation-error-message default-directory
  Roland> 					    (last-input-start
  Roland> 					     default-directory)))
  Roland> 		"--(" mode-name ")"
  Roland> 		;; Dashes to the end of the line.
  Roland> 		"-%-"))

The above is a very useful hack but I have two suggestions/questions
for anyone that is interested.

First, is it possible to get the directory listing to have ~/ in place
of the user's HOME directory?  The directory listing can get *very*
long and saving characters by replacing "/usr/users/foobar" with a "~"
would help a great deal.

Second, when I use the above with the new and improved version of
dired (i.e., the Emacs 19 version of dired --
ftp.thp.uni-koeln.de:pub/gnu/emacs/diredall.tar.Z) the switches used
normally appear as a minor mode in the modeline as "(Dired by name)"
or "(Dired by date)."  With the above hack minor modes now appear with
the string showing the location in the buffer (e.g., All, 60%, ...)
instead of along side the major mode.  So the new version dired
appears as "(All by name)" to the left of the date and "(Dired)" to
the right of the date, which is fine.  However, following the "(All by
name)" or "(All by date)" there is a $ character.  Is this a
truncation?  If so what is it truncating? And can I truncate it?

                          thanks,
                            Larry
                            dodd@mycenae.cchem.berkeley.edu

+-----------------------------------------------------------------------------+
| Lawrence Robert Dodd                                                        |
| mycenae.cchem.berkeley.edu (128.32.198.48)                                  |
+-----------------------------------------------------------------------------+
| Strange women lying in ponds throwing out swords is no basis for a system   |
| of government. Supreme executive power is derived from a mandate from the   |
| masses not from some farcical aquatic ceremony.                             |
|                                                                             |
| Dennis to King Arthur (in Monty Python and the Holy Grail)                  |
+-----------------------------------------------------------------------------+
--
                            Larry
                            dodd@mycenae.cchem.berkeley.edu