GNU bug report logs -
#11131
24.0.94; Apropos bookmarks
Previous Next
Reported by: Jambunathan K <kjambunathan <at> gmail.com>
Date: Fri, 30 Mar 2012 08:59:02 UTC
Severity: wishlist
Found in version 24.0.94
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
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 11131 in the body.
You can then email your comments to 11131 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Fri, 30 Mar 2012 08:59:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jambunathan K <kjambunathan <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 30 Mar 2012 08:59:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Please provide an ido-like completion read for C-x r b.
Please provide a convenient default for C-x r m. You can work out the
details.
Some context:
As a developer, I used to use cscope to browse C code. Whenever I jump
to a symbol definition using cscope, I had a small hook which would
automatically set the bookmark at the function definition, with the
bookmark name given by the which-function or the symbol that I looked up
in the first place.
/very long time back/, I had used one of the completion packages
(icomplete?, pcomplete?, mcomplete?) to enable ido-like completion for
bookmark names.
In GNU Emacs 24.0.94.1 (i386-mingw-nt5.1.2600)
of 2012-03-19 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
`configure --with-gcc (4.6) --no-opt --enable-checking --cflags
-ID:/devel/emacs/libs/libXpm-3.5.8/include
-ID:/devel/emacs/libs/libXpm-3.5.8/src
-ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
-ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
-ID:/devel/emacs/libs/giflib-4.1.4-1/include
-ID:/devel/emacs/libs/jpeg-6b-4/include
-ID:/devel/emacs/libs/tiff-3.8.2-1/include
-ID:/devel/emacs/libs/gnutls-3.0.9/include'
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Fri, 30 Mar 2012 13:18:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 11131 <at> debbugs.gnu.org (full text, mbox):
> Please provide an ido-like completion read for C-x r b.
It's a bit late to change things for 24.1, but for 24.2 we can adjust.
Which part of "ido-like" would you like to see there?
> Please provide a convenient default for C-x r m. You can work out the
> details.
C-x r m already provides a default, so could you give some more details
as to what kind of default would be more "convenient"?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Tue, 11 Sep 2012 08:11:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 11131 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> Please provide an ido-like completion read for C-x r b.
>
> It's a bit late to change things for 24.1, but for 24.2 we can adjust.
> Which part of "ido-like" would you like to see there?
>
>> Please provide a convenient default for C-x r m. You can work out the
>> details.
>
> C-x r m already provides a default, so could you give some more details
> as to what kind of default would be more "convenient"?
Use case:
========
I mark frequently used functions with `C-x r m' and I create a bookmark
to that function name using something like this in .emacs.
(defadvice bookmark-set
(around my-bookmark-set (name no-overwrite))
(ad-set-arg 0 (which-function))
(ad-set-arg 1 nil)
(message "Bookmark: %s" (ad-get-arg 0))
ad-do-it)
(ad-activate 'bookmark-set)
With a simple ido-like completion (or iswitchb-like completion), I can
jump to the function name quickly without typing the whole function
name.
(Indicative) patch
==================
This is not an actual patch. Something like this will do.
=== modified file 'lisp/bookmark.el'
--- lisp/bookmark.el 2012-08-08 08:48:57 +0000
+++ lisp/bookmark.el 2012-09-11 08:03:37 +0000
@@ -433,7 +433,7 @@ the empty string."
(format " (%s): " default)
": ")))
(str
- (completing-read prompt
+ (ido-completing-read prompt
bookmark-alist
nil
0
Gnus also does it
=================
Gnus also tries to achieve the same thing - that which I am trying to do
wrt bookmarks - by it's own private user variable.
,---- from gnus-util.el :: L43
| (defcustom gnus-completing-read-function 'gnus-emacs-completing-read
| "Function use to do completing read."
| :version "24.1"
| :group 'gnus-meta
| :type `(radio (function-item
| :doc "Use Emacs standard `completing-read' function."
| gnus-emacs-completing-read)
| ;; iswitchb.el is very old and ido.el is unavailable
| ;; in XEmacs, so we exclude those function items.
| ,@(unless (featurep 'xemacs)
| '((function-item
| :doc "Use `ido-completing-read' function."
| gnus-ido-completing-read)
| (function-item
| :doc "Use iswitchb based completing-read function."
| gnus-iswitchb-completing-read)))))
`----
There is another way to do it
=============================
Have bookmark use completing-read-function. Then I can set it to use
ido-completing-read.
,----[ C-h v completing-read-function RET ]
| completing-read-function is a variable defined in `minibuffer.el'.
| Its value is completing-read-default
|
| This variable may be risky if used as a file-local variable.
|
| Documentation:
| The function called by `completing-read' to do its work.
| It should accept the same arguments as `completing-read'.
|
| [back]
`----
Question
========
Now the question is, what is the best way to kill multiple mangoes with
a single stone and not allow above customizations to proliferate on
per-package basis.
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Tue, 11 Sep 2012 13:21:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 11131 <at> debbugs.gnu.org (full text, mbox):
> With a simple ido-like completion (or iswitchb-like completion), I can
> jump to the function name quickly without typing the whole function
> name.
Again: "Which part of "ido-like" would you like to see there?".
IDO completion has many differences compared to Emacs's historical
prefix-completion. But Emacs's current default completion code supports
several of those features.
E.g. in Emacs-24, C-x b provides substring completion (and if you
enable icomplete-mode which just shows you the list of completion
candidates at the end of the minibuffer, it gets even closer to
iswitchb).
> - (completing-read prompt
> + (ido-completing-read prompt
That is not an option: we want the completion behavior to be consistent,
and there's nothing magical about bookmarks which justifies a thoroughly
different behavior, I think.
OTOH, maybe bookmarks have particular properties which justify tweaking
the completion behavior for them, just like it is the case for C-x b.
E.g. we could make C-x r b use substring completion.
> Have bookmark use completing-read-function.
It does, since it calls completing-read which in turn calls the
completing-read-function.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Tue, 11 Sep 2012 16:53:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 11131 <at> debbugs.gnu.org (full text, mbox):
>> With a simple ido-like completion (or iswitchb-like completion), I can
>> jump to the function name quickly without typing the whole function
>> name.
>
> Again: "Which part of "ido-like" would you like to see there?".
The answer has to be how the UI works (i.e., how I *interact* with the
completion mechanism and not how completions are computed.)
It would be wonderful if -
All aspects of completion happens right within the mini-buffer.
With the default interface the following are turn-offs (which is pretty
much everything)
- TAB,
- work window getting split in to two
- Using mouse or RET for final choice
> IDO completion has many differences compared to Emacs's historical
> prefix-completion. But Emacs's current default completion code supports
> several of those features.
>
> E.g. in Emacs-24, C-x b provides substring completion (and if you
> enable icomplete-mode which just shows you the list of completion
> candidates at the end of the minibuffer, it gets even closer to
> iswitchb).
>
>> - (completing-read prompt
>> + (ido-completing-read prompt
>
> That is not an option: we want the completion behavior to be consistent,
> and there's nothing magical about bookmarks which justifies a thoroughly
> different behavior, I think.
> OTOH, maybe bookmarks have particular properties which justify tweaking
> the completion behavior for them, just like it is the case for C-x b.
> E.g. we could make C-x r b use substring completion.
Since my bookmarks are function names, substring completion is what I
desire. (Many functions share the *same* prefix)
[Context Switch] I think having a standard hook to choose the default
name of bookmark will also be useful. In prog-modes, I will probably
set it to which-function.
>> Have bookmark use completing-read-function.
>
> It does, since it calls completing-read which in turn calls the
> completing-read-function.
May be there is a reason why completing-read-function is not
customizable?
> Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Tue, 11 Sep 2012 18:06:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 11131 <at> debbugs.gnu.org (full text, mbox):
>>> With a simple ido-like completion (or iswitchb-like completion),
>>> I can jump to the function name quickly without typing the whole
>>> function name.
>> Again: "Which part of "ido-like" would you like to see there?".
> The answer has to be how the UI works (i.e., how I *interact* with the
> completion mechanism and not how completions are computed.)
In that case the change can't be active by default because that would be
incompatible with our desire for a consistent completion UI.
> It would be wonderful if -
> All aspects of completion happens right within the mini-buffer.
> With the default interface the following are turn-offs (which is pretty
> much everything)
> - TAB,
> - work window getting split in to two
> - Using mouse or RET for final choice
I'm not exactly sure about what you mean by the above. IDO still uses
TAB and RET in mostly similar ways to the default UI, and still splits
the window when displaying the *Completions* buffer.
Have you tried icomplete-mode?
> Since my bookmarks are function names, substring completion is what I
> desire. (Many functions share the *same* prefix)
It seems this can't be changed by customizing
completion-category-overrides right now, so we'll need to change
bookmark.el's completion table to provide a `category'.
> [Context Switch] I think having a standard hook to choose the default
> name of bookmark will also be useful. In prog-modes, I will probably
> set it to which-function.
Sounds fine. Patch welcome.
>>> Have bookmark use completing-read-function.
>> It does, since it calls completing-read which in turn calls the
>> completing-read-function.
> May be there is a reason why completing-read-function is not
> customizable?
You can customize it, just not with Custom. No particular reason.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Tue, 11 Sep 2012 19:32:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 11131 <at> debbugs.gnu.org (full text, mbox):
>> [Context Switch] I think having a standard hook to choose the default
>> name of bookmark will also be useful. In prog-modes, I will probably
>> set it to which-function.
>
> Sounds fine. Patch welcome.
Bug#12107 added a new parameter for the default bookmark names.
So `bookmark-make-record-default' could be modified to set its value
from the result of a function defined by a new customizable variable
(where `which-function' could be one of its possible value).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Fri, 26 Oct 2012 17:38:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 11131 <at> debbugs.gnu.org (full text, mbox):
>> Again: "Which part of "ido-like" would you like to see there?".
> With the default interface the following are turn-offs (which is pretty
> much everything)
> - TAB,
> - work window getting split in to two
> - Using mouse or RET for final choice
IIUC, you're looking into making icomplete provide what you need, so
this is tracked elsewhere now.
> Since my bookmarks are function names, substring completion is what I
> desire. (Many functions share the *same* prefix)
I haven't changed the default, but I have added a `category' of
`bookmark', so you can use substring completion simply by customizing
completion-category-overrides.
> [Context Switch] I think having a standard hook to choose the default
> name of bookmark will also be useful. In prog-modes, I will probably
> set it to which-function.
I'd be happy to install patch that goes along these lines (tho I'd probably
prefer "filename:functionname").
>>> Have bookmark use completing-read-function.
>> It does, since it calls completing-read which in turn calls the
>> completing-read-function.
> May be there is a reason why completing-read-function is not
> customizable?
Yes: it's expected to be modified by Lisp code rather than via
a Custom setting. The Customize UI wouldn't be able to provide much
guidance as to what value the user could want to put there.
Stefan
bug closed, send any further explanations to
11131 <at> debbugs.gnu.org and Jambunathan K <kjambunathan <at> gmail.com>
Request was from
Stefan Monnier <monnier <at> iro.umontreal.ca>
to
control <at> debbugs.gnu.org
.
(Fri, 26 Oct 2012 17:39:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Fri, 26 Oct 2012 20:13:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 11131 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> Since my bookmarks are function names, substring completion is what I
>> desire. (Many functions share the *same* prefix)
>
> I haven't changed the default, but I have added a `category' of
> `bookmark', so you can use substring completion simply by customizing
> completion-category-overrides.
Thanks for this patch.
Good news:
I can confirm that `substring' for `bookmark' category works.
(custom-set-variables
'(completion-category-overrides
(quote ((buffer (styles basic substring))
(bookmark (styles substring))))))
Bad news:
`icomplete-mode' never kicks in for `C-x r b' (even with default
setting of `completion-category-overrides'). Once I reverse your
changes icomplete-mode kicks in.
$ bzr merge . -r 110680..110679
Something is surely amiss.
Request:
Following patch advertizes new category.
[bug11131.diff (text/x-diff, inline)]
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2012-10-26 18:01:30 +0000
+++ lisp/ChangeLog 2012-10-26 20:02:27 +0000
@@ -1,3 +1,8 @@
+2012-10-26 Jambunathan K <kjambunathan <at> gmail.com>
+
+ * minibuffer.el (completion-category-overrides): New completion
+ category `bookmark' (bug#11131).
+
2012-10-26 Stefan Monnier <monnier <at> iro.umontreal.ca>
* emacs-lisp/advice.el (ad-assemble-advised-definition):
=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el 2012-10-25 12:56:13 +0000
+++ lisp/minibuffer.el 2012-10-26 19:58:22 +0000
@@ -743,6 +743,7 @@
(const buffer)
(const file)
(const unicode-name)
+ (const bookmark)
symbol)
:value-type
(set :tag "Properties to override"
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#11131
; Package
emacs
.
(Fri, 26 Oct 2012 20:48:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 11131 <at> debbugs.gnu.org (full text, mbox):
> `icomplete-mode' never kicks in for `C-x r b' (even with default
> setting of `completion-category-overrides'). Once I reverse your
> changes icomplete-mode kicks in.
> $ bzr merge . -r 110680..110679
> Something is surely amiss.
(setq icomplete-with-completion-tables t)
> Request:
> Following patch advertizes new category.
Thanks, installed,
Stefan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 24 Nov 2012 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 213 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.