diff options
author | Martin Rudalics <rudalics@gmx.at> | 2008-08-14 05:51:24 +0000 |
---|---|---|
committer | Martin Rudalics <rudalics@gmx.at> | 2008-08-14 05:51:24 +0000 |
commit | eff26424890faa5b3970319e6cdcae939c6d942d (patch) | |
tree | f1774abaaa505a1e244da8f6de1209fa9a1e789f /lisp | |
parent | c7041c350e1ea171c980cb6f73a96db563c801e6 (diff) | |
download | emacs-eff26424890faa5b3970319e6cdcae939c6d942d.tar.gz |
(with-help-window): Return last value in BODY.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 4 | ||||
-rw-r--r-- | lisp/help.el | 27 |
2 files changed, 17 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9ef1c2cd618..40dcc23d92f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2008-08-14 Martin Rudalics <rudalics@gmx.at> + + * help.el (with-help-window): Return last value in BODY. + 2008-08-14 Michael Albinus <michael.albinus@gmx.de> * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the diff --git a/lisp/help.el b/lisp/help.el index 44e3f707af1..9ab2d77854b 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1207,7 +1207,7 @@ window itself is specified by the variable `help-window'." (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." +`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 @@ -1222,23 +1222,22 @@ Select help window if the actual value of the user option 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. + ;; Make `help-window' t 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))) + (prog1 + ;; Return value returned by `with-output-to-temp-buffer'. + (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)))) (provide 'help) |