unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17705: [PATCH] lisp/help.el (where-is): don't recreate completing-read's functionality for defaults
@ 2014-06-05 18:08 Cameron Desautels
  2014-06-12  2:21 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Cameron Desautels @ 2014-06-05 18:08 UTC (permalink / raw)
  To: 17705

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

`where-is` was looking for empty string return values from
`completing-read` and swapping in a default value in that
case. Updated now to use the default-handling mechanism provided by
`completing-read`, rather than recreating it.

This also provides a bit of extra capability because now the user can
insert the default value into the minibuffer (for modification) via
`next-history-element` (so-called "future history", described in the
elisp manual).

-- 
Cameron Desautels <camdez@gmail.com>

[-- Attachment #2: 0001-lisp-help.el-where-is-don-t-recreate-completing-read.patch --]
[-- Type: application/octet-stream, Size: 1437 bytes --]

From b3429c0e1e79a4cfba97fa59acea05c06412a9d9 Mon Sep 17 00:00:00 2001
From: Cameron Desautels <camdez@gmail.com>
Date: Thu, 5 Jun 2014 12:37:35 -0500
Subject: [PATCH] lisp/help.el (where-is): don't recreate completing-read's
 functionality for defaults

`where-is` was looking for empty string return values from
`completing-read` and swapping in a default value in that
case. Updated now to use the default-handling mechanism provided by
`completing-read`, rather than recreating it.

This also provides a bit of extra capability because now the user can
insert the default value into the minibuffer (for modification) via
`next-history-element` (so-called "future history", described in the
elisp manual).
---
 lisp/help.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/help.el b/lisp/help.el
index 9322702..739eac4 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -517,8 +517,10 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
 		(if fn
 		    (format "Where is command (default %s): " fn)
 		  "Where is command: ")
-		obarray 'commandp t))
-     (list (if (equal val "") fn (intern val)) current-prefix-arg)))
+		obarray 'commandp t nil nil
+		(and fn (symbol-name fn))))
+     (list (unless (equal val "") (intern val))
+	   current-prefix-arg)))
   (unless definition (error "No command"))
   (let ((func (indirect-function definition))
         (defs nil)
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-12  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-05 18:08 bug#17705: [PATCH] lisp/help.el (where-is): don't recreate completing-read's functionality for defaults Cameron Desautels
2014-06-12  2:21 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).