GNU bug report logs - #12107
24.1.50; In Info mode, add the name of the manual as completion candidate for "bookmark-set"

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Tue, 31 Jul 2012 20:31:01 UTC

Severity: wishlist

Found in version 24.1.50

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12107 in the body.
You can then email your comments to 12107 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Tue, 31 Jul 2012 20:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dani Moncayo <dmoncayo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 31 Jul 2012 20:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1.50; In Info mode, add the name of the manual as completion
	candidate for "bookmark-set"
Date: Tue, 31 Jul 2012 22:22:44 +0200
Severity: wishlist

Hello,

I have a bookmark for each manual I'm reading in info.  I like to give
the bookmark the same name as the corresponding manual (e.g. "elisp"
or "eintr").

So, when I want to update my bookmark position, I type "C-x r m", and
when I'm asked for the bookmark name, I type "M-n", expecting that
emacs fills in the name of the manual, but it writes the name of the
info node instead.  A second "M-n" doesn't brings me more candidates.

Therefore, I request that the name of the info manual be included in
the list of candidates used by M-n, in addition to the name of the
node.

(Regarding the order of the candidates, I'd like the name of the
manual to be the first, but this is more subjective.  I'll be content
even if that entry is the second one)

TIA.



In GNU Emacs 24.1.50.1 (i386-mingw-nt6.1.7601)
 of 2012-07-30 on DANI-PC
Bzr revision: 109302 eggert <at> cs.ucla.edu-20120730185642-m4h1ztzpv3379wpu
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -I../../libs/libiconv-1.14-2-mingw32-dev/include
 -I../../libs/libxml2-2.7.8-w32-bin/include/libxml2
 -I../../libs/giflib-4.1.4-1/include
 -I../../emacs/libs/gnutls-3.0.16/include -I../../libs/jpeg-6b-4/include
 -I../../libs/libpng-1.4.10 -I../../libs/libxpm-3.5.8/include
 -I../../libs/libxpm-3.5.8/src -I../../libs/tiff-3.8.2-1/include
 -I../../libs/zlib-1.2.6'


-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Wed, 01 Aug 2012 00:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 12107 <at> debbugs.gnu.org
Subject: Re: bug#12107: 24.1.50;
	In Info mode, add the name of the manual as completion candidate for
	"bookmark-set"
Date: Wed, 01 Aug 2012 03:12:44 +0300
> Therefore, I request that the name of the info manual be included in
> the list of candidates used by M-n, in addition to the name of the
> node.

Completely agree with you.  The standard Info node name is what you see
in the modeline and also by typing `w' (`Info-copy-current-node-name').
So it should be used in bookmarks as well:

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-07-17 16:53:39 +0000
+++ lisp/info.el	2012-08-01 00:12:40 +0000
@@ -5025,7 +5025,10 @@ (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
+  `(,(if (stringp Info-current-file)
+	 (concat "(" (file-name-nondirectory Info-current-file) ") "
+		 Info-current-node)
+       Info-current-node)
     ,@(bookmark-make-record-default 'no-file)
     (filename . ,Info-current-file)
     (info-node . ,Info-current-node)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Wed, 01 Aug 2012 01:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12107 <at> debbugs.gnu.org
Subject: Re: bug#12107: 24.1.50; In Info mode, add the name of the manual as
	completion candidate for "bookmark-set"
Date: Wed, 1 Aug 2012 03:09:24 +0200
>> Therefore, I request that the name of the info manual be included in
>> the list of candidates used by M-n, in addition to the name of the
>> node.
>
> Completely agree with you.  The standard Info node name is what you see
> in the modeline and also by typing `w' (`Info-copy-current-node-name').
> So it should be used in bookmarks as well:

Thank you.  Of course I support the change you've posted.  But my
problem was another (probably I didn't explained it well enough).

I'll give an example: If I am in info node "(emacs) Mark" and type
"C-x r m M-n", I'd like to see "emacs" (i.e. the name of the info
_manual_ alone) in the minibuffer.

This completion candidate is useful in situations where an user is
reading a manual from the beginning, and wants to keep a bookmark of
the last position read.  In this case, the user wants to name the
bookmark after the manual, not after any of its nodes.

Thus, summing up:

1. Currently there is only one completion candidate: the name of the
node.  As you've pointed out, it would be better to use the complete
node name instead, which includes the name of the manual (e.g.
"(emacs) Mark").

2. Additionally, I'd like to have another (different) completion
candidate, consisting of the name of the manual alone (e.g. "emacs"),
for the reason explained above.


-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Wed, 01 Aug 2012 08:43:03 GMT) Full text and rfc822 format available.

Message #14 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 12107 <at> debbugs.gnu.org
Subject: Re: bug#12107: 24.1.50;
	In Info mode, add the name of the manual as completion candidate for
	"bookmark-set"
Date: Wed, 01 Aug 2012 11:19:35 +0300
> 2. Additionally, I'd like to have another (different) completion
> candidate, consisting of the name of the manual alone (e.g. "emacs"),
> for the reason explained above.

Multiple values for bookmark names are not supported
by `bookmark-make-record'.  But fortunately, with
complete node names like "(emacs) Mark" you can delete
part of the name that you don't need (e.g. "Mark").
Deleting part of the name is always easier
than typing a missing part.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Wed, 01 Aug 2012 09:24:01 GMT) Full text and rfc822 format available.

Message #17 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12107 <at> debbugs.gnu.org
Subject: Re: bug#12107: 24.1.50; In Info mode, add the name of the manual as
	completion candidate for "bookmark-set"
Date: Wed, 1 Aug 2012 11:16:04 +0200
>> 2. Additionally, I'd like to have another (different) completion
>> candidate, consisting of the name of the manual alone (e.g. "emacs"),
>> for the reason explained above.
>
> Multiple values for bookmark names are not supported
> by `bookmark-make-record'.  But fortunately, with
> complete node names like "(emacs) Mark" you can delete
> part of the name that you don't need (e.g. "Mark").
> Deleting part of the name is always easier
> than typing a missing part.

Mmmm, I'm not sure what you mean by "multiples values for bookmark names".

The emacs manual says this in "(emacs) Minibuffer History":

     If you type `M-n' in the minibuffer when there are no later entries
  in the minibuffer history (e.g., if you haven't previously typed
  `M-p'), Emacs tries fetching from a list of default arguments: values
  that you are likely to enter.  You can think of this as moving through
  the "future history" list.

So, what I am requesting is just a new entry in that list of default
arguments.  In the case at hand, that list currently has only one
entry: the name of the node.  I'm missing a second entry (accessible
by typing a second M-n) with just the name of the manual.  As I said,
in some cases this second entry may be the name that the user is
looking for.


-- 
Dani Moncayo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Wed, 01 Aug 2012 20:44:02 GMT) Full text and rfc822 format available.

Message #20 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12107 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12107: 24.1.50;
	In Info mode, add the name of the manual as completion candidate for
	"bookmark-set"
Date: Wed, 01 Aug 2012 16:35:46 -0400
> Multiple values for bookmark names are not supported
> by `bookmark-make-record'.

Then let's change that.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Wed, 01 Aug 2012 23:24:03 GMT) Full text and rfc822 format available.

Message #23 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12107 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12107: 24.1.50;
	In Info mode, add the name of the manual as completion candidate for
	"bookmark-set"
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)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Thu, 02 Aug 2012 00:18:02 GMT) Full text and rfc822 format available.

Message #26 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12107 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12107: 24.1.50;
	In Info mode, add the name of the manual as completion candidate for
	"bookmark-set"
Date: Wed, 01 Aug 2012 20:10:04 -0400
> -              (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))
 
Is there a good reason why we can't use a list in (car record) and avoid
using a new `defaults' field?
If so, please add a comment explaining it.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Thu, 02 Aug 2012 08:24:01 GMT) Full text and rfc822 format available.

Message #29 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12107 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12107: 24.1.50;
	In Info mode, add the name of the manual as completion candidate for
	"bookmark-set"
Date: Thu, 02 Aug 2012 11:03:06 +0300
> Is there a good reason why we can't use a list in (car record) and avoid
> using a new `defaults' field?

Using a list in (car record) means changing the format of the bookmark record
that will require adding special casing in other packages that use it.
OTOH, adding a new `defaults' field is harmless and doesn't change the format.

> If so, please add a comment explaining it.

Will do.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12107; Package emacs. (Sun, 05 Aug 2012 00:15:01 GMT) Full text and rfc822 format available.

Message #32 received at 12107 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12107 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12107: 24.1.50;
	In Info mode, add the name of the manual as completion candidate for
	"bookmark-set"
Date: Sun, 05 Aug 2012 03:01:39 +0300
> Is there a good reason why we can't use a list in (car record) and avoid
> using a new `defaults' field?
> If so, please add a comment explaining it.

BTW, I noticed your comment about removing
`bookmark-insert-current-bookmark', so it could be
replaced with a list of the same default values for M-n
(this patch is an addition to the previous patch):

=== modified file 'lisp/bookmark.el'
--- lisp/bookmark.el	2012-08-04 23:12:29 +0000
+++ lisp/bookmark.el	2012-08-04 23:54:51 +0000
@@ -473,6 +473,12 @@ (defvar bookmark-make-record-function 'b
 (defun bookmark-make-record ()
   "Return a new bookmark record (NAME . ALIST) for the current location."
   (let ((record (funcall bookmark-make-record-function)))
+    ;; Set up defaults.
+    (bookmark-prop-set
+     record 'defaults
+     (delq nil (delete-dups (append (bookmark-prop-get record 'defaults)
+				    (list bookmark-current-bookmark
+					  (bookmark-buffer-name))))))
     ;; Set up default name.
     (if (stringp (car record))
         ;; The function already provided a default name.
@@ -738,10 +744,6 @@ (defvar bookmark-minibuffer-read-name-ma
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map minibuffer-local-map)
     (define-key map "\C-w" 'bookmark-yank-word)
-    ;; This C-u binding might not be very useful any more now that we
-    ;; provide access to the default via the standard M-n binding.
-    ;; Maybe we should just remove it?  --Stef-08
-    (define-key map "\C-u" 'bookmark-insert-current-bookmark)
     map))
 
 ;;;###autoload
@@ -900,19 +902,6 @@ (defun bookmark-edit-annotation (bookmar
   (bookmark-edit-annotation-mode bookmark-name-or-record))
 
 
-(defun bookmark-insert-current-bookmark ()
-  "Insert into the bookmark name currently being set the value of
-`bookmark-current-bookmark' in `bookmark-current-buffer', defaulting
-to the buffer's file name if `bookmark-current-bookmark' is nil."
-  (interactive)
-  (let ((str
-	 (with-current-buffer bookmark-current-buffer
-	   (or bookmark-current-bookmark
-               (bookmark-buffer-name)))))
-    (insert str)))
-
-
 (defun bookmark-buffer-name ()
   "Return the name of the current buffer in a form usable as a bookmark name.
 If the buffer is associated with a file or directory, use that name."






Reply sent to Juri Linkov <juri <at> jurta.org>:
You have taken responsibility. (Wed, 08 Aug 2012 08:59:02 GMT) Full text and rfc822 format available.

Notification sent to Dani Moncayo <dmoncayo <at> gmail.com>:
bug acknowledged by developer. (Wed, 08 Aug 2012 08:59:02 GMT) Full text and rfc822 format available.

Message #37 received at 12107-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12107-done <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#12107: 24.1.50;
	In Info mode, add the name of the manual as completion candidate for
	"bookmark-set"
Date: Wed, 08 Aug 2012 11:49:10 +0300
> If so, please add a comment explaining it.

Installed with an explanatory comment.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 05 Sep 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 236 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.