unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9030: `where-is' doesn't play well `with with-output-to-string'
@ 2011-07-09  2:39 PJ Weisberg
  2011-07-12 22:33 ` Glenn Morris
  2011-09-13  7:18 ` Glenn Morris
  0 siblings, 2 replies; 6+ messages in thread
From: PJ Weisberg @ 2011-07-09  2:39 UTC (permalink / raw)
  To: 9030

This expression:

(with-output-to-string
  (where-is 'yank))

returns nil, and prints a message in the echo area.  This one-line
change fixes it:

diff --git a/lisp/help.el b/lisp/help.el
index e6496f6..53e99e7 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -527,7 +527,7 @@ If INSERT (the prefix arg) is non-nil, insert the
message in the buffer."
   (unless definition (error "No command"))
   (let ((func (indirect-function definition))
         (defs nil)
-        (standard-output (if insert (current-buffer) t)))
+        (standard-output (if insert (current-buffer) standard-output)))
     ;; In DEFS, find all symbols that are aliases for DEFINITION.
     (mapatoms (lambda (symbol)
 		(and (fboundp symbol)





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

* bug#9030: `where-is' doesn't play well `with with-output-to-string'
  2011-07-09  2:39 bug#9030: `where-is' doesn't play well `with with-output-to-string' PJ Weisberg
@ 2011-07-12 22:33 ` Glenn Morris
  2011-07-13  3:54   ` Stefan Monnier
  2011-09-13  7:18 ` Glenn Morris
  1 sibling, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2011-07-12 22:33 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 9030

PJ Weisberg wrote:

> (with-output-to-string
>   (where-is 'yank))
>
> returns nil, and prints a message in the echo area.  This one-line
> change fixes it:
[...]
> --- a/lisp/help.el
> +++ b/lisp/help.el
> @@ -527,7 +527,7 @@ If INSERT (the prefix arg) is non-nil, insert the
> message in the buffer."
>    (unless definition (error "No command"))
>    (let ((func (indirect-function definition))
>          (defs nil)
> -        (standard-output (if insert (current-buffer) t)))
> +        (standard-output (if insert (current-buffer) standard-output)))
>      ;; In DEFS, find all symbols that are aliases for DEFINITION.
>      (mapatoms (lambda (symbol)
>  		(and (fboundp symbol)


Tangentially, I wonder why where-is needs an optional INSERT argument
that means "don't print the result, instead insert it (oh, and use a
slightly different format)".





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

* bug#9030: `where-is' doesn't play well `with with-output-to-string'
  2011-07-12 22:33 ` Glenn Morris
@ 2011-07-13  3:54   ` Stefan Monnier
  2011-07-13  4:44     ` PJ Weisberg
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2011-07-13  3:54 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 9030, PJ Weisberg

> Tangentially, I wonder why where-is needs an optional INSERT argument
> that means "don't print the result, instead insert it (oh, and use a
> slightly different format)".

It's clearly meant for interactive use.  I'm not sure if it answers your
question, tho.


        Stefan





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

* bug#9030: `where-is' doesn't play well `with with-output-to-string'
  2011-07-13  3:54   ` Stefan Monnier
@ 2011-07-13  4:44     ` PJ Weisberg
  2011-08-07 17:21       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: PJ Weisberg @ 2011-07-13  4:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9030@debbugs.gnu.org, PJ Weisberg

On Tuesday, July 12, 2011, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> Tangentially, I wonder why where-is needs an optional INSERT argument
>> that means "don't print the result, instead insert it (oh, and use a
>> slightly different format)".
>
> It's clearly meant for interactive use.  I'm not sure if it answers your
> question, tho.

For what it's worth, the code that gives what I was actually trting to
get from `what-is' is `(mapcar 'key-description (where-is-internal
foo))'.  I don't know if there's a way to get that without using a
function with "internal" in the name.

-- 

-PJ





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

* bug#9030: `where-is' doesn't play well `with with-output-to-string'
  2011-07-13  4:44     ` PJ Weisberg
@ 2011-08-07 17:21       ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2011-08-07 17:21 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 9030@debbugs.gnu.org

>>> Tangentially, I wonder why where-is needs an optional INSERT argument
>>> that means "don't print the result, instead insert it (oh, and use a
>>> slightly different format)".
>> It's clearly meant for interactive use.  I'm not sure if it answers your
>> question, tho.
> For what it's worth, the code that gives what I was actually trting to
> get from `what-is' is `(mapcar 'key-description (where-is-internal
> foo))'.  I don't know if there's a way to get that without using a
> function with "internal" in the name.

Yes, this is not quite right: where-is-internal is not nearly as
internal as the name implies.  It's just the natural function to use,
whereas where-is is the corresponding command.
Maybe we should fix the names to make where-is-internal less scary.


        Stefan





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

* bug#9030: `where-is' doesn't play well `with with-output-to-string'
  2011-07-09  2:39 bug#9030: `where-is' doesn't play well `with with-output-to-string' PJ Weisberg
  2011-07-12 22:33 ` Glenn Morris
@ 2011-09-13  7:18 ` Glenn Morris
  1 sibling, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2011-09-13  7:18 UTC (permalink / raw)
  To: 9030-done

Version: 24.1

Thanks; applied.





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

end of thread, other threads:[~2011-09-13  7:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-09  2:39 bug#9030: `where-is' doesn't play well `with with-output-to-string' PJ Weisberg
2011-07-12 22:33 ` Glenn Morris
2011-07-13  3:54   ` Stefan Monnier
2011-07-13  4:44     ` PJ Weisberg
2011-08-07 17:21       ` Stefan Monnier
2011-09-13  7:18 ` Glenn Morris

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).