Mercurial > emacs
changeset 75242:ea629157e3f4
* bookmark.el (bookmark-buffer-file-name): Abbreviate the bookmark path.
Rewrite function in `cond' style for readability.
Suggested by: Stephen Eglen <S.J.Eglen{_AT_}damtp.cam.ac.uk>
(The path shortening, that is, not the rearrarangement.)
author | Karl Fogel <kfogel@red-bean.com> |
---|---|
date | Mon, 15 Jan 2007 20:04:26 +0000 |
parents | 37fad71acf15 |
children | 1e6b9b61cd88 |
files | lisp/ChangeLog lisp/bookmark.el |
diffstat | 2 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Mon Jan 15 08:36:42 2007 +0000 +++ b/lisp/ChangeLog Mon Jan 15 20:04:26 2007 +0000 @@ -1,3 +1,11 @@ +2007-01-15 Karl Fogel <kfogel@red-bean.com> + + * bookmark.el (bookmark-buffer-file-name): Abbreviate the bookmark + path. Rewrite function in `cond' style for readability. + + Suggested by: Stephen Eglen <S.J.Eglen{_AT_}damtp.cam.ac.uk> + (The path shortening, that is, not the rearrarangement.) + 2007-01-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> * term/mac-win.el (mac-ae-quit-application): New function.
--- a/lisp/bookmark.el Mon Jan 15 08:36:42 2007 +0000 +++ b/lisp/bookmark.el Mon Jan 15 20:04:26 2007 +0000 @@ -1007,14 +1007,18 @@ (defun bookmark-buffer-file-name () "Return the current buffer's file in a way useful for bookmarks. For example, if this is a Info buffer, return the Info file's name." - (if (eq major-mode 'Info-mode) - Info-current-file - (or - buffer-file-name - (if (and (boundp 'dired-directory) dired-directory) - (if (stringp dired-directory) - dired-directory - (car dired-directory)))))) + (cond + ((eq major-mode 'Info-mode) + Info-current-file) + (buffer-file-name + ;; Abbreviate the path, both so it's shorter and so it's more + ;; portable. E.g., the user's home dir might be a different + ;; path on different machines, but "~/" will still reach it. + (abbreviate-file-name buffer-file-name)) + ((and (boundp 'dired-directory) dired-directory) + (if (stringp dired-directory) + dired-directory + (car dired-directory))))) (defun bookmark-maybe-load-default-file ()