unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#702: with-help-window returns nil
@ 2008-08-12 16:52 Glenn Morris
  2008-08-12 17:27 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2008-08-12 16:52 UTC (permalink / raw)
  To: emacs-pretest-bug


Current CVS trunk:

with-help-window returns nil, rather than the last value of BODY.
This causes, eg, describe-function to return nil, rather than the
description. This breaks, eg, eshell/which:

emacs -Q -f eshell
eshell> which which
Wrong type argument: stringp, nil






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

* bug#702: with-help-window returns nil
  2008-08-12 16:52 Glenn Morris
@ 2008-08-12 17:27 ` Lennart Borgman (gmail)
  2008-08-12 17:58   ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2008-08-12 17:27 UTC (permalink / raw)
  To: Glenn Morris, 702; +Cc: emacs-pretest-bug, John Wiegley

Glenn Morris wrote:
> Current CVS trunk:
> 
> with-help-window returns nil, rather than the last value of BODY.
> This causes, eg, describe-function to return nil, rather than the
> description. This breaks, eg, eshell/which:
> 
> emacs -Q -f eshell
> eshell> which which
> Wrong type argument: stringp, nil


I just reported this problem to the maintainer of eshell and suggested 
to fetch the documentation in another way.

It is not documented that describe-function should return the doc string.






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

* bug#702: with-help-window returns nil
  2008-08-12 17:27 ` Lennart Borgman (gmail)
@ 2008-08-12 17:58   ` Drew Adams
  2008-08-12 18:11     ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2008-08-12 17:58 UTC (permalink / raw)
  To: 'Lennart Borgman (gmail)', 702, 'Glenn Morris'
  Cc: emacs-pretest-bug, 'John Wiegley'

> It is not documented that describe-function should return the 
> doc string.

And rightfully so. It does not return the doc string. It returns the content of
*Help*, that is, everything that is there, which includes the doc-string text.
See `describe-function-1' for what is included.

Yes, we could document that it returns the contents of *Help* as a string, but
I'm not sure that would be helpful to most users of `describe-funtion'. Those
who are concerned about the return value will likely look at the source code,
which already includes a comment about it.







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

* bug#702: with-help-window returns nil
  2008-08-12 17:58   ` Drew Adams
@ 2008-08-12 18:11     ` Lennart Borgman (gmail)
  2008-08-12 18:29       ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2008-08-12 18:11 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'John Wiegley', 702, emacs-pretest-bug

Drew Adams wrote:
>> It is not documented that describe-function should return the 
>> doc string.
> 
> And rightfully so. It does not return the doc string. It returns the content of
> *Help*, that is, everything that is there, which includes the doc-string text.
> See `describe-function-1' for what is included.
> 
> Yes, we could document that it returns the contents of *Help* as a string, but
> I'm not sure that would be helpful to most users of `describe-funtion'. Those
> who are concerned about the return value will likely look at the source code,
> which already includes a comment about it.

What is wrong with just using (documentation 'my-fun t) instead?






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

* bug#702: with-help-window returns nil
  2008-08-12 18:11     ` Lennart Borgman (gmail)
@ 2008-08-12 18:29       ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2008-08-12 18:29 UTC (permalink / raw)
  To: 'Lennart Borgman (gmail)'
  Cc: 'John Wiegley', 702, emacs-pretest-bug

> >> It is not documented that describe-function should return the 
> >> doc string.
> > 
> > And rightfully so. It does not return the doc string. It 
> > returns the content of *Help*, that is, everything that
> > is there, which includes the doc-string text.
> > See `describe-function-1' for what is included.
> > 
> > Yes, we could document that it returns the contents of 
> > *Help* as a string, but I'm not sure that would be helpful
> > to most users of `describe-funtion'. Those who are
> > concerned about the return value will likely look at the
> > source code, which already includes a comment about it.
> 
> What is wrong with just using (documentation 'my-fun t) instead?

Instead of what?

Do you mean return that from `describe-function'? Why?

If you want that in some Lisp code, then just use that - no need to call
`describe-function'. If you want what *Help* displays for `describe-function',
however, then you can use the return value of `describe-function'.







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

* bug#702: with-help-window returns nil
@ 2008-08-13  5:52 martin rudalics
  2008-08-13 16:50 ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: martin rudalics @ 2008-08-13  5:52 UTC (permalink / raw)
  To: 702

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

 > with-help-window returns nil, rather than the last value of BODY.
 > This causes, eg, describe-function to return nil, rather than the
 > description.

Do I get away with the attached patch?

martin

[-- Attachment #2: 702.diff --]
[-- Type: text/plain, Size: 3010 bytes --]

*** help.el.~1.341.~	2008-06-06 22:02:42.000000000 +0200
--- help.el	2008-08-13 07:45:02.796875000 +0200
***************
*** 1207,1213 ****
  (defmacro with-help-window (buffer-name &rest body)
    "Display buffer BUFFER-NAME in a help window evaluating BODY.
  Select help window if the actual value of the user option
! `help-window-select' says so."
    (declare (indent 1) (debug t))
    ;; Bind list-of-frames to `frame-list' and list-of-window-tuples to a
    ;; list of one <window window-buffer window-start window-point> tuple
--- 1207,1213 ----
  (defmacro with-help-window (buffer-name &rest body)
    "Display buffer BUFFER-NAME in a help window evaluating BODY.
  Select help window if the actual value of the user option
! `help-window-select' says so.  Return last value in BODY."
    (declare (indent 1) (debug t))
    ;; Bind list-of-frames to `frame-list' and list-of-window-tuples to a
    ;; list of one <window window-buffer window-start window-point> tuple
***************
*** 1221,1244 ****
  			   (window-start window) (window-point window))
  		     list))
  	     'no-mini t)
! 	    list)))
!      ;; We set `help-window' to t in order to trigger `help-mode-finish'
!      ;; to set `help-window' to the actual help window.
       (setq help-window t)
       ;; Make `help-window-point-marker' point nowhere (the only place
       ;; where this should be set to a buffer position is within BODY).
       (set-marker help-window-point-marker nil)
! 
!      (with-output-to-temp-buffer ,buffer-name
!        (progn ,@body))
! 
       (when (windowp help-window)
         ;; Set up help window.
         (help-window-setup list-of-frames list-of-window-tuples))
- 
       ;; Reset `help-window' to nil to avoid confusing future calls of
!      ;; `help-mode-finish' by "plain" `with-output-to-temp-buffer'.
!      (setq help-window nil)))
  \f
  (provide 'help)
  
--- 1221,1246 ----
  			   (window-start window) (window-point window))
  		     list))
  	     'no-mini t)
! 	    list))
! 	 value)
!      ;; Setting `help-window' to t shall trigger `help-mode-finish' to
!      ;; set `help-window' to the actual help window.
       (setq help-window t)
       ;; Make `help-window-point-marker' point nowhere (the only place
       ;; where this should be set to a buffer position is within BODY).
       (set-marker help-window-point-marker nil)
!      ;; Save value returned by `with-output-to-temp-buffer'.
!      (setq value
! 	   (with-output-to-temp-buffer ,buffer-name
! 	     (progn ,@body)))
       (when (windowp help-window)
         ;; Set up help window.
         (help-window-setup list-of-frames list-of-window-tuples))
       ;; Reset `help-window' to nil to avoid confusing future calls of
!      ;; `help-mode-finish' with "plain" `with-output-to-temp-buffer'.
!      (setq help-window nil)
!      ;; Return value returned by `with-output-to-temp-buffer'.
!      value))
  \f
  (provide 'help)
  

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

* bug#702: with-help-window returns nil
  2008-08-13  5:52 bug#702: with-help-window returns nil martin rudalics
@ 2008-08-13 16:50 ` Glenn Morris
  2008-08-13 17:05   ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2008-08-13 16:50 UTC (permalink / raw)
  To: martin rudalics; +Cc: 702

martin rudalics wrote:

> Do I get away with the attached patch?

Yes, or just with a prog1. Thanks.






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

* bug#702: with-help-window returns nil
  2008-08-13 16:50 ` Glenn Morris
@ 2008-08-13 17:05   ` martin rudalics
  0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2008-08-13 17:05 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 702

> Yes, or just with a prog1. Thanks.

Indeed.  I think I'll use prog1.

Thank you, martin.








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

end of thread, other threads:[~2008-08-13 17:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-13  5:52 bug#702: with-help-window returns nil martin rudalics
2008-08-13 16:50 ` Glenn Morris
2008-08-13 17:05   ` martin rudalics
  -- strict thread matches above, loose matches on Subject: below --
2008-08-12 16:52 Glenn Morris
2008-08-12 17:27 ` Lennart Borgman (gmail)
2008-08-12 17:58   ` Drew Adams
2008-08-12 18:11     ` Lennart Borgman (gmail)
2008-08-12 18:29       ` Drew Adams

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