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.
+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
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
+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
"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
(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)
(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")
(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)
(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))
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)
(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
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"
(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)
(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))
"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")
(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))
(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
(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)
(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))
(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))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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)
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
--- -------
(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'."
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)
" 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'.
(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)
(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.
;; 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)
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)
(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:
+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
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
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)))
/* 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;
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)));
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;