Subject: bug#11131: 24.0.94; Apropos bookmarks

From: Jambunathan K <[email-masked]>
Date: Tue, 11 Sep 2012 13:41:08 +0530

Stefan Monnier <[email-masked]> 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.

--