From: Martin Rudalics Date: Wed, 10 Nov 2010 09:53:22 +0000 (+0100) Subject: Add temp-buffer-show-specifiers and replace with-output-to-temp-buffer X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=44f1b42a3ffc37b193bc49037c40dbf08f4a5567;p=emacs.git Add temp-buffer-show-specifiers and replace with-output-to-temp-buffer 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. --- diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 9977c2ef4ef..16d45c34a22 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2010-11-10 Martin Rudalics + + * display.texi (Temporary Displays): Describe + temp-buffer-show-specifiers. + 2010-11-04 Martin Rudalics * windows.texi (Resizing Windows): Explain OVERRIDE argumet for diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 92f96d302d9..1dbd0b3c3d9 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -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 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ae057f50552..36fc19d87af 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,30 @@ +2010-11-10 Martin Rudalics + + * 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 * ielm.el (top-level): Remove autoloaded add-hook for diff --git a/lisp/apropos.el b/lisp/apropos.el index d62721e157c..d7068c425f7 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -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) diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index 47c95130641..29c8c664fc7 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el @@ -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) diff --git a/lisp/help.el b/lisp/help.el index 8ed80c2a961..4b7527ad811 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -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 diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index ed2f7e33a4c..cda2d5f2664 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -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) diff --git a/lisp/isearch.el b/lisp/isearch.el index ebe2e8fa009..c09294e4764 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -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)) diff --git a/lisp/play/yow.el b/lisp/play/yow.el index 72fd01353b3..562a298159e 100644 --- a/lisp/play/yow.el +++ b/lisp/play/yow.el @@ -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)) diff --git a/lisp/printing.el b/lisp/printing.el index 7f9d7e55cbc..5a64343aff5 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -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) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 46d2fc4eb7a..173e65ad694 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -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)) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 3847e3c56e4..9b7790f9bc7 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -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)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index eb2d4849a32..c47310632d1 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -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'." diff --git a/lisp/tutorial.el b/lisp/tutorial.el index 6961fafb3aa..7f73c47c96e 100644 --- a/lisp/tutorial.el +++ b/lisp/tutorial.el @@ -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. diff --git a/lisp/woman.el b/lisp/woman.el index 25113419deb..f683785f9f4 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -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"))))))) ;;; Formatting macros that do not cause a break: diff --git a/src/ChangeLog b/src/ChangeLog index 2a9f387acae..e8ddfe26876 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2010-11-10 Martin Rudalics + + * 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 * xfns.c (set_machine_and_pid_properties): Let X set WM_CLIENT_MACHINE. @@ -242,6 +253,7 @@ * 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 * window.c (Fresize_window_apply): Use EQ to compare Lisp_Object diff --git a/src/print.c b/src/print.c index ea88ba72f65..e42d9867d6f 100644 --- a/src/print.c +++ b/src/print.c @@ -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))) diff --git a/src/window.c b/src/window.c index 2c80f8bb828..2f3e617409c 100644 --- a/src/window.c +++ b/src/window.c @@ -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;