]> git.eshelyaron.com Git - emacs.git/commitdiff
* bookmark.el (bookmark-buffer-file-name): Abbreviate the bookmark path.
authorKarl Fogel <kfogel@red-bean.com>
Mon, 15 Jan 2007 20:04:26 +0000 (20:04 +0000)
committerKarl Fogel <kfogel@red-bean.com>
Mon, 15 Jan 2007 20:04:26 +0000 (20:04 +0000)
    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.)

lisp/ChangeLog
lisp/bookmark.el

index 7b08f1fb0f785243cd503e9e5a130ecdb081e0f8..3f599e637e1832dec6a2e35ebb4bf82e6b3c3895 100644 (file)
@@ -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.
index 104a9c6512fa4d6871940772c09d3c68890a260f..805703a24649db74e86ae0fb0b02edc25d75210e 100644 (file)
@@ -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 ()