]> git.eshelyaron.com Git - emacs.git/commitdiff
Add temp-buffer-show-specifiers and replace with-output-to-temp-buffer
authorMartin Rudalics <rudalics@gmx.at>
Wed, 10 Nov 2010 09:53:22 +0000 (10:53 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Wed, 10 Nov 2010 09:53:22 +0000 (10:53 +0100)
with with-help-window.

* window.c (syms_of_window): New variable
temp-buffer-show-specifiers.
(temp_output_buffer_show): Call display-buffer with second
argument set to temp-buffer-show-specifiers and reset the latter
after the call.

* print.c (Fwith_output_to_temp_buffer): In doc-string explain how
to set up temp-buffer-show-specifiers.

* help.el (with-help-window): In doc-string say how to set up
temp-buffer-show-specifiers.

* isearch.el (isearch-help-for-help, isearch-describe-bindings)
(isearch-describe-key, isearch-describe-mode): Replace bindings
for same-window-buffer-names and same-window-regexps by binding
temp-buffer-show-specifiers instead.

* international/mule-diag.el (mule-diag):
* calc/calc-help.el (calc-describe-key, calc-full-help):
* printing.el (pr-show-setup):
* progmodes/python.el (python-describe-symbol):
* textmodes/table.el (*table--cell-describe-mode)
(*table--cell-describe-bindings):
* tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--detailed-help):
* progmodes/vhdl-mode.el (vhdl-doc-variable, vhdl-doc-mode):
* play/yow.el (apropos-zippy): Use with-help-window.

* apropos.el (apropos-command): Remove the message calculation part.
(apropos-print): Use with-help-window

* woman.el (woman-mini-help): Remove the message calculation part.
(woman-display-extended-fonts): Use with-help-window.

* display.texi (Temporary Displays): Describe
temp-buffer-show-specifiers.

18 files changed:
doc/lispref/ChangeLog
doc/lispref/display.texi
lisp/ChangeLog
lisp/apropos.el
lisp/calc/calc-help.el
lisp/help.el
lisp/international/mule-diag.el
lisp/isearch.el
lisp/play/yow.el
lisp/printing.el
lisp/progmodes/python.el
lisp/progmodes/vhdl-mode.el
lisp/textmodes/table.el
lisp/tutorial.el
lisp/woman.el
src/ChangeLog
src/print.c
src/window.c

index 9977c2ef4efd61fcc36fd69e1ecc06addad8c975..16d45c34a22cf23ac98c564ad122f914e8ed37af 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-10  Martin Rudalics  <rudalics@gmx.at>
+
+       * display.texi (Temporary Displays): Describe
+       temp-buffer-show-specifiers.
+
 2010-11-04  Martin Rudalics  <rudalics@gmx.at>
 
        * windows.texi (Resizing Windows): Explain OVERRIDE argumet for
index 92f96d302d9f64ee85ee9b07a7d79d991b9223dc..1dbd0b3c3d9ba0a847dec7dce1a50805d68ae9d6 100644 (file)
@@ -1085,6 +1085,15 @@ just as @code{with-output-to-temp-buffer} normally would, inside of
 selected.
 @end defopt
 
+@defvar temp-buffer-show-specifiers
+The value of this variable is passed by
+@code{with-output-to-temp-buffer} as second argument to
+@code{display-buffer}.  It should be a valid buffer display specifier
+(@pxref{Displaying Buffers}) and is reset to @code{nil} after the call
+to @code{display-buffer}.  Applications should only let-bind this
+variable.
+@end defvar
+
 @defvar temp-buffer-setup-hook
 This normal hook is run by @code{with-output-to-temp-buffer} before
 evaluating @var{body}.  When the hook runs, the temporary buffer is
index ae057f50552d66cf0cfc5e57d0529f7accab8225..36fc19d87af9891400e910217773d71d2cbbc1ac 100644 (file)
@@ -1,3 +1,30 @@
+2010-11-10  Martin Rudalics  <rudalics@gmx.at>
+
+       * help.el (with-help-window): In doc-string say how to set up
+       temp-buffer-show-specifiers.
+
+       * isearch.el (isearch-help-for-help, isearch-describe-bindings)
+       (isearch-describe-key, isearch-describe-mode): Replace bindings
+       for same-window-buffer-names and same-window-regexps by binding
+       temp-buffer-show-specifiers instead.
+
+       * international/mule-diag.el (mule-diag):
+       * calc/calc-help.el (calc-describe-key, calc-full-help):
+       * printing.el (pr-show-setup):
+       * progmodes/python.el (python-describe-symbol):
+       * textmodes/table.el (*table--cell-describe-mode)
+       (*table--cell-describe-bindings):
+       * tutorial.el (tutorial--describe-nonstandard-key)
+       (tutorial--detailed-help):
+       * progmodes/vhdl-mode.el (vhdl-doc-variable, vhdl-doc-mode):
+       * play/yow.el (apropos-zippy): Use with-help-window.
+
+       * apropos.el (apropos-command): Remove the message calculation part.
+       (apropos-print): Use with-help-window
+
+       * woman.el (woman-mini-help): Remove the message calculation part.
+       (woman-display-extended-fonts): Use with-help-window.
+
 2010-11-07  Martin Rudalics  <rudalics@gmx.at>
 
        * ielm.el (top-level): Remove autoloaded add-hook for
index d62721e157c5f687a8783ffbee128f4963ef3270..d7068c425f75aa5c649f91f2cfafe524b1b0ffd1 100644 (file)
@@ -465,54 +465,49 @@ while a list of strings is used as a word list."
                          "command or function" "command"))
                     current-prefix-arg))
   (apropos-parse-pattern pattern)
-  (let ((message
-        (let ((standard-output (get-buffer-create "*Apropos*")))
-          (help-print-return-message 'identity))))
-    (or do-all (setq do-all apropos-do-all))
-    (setq apropos-accumulator
-         (apropos-internal apropos-regexp
-                           (or var-predicate
-                                ;; We used to use `functionp' here, but this
-                                ;; rules out macros.  `fboundp' rules in
-                                ;; keymaps, but it seems harmless.
-                               (if do-all 'fboundp 'commandp))))
-    (let ((tem apropos-accumulator))
-      (while tem
-       (if (or (get (car tem) 'apropos-inhibit)
-               (apropos-false-hit-symbol (car tem)))
-           (setq apropos-accumulator (delq (car tem) apropos-accumulator)))
-       (setq tem (cdr tem))))
-    (let ((p apropos-accumulator)
-         doc symbol score)
-      (while p
-       (setcar p (list
-                  (setq symbol (car p))
-                  (setq score (apropos-score-symbol symbol))
-                  (unless var-predicate
-                    (if (fboundp symbol)
-                        (if (setq doc (condition-case nil
-                                           (documentation symbol t)
-                                         (error 'error)))
-                             ;; Eg alias to undefined function.
-                             (if (eq doc 'error)
-                                 "(documentation error)"
-                              (setq score (+ score (apropos-score-doc doc)))
-                              (substring doc 0 (string-match "\n" doc)))
-                          "(not documented)")))
-                  (and var-predicate
-                       (funcall var-predicate symbol)
-                       (if (setq doc (documentation-property
-                                      symbol 'variable-documentation t))
-                            (progn
-                              (setq score (+ score (apropos-score-doc doc)))
-                              (substring doc 0
-                                         (string-match "\n" doc)))))))
-       (setcar (cdr (car p)) score)
-       (setq p (cdr p))))
-    (and (let ((apropos-multi-type do-all))
-           (apropos-print t nil nil t))
-        message
-        (message "%s" message))))
+  (or do-all (setq do-all apropos-do-all))
+  (setq apropos-accumulator
+       (apropos-internal apropos-regexp
+                         (or var-predicate
+                             ;; We used to use `functionp' here, but this
+                             ;; rules out macros.  `fboundp' rules in
+                             ;; keymaps, but it seems harmless.
+                             (if do-all 'fboundp 'commandp))))
+  (let ((tem apropos-accumulator))
+    (while tem
+      (if (or (get (car tem) 'apropos-inhibit)
+             (apropos-false-hit-symbol (car tem)))
+         (setq apropos-accumulator (delq (car tem) apropos-accumulator)))
+      (setq tem (cdr tem))))
+  (let ((p apropos-accumulator)
+       doc symbol score)
+    (while p
+      (setcar p (list
+                (setq symbol (car p))
+                (setq score (apropos-score-symbol symbol))
+                (unless var-predicate
+                  (if (fboundp symbol)
+                      (if (setq doc (condition-case nil
+                                        (documentation symbol t)
+                                      (error 'error)))
+                          ;; Eg alias to undefined function.
+                          (if (eq doc 'error)
+                              "(documentation error)"
+                            (setq score (+ score (apropos-score-doc doc)))
+                            (substring doc 0 (string-match "\n" doc)))
+                        "(not documented)")))
+                (and var-predicate
+                     (funcall var-predicate symbol)
+                     (if (setq doc (documentation-property
+                                    symbol 'variable-documentation t))
+                         (progn
+                           (setq score (+ score (apropos-score-doc doc)))
+                           (substring doc 0
+                                      (string-match "\n" doc)))))))
+      (setcar (cdr (car p)) score)
+      (setq p (cdr p))))
+  (and (let ((apropos-multi-type do-all))
+        (apropos-print t nil nil t))))
 
 
 ;;;###autoload
@@ -973,7 +968,7 @@ If non-nil TEXT is a string that will be printed as a heading."
                          (and (= (cadr a) (cadr b))
                               (string-lessp (car a) (car b))))
                    (string-lessp (car a) (car b))))))
-    (with-output-to-temp-buffer "*Apropos*"
+    (with-help-window "*Apropos*"
       (let ((p apropos-accumulator)
            (old-buffer (current-buffer))
            symbol item)
index 47c951306418689168ff444de4b9127b299e0179..29c8c664fc7ea0746dc2593b2297365c514c2988 100644 (file)
@@ -266,7 +266,7 @@ C-w  Describe how there is no warranty for Calc."
                          (setq notes (sort (car (read-from-string
                                                  (format "(%s)" notes)))
                                            '<))
-                         (with-output-to-temp-buffer "*Help*"
+                         (with-help-window "*Help*"
                            (princ (format "%s\n\n" msg))
                            (set-buffer "*Calc Summary*")
                            (re-search-forward "^ *NOTES")
@@ -280,8 +280,7 @@ C-w  Describe how there is no warranty for Calc."
                                    (goto-char (point-max)))
                                (beginning-of-line)
                                (princ (buffer-substring pt (point))))
-                             (setq notes (cdr notes)))
-                           (help-print-return-message)))
+                             (setq notes (cdr notes)))))
                      (calc-unread-command (cdr key)))))
              (if (or (null defn) (integerp defn))
                  (message "%s is undefined" desc)
@@ -413,7 +412,7 @@ C-w  Describe how there is no warranty for Calc."
 
 (defun calc-full-help ()
   (interactive)
-  (with-output-to-temp-buffer "*Help*"
+  (with-help-window "*Help*"
     (princ "GNU Emacs Calculator.\n")
     (princ "  By Dave Gillespie.\n")
     (princ (format "  %s\n\n" emacs-copyright))
@@ -464,8 +463,7 @@ C-w  Describe how there is no warranty for Calc."
              calc-v-prefix-help
              calc-shift-Y-prefix-help
              calc-shift-Z-prefix-help
-             calc-z-prefix-help)))
-    (help-print-return-message)))
+             calc-z-prefix-help)))))
 
 (defun calc-h-prefix-help ()
   (interactive)
index 8ed80c2a961fb6c6dfc4ff3c4e39532a75cf2076..4b7527ad81118c8a17dea4b62b7e166214d8c8af 100644 (file)
@@ -1104,7 +1104,10 @@ This relies on `display-buffer-window' being correctly set up by
 (defmacro with-help-window (buffer-name &rest body)
   "Display buffer with name 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."
+`help-window-select' says so.  Return last value in BODY.
+
+You can specify where and how to show the buffer by binding the
+variable `temp-buffer-show-specifiers' to an appropriate value."
   (declare (indent 1) (debug t))
   `(progn
      ;; Reset `display-buffer-window': `display-buffer' is
index ed2f7e33a4cb1b1b7d3d43fbfccec76076d1572f..cda2d5f2664ca9393535d9db615b7a037e318607 100644 (file)
@@ -1076,7 +1076,7 @@ environment, including lists of input methods, coding systems,
 character sets, and fontsets (if Emacs is running under a window
 system which uses fontsets)."
   (interactive)
-  (with-output-to-temp-buffer "*Mule-Diagnosis*"
+  (with-help-window "*Mule-Diagnosis*"
     (with-current-buffer standard-output
       (insert "###############################################\n"
              "### Current Status of Multilingual Features ###\n"
@@ -1137,8 +1137,7 @@ system which uses fontsets)."
        (insert "Fontset-Name\t\t\t\t\t\t  WDxHT Style\n")
        (insert "------------\t\t\t\t\t\t  ----- -----\n")
        (dolist (fontset (fontset-list))
-         (print-fontset fontset t)))
-      (help-print-return-message))))
+         (print-fontset fontset t))))))
 
 ;;;###autoload
 (defun font-show-log (&optional limit)
index ebe2e8fa0097b6393618a4faca66218fc6a22518..c09294e47644674d2fa69e5c1c1e0008e3eb1fa9 100644 (file)
@@ -371,7 +371,7 @@ they exit Isearch mode before displaying global help."
 (defun isearch-help-for-help ()
   "Display Isearch help menu."
   (interactive)
-  (let (same-window-buffer-names same-window-regexps)
+  (let ((temp-buffer-show-specifiers t))
     (isearch-help-for-help-internal))
   (isearch-update))
 
@@ -379,7 +379,7 @@ they exit Isearch mode before displaying global help."
   "Show a list of all keys defined in Isearch mode, and their definitions.
 This is like `describe-bindings', but displays only Isearch keys."
   (interactive)
-  (let (same-window-buffer-names same-window-regexps)
+  (let ((temp-buffer-show-specifiers t))
     (with-help-window "*Help*"
       (with-current-buffer standard-output
        (princ "Isearch Mode Bindings:\n")
@@ -388,14 +388,14 @@ This is like `describe-bindings', but displays only Isearch keys."
 (defun isearch-describe-key ()
   "Display documentation of the function invoked by isearch key."
   (interactive)
-  (let (same-window-buffer-names same-window-regexps)
+  (let ((temp-buffer-show-specifiers t))
     (call-interactively 'describe-key))
   (isearch-update))
 
 (defun isearch-describe-mode ()
   "Display documentation of Isearch mode."
   (interactive)
-  (let (same-window-buffer-names same-window-regexps)
+  (let ((temp-buffer-show-specifiers t))
     (describe-function 'isearch-forward))
   (isearch-update))
 
index 72fd01353b3aa6dda121f6024e7d52eb1d336db2..562a298159e4dc062dae31735cbf35428f205a27 100644 (file)
@@ -96,12 +96,11 @@ If called interactively, display a list of matches."
                 (message "No matches found."))
                (t
                 (let ((l matches))
-                  (with-output-to-temp-buffer "*Zippy Apropos*"
+                  (with-help-window "*Zippy Apropos*"
                     (while l
                       (princ (car l))
                       (setq l (cdr l))
-                      (and l (princ "\n\n")))
-                   (help-print-return-message))))))
+                      (and l (princ "\n\n"))))))))
     matches))
 
 \f
index 7f9d7e55cbca3af0f584b9105b67222dc3d70431..5a64343aff58190d7be78d6f801e5e319d14d412 100644 (file)
@@ -5485,9 +5485,8 @@ If menu binding was not done, calls `pr-menu-bind'."
 
 
 (defun pr-show-setup (settings buffer-name)
-  (with-output-to-temp-buffer buffer-name
-    (princ settings)
-    (help-print-return-message)))
+  (with-help-window buffer-name
+    (princ settings)))
 
 
 (defun pr-complete-alist (prompt alist default)
index 46d2fc4eb7aa8f0600ae14103aed54da27e129ab..173e65ad694b7d7a3e810aae29904cd50cc67d7d 100644 (file)
@@ -1832,13 +1832,12 @@ will."
   (let ((temp-buffer-show-hook         ; avoid xref stuff
         (lambda ()
           (toggle-read-only 1))))
-    (with-output-to-temp-buffer (help-buffer)
+    (with-help-window (help-buffer)
       (with-current-buffer standard-output
        ;; Fixme: Is this actually useful?
        (help-setup-xref (list 'python-describe-symbol symbol)
                         (called-interactively-p 'interactive))
-       (set (make-local-variable 'comint-redirect-subvert-readonly) t)
-       (help-print-return-message))))
+       (set (make-local-variable 'comint-redirect-subvert-readonly) t))))
   (comint-redirect-send-command-to-process (format "emacs.ehelp(%S, %s)"
                                                   symbol python-imports)
    "*Help*" (python-proc) nil nil))
index 3847e3c56e48e1af2f0c5f5f83b302a379b57e33..9b7790f9bc7c4edcaa6e2866c54988afd029bc5b 100644 (file)
@@ -16951,26 +16951,24 @@ to visually support naming conventions.")
   (interactive)
   (unless (featurep 'xemacs)
     (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p)))
-  (with-output-to-temp-buffer
+  (with-help-window
       (if (fboundp 'help-buffer) (help-buffer) "*Help*")
     (princ (documentation-property variable 'variable-documentation))
     (with-current-buffer standard-output
-      (help-mode))
-    (help-print-return-message)))
+      (help-mode))))
 
 (defun vhdl-doc-mode ()
   "Display VHDL Mode documentation in *Help* buffer."
   (interactive)
   (unless (featurep 'xemacs)
     (help-setup-xref (list #'vhdl-doc-mode) (interactive-p)))
-  (with-output-to-temp-buffer
+  (with-help-window
       (if (fboundp 'help-buffer) (help-buffer) "*Help*")
     (princ mode-name)
     (princ " mode:\n")
     (princ (documentation 'vhdl-mode))
     (with-current-buffer standard-output
-      (help-mode))
-    (help-print-return-message)))
+      (help-mode))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
index eb2d4849a32e8d6167c7be3f2f9580b50102ff08..c47310632d1d6bbd89461a3486a21c031e6711e7 100644 (file)
@@ -4055,7 +4055,7 @@ converts a table into plain text without frames.  It is a companion to
   (interactive)
   (if (not (table--point-in-cell-p))
       (call-interactively 'describe-mode)
-    (with-output-to-temp-buffer "*Help*"
+    (with-help-window "*Help*"
       (princ "Table mode: (in ")
       (princ (format-mode-line mode-name nil nil (current-buffer)))
       (princ " mode)
@@ -4074,15 +4074,14 @@ in a fixed width mode all cell width are fixed.  When a word can not
 fit in the cell width the word is folded into the next line.  The
 folded location is marked by a continuation character which is
 specified in the variable `table-word-continuation-char'.
-")
-      (help-print-return-message))))
+"))))
 
 (defun *table--cell-describe-bindings ()
   "Table cell version of `describe-bindings'."
   (interactive)
   (if (not (table--point-in-cell-p))
       (call-interactively 'describe-bindings)
-    (with-output-to-temp-buffer "*Help*"
+    (with-help-window "*Help*"
       (princ "Table Bindings:
 key             binding
 ---             -------
@@ -4092,8 +4091,7 @@ key             binding
              (princ (format "%-16s%s\n"
                             (key-description (car binding))
                             (cdr binding))))
-           table-cell-bindings)
-      (help-print-return-message))))
+           table-cell-bindings))))
 
 (defun *table--cell-dabbrev-expand (arg)
   "Table cell version of `dabbrev-expand'."
index 6961fafb3aafc5287f67d64dc4d1b1ac5d90d9b9..7f73c47c96e3723124391c7ce85d7312265aa8f7 100644 (file)
@@ -73,7 +73,7 @@ Where
   WHERE       is a text describing the key sequences to which DEF-FUN is
               bound now (or, if it is remapped, a key sequence
               for the function it is remapped to)"
-  (with-output-to-temp-buffer (help-buffer)
+  (with-help-window (help-buffer)
     (help-setup-xref (list #'tutorial--describe-nonstandard-key value)
                      (called-interactively-p 'interactive))
     (with-current-buffer (help-buffer)
@@ -163,8 +163,7 @@ options:
                       " to get the function `"
                       (format "%s" db)
                       "'.")))
-          (fill-region (point-min) (point)))))
-      (help-print-return-message))))
+          (fill-region (point-min) (point))))))))
 
 (defun tutorial--sort-keys (left right)
   "Sort predicate for use with `tutorial--default-keys'.
@@ -322,7 +321,7 @@ LEFT and RIGHT are the elements to compare."
 
 (defun tutorial--detailed-help (button)
   "Give detailed help about changed keys."
-  (with-output-to-temp-buffer (help-buffer)
+  (with-help-window (help-buffer)
     (help-setup-xref (list #'tutorial--detailed-help button)
                      (called-interactively-p 'interactive))
     (with-current-buffer (help-buffer)
@@ -387,8 +386,7 @@ from the Emacs default:\n\n" )
 
         (insert "
 It is OK to change key bindings, but changed bindings do not
-correspond to what the tutorial says.\n\n")
-        (help-print-return-message)))))
+correspond to what the tutorial says.\n\n")))))
 
 (defun tutorial--find-changed-keys (default-keys)
   "Find the key bindings used in the tutorial that have changed.
index 25113419deb15bdc043028448f83238d0d0555b4..f683785f9f4742496a6332371c7ddc230d98f9aa 100644 (file)
@@ -1975,35 +1975,30 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
   ;; Based on apropos-command in apropos.el
   (interactive)
   (require 'apropos)
-  (let ((message
-        (let ((standard-output (get-buffer-create "*Apropos*")))
-          (help-print-return-message 'identity))))
-    (setq apropos-accumulator
-         (apropos-internal "woman"
-                           (lambda (symbol)
-                             (and
-                              (or (commandp symbol)
-                                  (user-variable-p symbol))
-                              (not (get symbol 'apropos-inhibit))))))
-    ;; Find documentation strings:
-    (let ((p apropos-accumulator)
-         doc symbol)
-      (while p
-       (setcar p (list                 ; must have 3 elements:
-                  (setq symbol (car p)) ; 1. name
-                  (if (functionp symbol) ; 2. command doc
-                      (if (setq doc (documentation symbol t))
-                          (substring doc 0 (string-match "\n" doc))
-                        "(not documented)"))
-                  (if (user-variable-p symbol) ; 3. variable doc
-                      (if (setq doc (documentation-property
-                                     symbol 'variable-documentation t))
-                          (substring doc 0 (string-match "\n" doc))))))
-       (setq p (cdr p))))
-    ;; Output the result:
-    (and (apropos-print t nil)
-        message
-        (message "%s" message))))
+  (setq apropos-accumulator
+       (apropos-internal "woman"
+                         (lambda (symbol)
+                           (and
+                            (or (commandp symbol)
+                                (user-variable-p symbol))
+                            (not (get symbol 'apropos-inhibit))))))
+  ;; Find documentation strings:
+  (let ((p apropos-accumulator)
+       doc symbol)
+    (while p
+      (setcar p (list                         ; must have 3 elements:
+                (setq symbol (car p))         ; 1. name
+                (if (functionp symbol)        ; 2. command doc
+                    (if (setq doc (documentation symbol t))
+                        (substring doc 0 (string-match "\n" doc))
+                      "(not documented)"))
+                (if (user-variable-p symbol)   ; 3. variable doc
+                    (if (setq doc (documentation-property
+                                   symbol 'variable-documentation t))
+                        (substring doc 0 (string-match "\n" doc))))))
+      (setq p (cdr p))))
+  ;; Output the result:
+  (apropos-print t nil))
 
 
 (defun WoMan-getpage-in-background (topic)
@@ -2974,7 +2969,7 @@ All the octal codes in the ranges [32..127] and [160..255] are displayed
 together with the corresponding glyphs from the default and symbol fonts.
 Useful for constructing the alist variable `woman-special-characters'."
   (interactive)
-  (with-output-to-temp-buffer "*WoMan Extended Font Map*"
+  (with-help-window "*WoMan Extended Font Map*"
     (with-current-buffer standard-output
       (let ((i 32))
        (while (< i 256)
@@ -2984,8 +2979,7 @@ Useful for constructing the alist variable `woman-special-characters'."
          (insert "   ")
          (setq i (1+ i))
          (when (= i 128) (setq i 160) (insert "\n"))
-         (if (zerop (% i 8)) (insert "\n")))))
-    (help-print-return-message)))
+         (if (zerop (% i 8)) (insert "\n")))))))
 
 \f
 ;;; Formatting macros that do not cause a break:
index 2a9f387acaea04625310356de4cff0b4af4ccc72..e8ddfe26876e4b9ef3fb5f4e45c2510d9c50f7c4 100644 (file)
@@ -1,3 +1,14 @@
+2010-11-10  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.c (syms_of_window): New variable
+       temp-buffer-show-specifiers.
+       (temp_output_buffer_show): Call display-buffer with second
+       argument set to temp-buffer-show-specifiers and reset the latter
+       after the call.
+
+       * print.c (Fwith_output_to_temp_buffer): In doc-string explain how
+       to set up temp-buffer-show-specifiers.
+
 2010-11-07  Jan Djärv  <jan.h.d@swipnet.se>
 
        * xfns.c (set_machine_and_pid_properties): Let X set WM_CLIENT_MACHINE.
        * xterm.c (x_connection_closed): Print informative error message
        when aborting on GTK.  This requires using shut_down_emacs
        directly instead of Fkill_emacs.
+
 2010-10-30  Andreas Schwab  <schwab@linux-m68k.org>
 
        * window.c (Fresize_window_apply): Use EQ to compare Lisp_Object
index ea88ba72f65fdd4033e8a473aa86073064c326a7..e42d9867d6f7c7efa775cf68c8210d35bab6ed3b 100644 (file)
@@ -625,12 +625,14 @@ Instead it binds `standard-output' to that buffer, so that output
 generated with `prin1' and similar functions in BODY goes into
 the buffer.
 
-At the end of BODY, this marks buffer BUFNAME unmodifed and displays
-it in a window, but does not select it.  The normal way to do this is
-by calling `display-buffer', then running `temp-buffer-show-hook'.
+At the end of BODY, this marks buffer BUFNAME unmodifed and displays it
+in a window, but does not select it.  The normal way to do this is by
+calling `display-buffer', then running `temp-buffer-show-hook'.
 However, if `temp-buffer-show-function' is non-nil, it calls that
 function instead (and does not run `temp-buffer-show-hook').  The
-function gets one argument, the buffer to display.
+function gets one argument, the buffer to display.  You can tell
+`display-buffer' where and how to show the buffer by binding the
+variable `temp-buffer-show-specifiers' to an appropriate value.
 
 The return value of `with-output-to-temp-buffer' is the value of the
 last form in BODY.  If BODY does not finish normally, the buffer
@@ -2047,7 +2049,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
          if (NATNUMP (Vprint_length)
              && XFASTINT (Vprint_length) < size)
            size = XFASTINT (Vprint_length);
-         
+
          PRINTCHAR ('(');
          for (i = 0; i < size; i++)
            if (!NILP (HASH_HASH (h, i)))
index 2c80f8bb82885b6940302355dda2ea749b185f32..2f3e617409c8ae7aee82de59bd30d6a22cd73b23 100644 (file)
@@ -115,6 +115,9 @@ Lisp_Object Vother_window_scroll_buffer;
 /* Non-nil means it's function to call to display temp buffers.  */
 Lisp_Object Vtemp_buffer_show_function;
 
+/* Pass as second argument to `display-buffer'.  */
+Lisp_Object Vtemp_buffer_show_specifiers;
+
 /* Non-zero means line and page scrolling on tall lines (with images)
    does partial scrolling by modifying window-vscroll.  */
 int auto_window_vscroll_p;
@@ -3196,7 +3199,10 @@ temp_output_buffer_show (register Lisp_Object buf)
     call1 (Vtemp_buffer_show_function, buf);
   else
     {
-      window = display_buffer (buf, Qnil, Qnil);
+      window = display_buffer (buf, Vtemp_buffer_show_specifiers, Qnil);
+      /* Reset Vtemp_buffer_show_specifiers immediately so it won't
+        affect subsequent calls.  */
+      Vtemp_buffer_show_specifiers = Qnil;
 
       if (!EQ (XWINDOW (window)->frame, selected_frame))
        Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
@@ -6515,6 +6521,16 @@ If this function is used, then it must do the entire job of showing
 the buffer; `temp-buffer-show-hook' is not run unless this function runs it.  */);
   Vtemp_buffer_show_function = Qnil;
 
+  DEFVAR_LISP ("temp-buffer-show-specifiers", &Vtemp_buffer_show_specifiers,
+              doc: /* Buffer display specifiers used by `with-output-to-temp-buffer'.
+These specifiers are passed by `with-output-to-temp-buffer' as second
+argument to `display-buffer'.  Applications should only let-bind this
+around a call to `with-output-to-temp-buffer'.
+
+For a description of buffer display specifiers see the variable
+`display-buffer-names'.  */);
+  Vtemp_buffer_show_specifiers = Qnil;
+
   DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window,
               doc: /* Non-nil means it is the window that C-M-v in minibuffer should scroll.  */);
   Vminibuf_scroll_window = Qnil;