summaryrefslogtreecommitdiff
path: root/lisp/bookmark.el
diff options
context:
space:
mode:
authorKarl Fogel <kfogel@red-bean.com>2007-01-15 20:04:26 +0000
committerKarl Fogel <kfogel@red-bean.com>2007-01-15 20:04:26 +0000
commitacf3709f0182ffc4ad5dc79be96552628a7dfdda (patch)
tree59d488577d5fbde8c8976d5f34863ba4690c0b69 /lisp/bookmark.el
parenta35c8b708a96ef2bf7cd4b5583db0356bd5caac2 (diff)
downloademacs-acf3709f0182ffc4ad5dc79be96552628a7dfdda.tar.gz
emacs-acf3709f0182ffc4ad5dc79be96552628a7dfdda.tar.bz2
emacs-acf3709f0182ffc4ad5dc79be96552628a7dfdda.zip
* 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.)
Diffstat (limited to 'lisp/bookmark.el')
-rw-r--r--lisp/bookmark.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 104a9c6512f..805703a2464 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1007,14 +1007,18 @@ In Info, return the current node."
(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 ()