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

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

Re: miniaturising the file name displayed.


From: Kevin Rodgers
Subject: Re: miniaturising the file name displayed.
Date: Tue, 06 Jul 2004 11:51:56 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Abi wrote:
> yup, but i'd like to see ~/../../usr/etc/ when i access other files as
> well.
> or more preferable, the absolute path, or the path relative to my home
> directory or the one from my CWD, whichever is shorter. I know this is
> too much in the asking, but then if there is some elisp code to do
> this, i'd be glad to add it to my .emacs.

In emacs, your current working directory is different for every buffer
(default-directory is a buffer local variable), so every path is
relative to the default directory.  If you don't want the directory
included in the minibuffer, set insert-default-directory to nil.

But here's an attempt to always prompt you with a path relative to your
home directory:

(defadvice find-file (before read-relative-file-name activate)
  ;; -literally, -other-window, -other-frame,
  ;; -read-only, -read-only-other-window, -read-only-other-frame
  "Always read FILENAME relative to ~."
  (interactive (list (read-file-name "Find file: "
                                     (file-relative-name default-directory "~"))
                     (prefix-numeric-value current-prefix-arg))))

--
Kevin Rodgers



reply via email to

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