Subject: Re: bug#12107: 24.1.50; In Info mode, add the name of the manual as completion candidate for "bookmark-set"

From: Juri Linkov <[email-masked]>
Date: Thu, 02 Aug 2012 02:04:48 +0300

>> Multiple values for bookmark names are not supported
>> by `bookmark-make-record'.
>
> Then let's change that.

Due to the extensible design of bookmark records,
it's easy to implement this:

=== modified file 'lisp/bookmark.el'
--- lisp/bookmark.el	2012-07-10 11:51:54 +0000
+++ lisp/bookmark.el	2012-08-01 23:02:43 +0000
@@ -772,7 +772,14 @@ (defun bookmark-set (&optional name no-o
   (interactive (list nil current-prefix-arg))
   (unwind-protect
        (let* ((record (bookmark-make-record))
-              (default (car record)))
+              (defaults (bookmark-prop-get record 'defaults))
+              (default (if (consp defaults) (car defaults) defaults)))
+
+         (if defaults
+             ;; Don't store default values in the record.
+             (setq record (assq-delete-all 'defaults record))
+           ;; When no defaults in the record, use its first element.
+           (setq defaults (car record) default defaults))
 
          (bookmark-maybe-load-default-file)
          ;; Don't set `bookmark-yank-point' and `bookmark-current-buffer'
@@ -788,7 +795,7 @@ (defun bookmark-set (&optional name no-o
                      (format "Set bookmark (%s): " default)
                      nil
                      bookmark-minibuffer-read-name-map
-                     nil nil default))))
+                     nil nil defaults))))
            (and (string-equal str "") (setq str default))
            (bookmark-store str (cdr record) no-overwrite)
 
=== modified file 'lisp/info.el'
--- lisp/info.el	2012-07-10 11:51:54 +0000
+++ lisp/info.el	2012-08-01 23:02:53 +0000
@@ -5020,11 +5025,18 @@ (declare-function bookmark-get-bookmark-
 (defun Info-bookmark-make-record ()
   "This implements the `bookmark-make-record-function' type (which see)
 for Info nodes."
-  `(,Info-current-node
-    ,@(bookmark-make-record-default 'no-file)
-    (filename . ,Info-current-file)
-    (info-node . ,Info-current-node)
-    (handler . Info-bookmark-jump)))
+  (let* ((file (and (stringp Info-current-file)
+		    (file-name-nondirectory Info-current-file)))
+	 (bookmark-name (if file
+			    (concat "(" file ") " Info-current-node)
+			  Info-current-node))
+	 (defaults (delq nil (list bookmark-name file Info-current-node))))
+    `(,bookmark-name
+      ,@(bookmark-make-record-default 'no-file)
+      (filename . ,Info-current-file)
+      (info-node . ,Info-current-node)
+      (handler . Info-bookmark-jump)
+      (defaults . ,defaults))))
 
 ;;;###autoload
 (defun Info-bookmark-jump (bmk)