]> code.delx.au - gnu-emacs/blobdiff - lisp/bookmark.el
Minor fixes for text of help-echo in some options.
[gnu-emacs] / lisp / bookmark.el
index ad43d0feae90e357470879a8b40cd391fa0a9ab6..6ac3c0f9d9aa7fc789360a0dd0497058630cc786 100644 (file)
@@ -1,4 +1,4 @@
-;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later.
+;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later
 
 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001 Free Software Foundation
 
@@ -77,7 +77,7 @@
 ;; Boy, that's a tough one.  Probably Hong Min, or maybe Emperor's
 ;; Choice (both in Chicago's Chinatown).  Well, both.  How about you?
 \f
-;;;; Code:
+;;; Code:
 
 (require 'pp)
 
@@ -345,11 +345,13 @@ through a file easier.")
 
 
 (defun bookmark-get-bookmark (bookmark)
-  "Return the full entry for BOOKMARK in bookmark-alist."
-  (apply (if bookmark-completion-ignore-case
-             #'assoc-ignore-case
-           #'assoc)
-         (list bookmark bookmark-alist)))
+  "Return the full entry for BOOKMARK in bookmark-alist.
+If BOOKMARK is not a string, return nil."
+  (when (stringp bookmark)
+    (apply (if bookmark-completion-ignore-case
+              #'assoc-ignore-case
+            #'assoc)
+          (list bookmark bookmark-alist))))
 
 
 (defun bookmark-get-bookmark-record (bookmark)
@@ -1169,11 +1171,12 @@ minibuffer history list `bookmark-history'."
     (prog1
        (insert (bookmark-location bookmark)) ; *Return this line*
       (if (and (display-color-p) (display-mouse-p))
-         (put-text-property start
-                            (save-excursion (re-search-backward
-                                             "[^ \t]")
-                                            (1+ (point)))
-                            'mouse-face 'highlight)))))
+         (add-text-properties start
+                              (save-excursion (re-search-backward
+                                               "[^ \t]")
+                                              (1+ (point)))
+                              '(mouse-face highlight
+                                help-echo "mouse-2: go to this bookmark"))))))
 
 ;;;###autoload
 (defalias 'bookmark-locate 'bookmark-insert-location)
@@ -1344,21 +1347,22 @@ for a file, defaulting to the file defined by variable
       (set-buffer (let ((enable-local-variables nil))
                     (find-file-noselect file)))
       (goto-char (point-min))
-      (delete-region (point-min) (point-max))
-      (bookmark-insert-file-format-version-stamp)
-      (pp bookmark-alist (current-buffer))
-      (let ((version-control
-             (cond
-              ((null bookmark-version-control) nil)
-              ((eq 'never bookmark-version-control) 'never)
-              ((eq 'nospecial bookmark-version-control) version-control)
-              (t
-               t))))
-        (write-file file)
-        (kill-buffer (current-buffer))
-        (if (>= baud-rate 9600)
-            (message "Saving bookmarks to file %s...done" file))
-        ))))
+      (let ((print-length nil) 
+           (print-level nil))
+       (delete-region (point-min) (point-max))
+       (bookmark-insert-file-format-version-stamp)
+       (pp bookmark-alist (current-buffer))
+       (let ((version-control
+              (cond
+               ((null bookmark-version-control) nil)
+               ((eq 'never bookmark-version-control) 'never)
+               ((eq 'nospecial bookmark-version-control) version-control)
+               (t
+                t))))
+         (write-file file)
+         (kill-buffer (current-buffer))
+         (if (>= baud-rate 9600)
+             (message "Saving bookmarks to file %s...done" file)))))))
 
 
 (defun bookmark-import-new-list (new-list)
@@ -1555,11 +1559,12 @@ deletion, or > if it is flagged for displaying."
         (let ((start (point)))
           (insert (bookmark-name-from-full-record full-record))
           (if (and (display-color-p) (display-mouse-p))
-              (put-text-property start
-                                 (save-excursion (re-search-backward
-                                                  "[^ \t]")
-                                                 (1+ (point)))
-                                 'mouse-face 'highlight))
+              (add-text-properties start
+                                   (save-excursion (re-search-backward
+                                                    "[^ \t]")
+                                                   (1+ (point)))
+                                   '(mouse-face highlight
+                                     help-echo "mouse-2: go to this bookmark")))
           (insert "\n")
           )))
      bookmark-alist))
@@ -1652,7 +1657,7 @@ Optional argument SHOW means show them unconditionally."
                ;; Strip off `mouse-face' from the white spaces region.
                (if (and (display-color-p) (display-mouse-p))
                    (remove-text-properties start (point)
-                                           '(mouse-face))))
+                                           '(mouse-face nil help-echo nil))))
              (delete-region (point) (progn (end-of-line) (point)))
               (insert "  ")
               ;; Pass the NO-HISTORY arg:
@@ -1682,11 +1687,13 @@ Optional argument SHOW means show them unconditionally."
                (let ((start (point)))
                  (insert (car bookmark-bmenu-hidden-bookmarks))
                  (if (and (display-color-p) (display-mouse-p))
-                     (put-text-property start
-                                        (save-excursion (re-search-backward
-                                                         "[^ \t]")
-                                                        (1+ (point)))
-                                        'mouse-face 'highlight)))
+                     (add-text-properties start
+                                          (save-excursion (re-search-backward
+                                                           "[^ \t]")
+                                                          (1+ (point)))
+                                          '(mouse-face highlight
+                                            help-echo
+                                            "mouse-2: go to this bookmark"))))
                 (setq bookmark-bmenu-hidden-bookmarks
                       (cdr bookmark-bmenu-hidden-bookmarks))
                 (forward-line 1))))))))