Replace display-buffer-window by help-setup window parameter.
* window.el (display-buffer-window): Remove. (display-buffer-record-window): Use help-setup window parameter instead of variable display-buffer-window. (display-buffer-function, special-display-buffer-names) (special-display-function): Mention help-setup parameter instead of display-buffer-window in doc-string. * help.el (help-window-setup): New argument help-window. Use help-window-setup parameter instead of display-buffer-window. Reword some messages. (with-help-window): Pass window used for displaying the buffer to help-window-setup. Don't set display-buffer-window.
This commit is contained in:
parent
bf1af6c786
commit
f678e0b6a2
3 changed files with 63 additions and 58 deletions
|
@ -1,3 +1,17 @@
|
|||
2011-09-14 Martin Rudalics <rudalics@gmx.at>
|
||||
|
||||
* window.el (display-buffer-window): Remove.
|
||||
(display-buffer-record-window): Use help-setup window parameter
|
||||
instead of variable display-buffer-window.
|
||||
(display-buffer-function, special-display-buffer-names)
|
||||
(special-display-function): Mention help-setup parameter instead
|
||||
of display-buffer-window in doc-string.
|
||||
* help.el (help-window-setup): New argument help-window. Use
|
||||
help-window-setup parameter instead of display-buffer-window.
|
||||
Reword some messages.
|
||||
(with-help-window): Pass window used for displaying the buffer
|
||||
to help-window-setup. Don't set display-buffer-window.
|
||||
|
||||
2011-09-13 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* emacs-lisp/debug.el (debugger-make-xrefs):
|
||||
|
|
58
lisp/help.el
58
lisp/help.el
|
@ -1060,14 +1060,13 @@ window."
|
|||
(message "%s"
|
||||
(substitute-command-keys (concat quit-part scroll-part)))))
|
||||
|
||||
(defun help-window-setup ()
|
||||
(defun help-window-setup (help-window)
|
||||
"Set up help window for `with-help-window'.
|
||||
This relies on `display-buffer-window' being correctly set up by
|
||||
`display-buffer'."
|
||||
(let* ((help-window (car-safe display-buffer-window))
|
||||
(help-buffer (when (window-live-p help-window)
|
||||
HELP-WINDOW is the window used for displaying the help buffer."
|
||||
(let* ((help-buffer (when (window-live-p help-window)
|
||||
(window-buffer help-window)))
|
||||
(help-value (cdr-safe display-buffer-window)))
|
||||
(help-setup (when (window-live-p help-window)
|
||||
(window-parameter help-window 'help-setup))))
|
||||
(when help-buffer
|
||||
;; Handle `help-window-point-marker'.
|
||||
(when (eq (marker-buffer help-window-point-marker) help-buffer)
|
||||
|
@ -1078,6 +1077,7 @@ This relies on `display-buffer-window' being correctly set up by
|
|||
(cond
|
||||
((or (eq help-window (selected-window))
|
||||
(and (or (eq help-window-select t)
|
||||
(eq help-setup 'new-frame)
|
||||
(and (eq help-window-select 'other)
|
||||
(eq (window-frame help-window) (selected-frame))
|
||||
(> (length (window-list nil 'no-mini)) 2)))
|
||||
|
@ -1085,13 +1085,12 @@ This relies on `display-buffer-window' being correctly set up by
|
|||
;; The help window is or gets selected ...
|
||||
(help-window-display-message
|
||||
(cond
|
||||
((eq help-value 'new-window)
|
||||
((eq help-setup 'new-window)
|
||||
;; ... and is new, ...
|
||||
"Type \"q\" to delete this window")
|
||||
((eq help-value 'new-frame)
|
||||
;; ... is on a new frame ...
|
||||
"Type \"q\" to delete this frame")
|
||||
((eq help-value 'reuse-other-window)
|
||||
"Type \"q\" to delete help window")
|
||||
((eq help-setup 'new-frame)
|
||||
"Type \"q\" to delete help frame")
|
||||
((eq help-setup 'reuse-other)
|
||||
;; ... or displayed some other buffer before.
|
||||
"Type \"q\" to restore previous buffer"))
|
||||
help-window t))
|
||||
|
@ -1101,15 +1100,22 @@ This relies on `display-buffer-window' being correctly set up by
|
|||
;; other one is the selected one.
|
||||
(help-window-display-message
|
||||
(cond
|
||||
((eq help-value 'new-window)
|
||||
((eq help-setup 'new-window)
|
||||
"Type \\[delete-other-windows] to delete the help window")
|
||||
((eq help-value 'reuse-other-window)
|
||||
"Type \"q\" in other window to quit"))
|
||||
((eq help-setup 'reuse-other)
|
||||
"Type \"q\" in help window to restore its previous buffer"))
|
||||
help-window 'other))
|
||||
(t
|
||||
;; Not much to say here.
|
||||
;; The help window is not selected ...
|
||||
(help-window-display-message
|
||||
"Type \"q\" in help window to quit" help-window))))))
|
||||
(cond
|
||||
((eq help-setup 'new-window)
|
||||
;; ... and is new, ...
|
||||
"Type \"q\" in help window to delete it")
|
||||
((eq help-setup 'reuse-other)
|
||||
;; ... or displayed some other buffer before.
|
||||
"Type \"q\" in help window to restore previous buffer"))
|
||||
help-window))))))
|
||||
|
||||
;; `with-help-window' is a wrapper for `with-output-to-temp-buffer'
|
||||
;; providing the following additional twists:
|
||||
|
@ -1134,18 +1140,18 @@ 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
|
||||
;; supposed to set this to the window displaying the buffer plus
|
||||
;; some additional information.
|
||||
(setq display-buffer-window nil)
|
||||
;; 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)
|
||||
(prog1
|
||||
;; Return value returned by `with-output-to-temp-buffer'.
|
||||
(with-output-to-temp-buffer ,buffer-name
|
||||
(progn ,@body))
|
||||
(when display-buffer-window (help-window-setup)))))
|
||||
(let* (help-window
|
||||
(temp-buffer-show-hook
|
||||
(cons (lambda () (setq help-window (selected-window)))
|
||||
temp-buffer-show-hook)))
|
||||
;; Return value returned by `with-output-to-temp-buffer'.
|
||||
(prog1
|
||||
(with-output-to-temp-buffer ,buffer-name
|
||||
(progn ,@body))
|
||||
(help-window-setup help-window)))))
|
||||
|
||||
;; Called from C, on encountering `help-char' when reading a char.
|
||||
;; Don't print to *Help*; that would clobber Help history.
|
||||
|
|
|
@ -3785,17 +3785,6 @@ subwindows can get as small as `window-safe-min-height' and
|
|||
(window-state-put-2 ignore))
|
||||
(window-check frame))))
|
||||
|
||||
(defvar display-buffer-window nil
|
||||
"Window used by `display-buffer' and related information.
|
||||
After `display-buffer' displays a buffer in some window this
|
||||
variable is a cons cell whose car denotes the window used to
|
||||
display the buffer. The cdr is supposed to be one of the symbols
|
||||
`reuse-buffer-window', `reuse-other-window', `new-window' or
|
||||
`new-frame'.
|
||||
|
||||
See the function `display-buffer-record-window' for how this
|
||||
variable can be assigned a value.")
|
||||
|
||||
(defun display-buffer-record-window (type window buffer)
|
||||
"Record information for window used by `display-buffer'.
|
||||
TYPE must be one of the symbols reuse-window, pop-up-window, or
|
||||
|
@ -3804,15 +3793,13 @@ pop-up-frame. WINDOW is the window used for or created by the
|
|||
displayed."
|
||||
(cond
|
||||
((eq type 'reuse-window)
|
||||
;; In `display-buffer-window' record whether we used a window on the
|
||||
;; same buffer or another one.
|
||||
(if (eq (window-buffer window) buffer)
|
||||
(setq display-buffer-window
|
||||
(cons window 'reuse-buffer-window))
|
||||
(setq display-buffer-window
|
||||
(cons window 'reuse-other-window)))
|
||||
;; In quit-restore parameter record information about the old buffer
|
||||
;; unless such information exists already.
|
||||
;; In `help-setup' window parameter record whether we used a window
|
||||
;; on the same buffer or another one.
|
||||
(set-window-parameter
|
||||
window 'help-setup
|
||||
(if (eq (window-buffer window) buffer) 'reuse-same 'reuse-other))
|
||||
;; In `quit-restore' parameter record information about the old
|
||||
;; buffer unless such information exists already.
|
||||
(unless (window-parameter window 'quit-restore)
|
||||
(set-window-parameter
|
||||
window 'quit-restore
|
||||
|
@ -3820,15 +3807,15 @@ displayed."
|
|||
(window-point window) buffer
|
||||
(window-total-size window) (selected-window)))))
|
||||
((eq type 'pop-up-window)
|
||||
;; In `display-buffer-window' record window as new.
|
||||
(setq display-buffer-window (cons window 'new-window))
|
||||
;; In `help-setup' window parameter record window as new.
|
||||
(set-window-parameter window 'help-setup 'new-window)
|
||||
;; In `quit-restore' parameter record that we popped up this window,
|
||||
;; its buffer, and which window was selected before.
|
||||
(set-window-parameter
|
||||
window 'quit-restore (list 'new-window buffer (selected-window))))
|
||||
((eq type 'pop-up-frame)
|
||||
;; In `display-buffer-window' record window as on new frame.
|
||||
(setq display-buffer-window (cons window 'new-frame))
|
||||
;; In `help-setup' window parameter record window as on new frame.
|
||||
(set-window-parameter window 'help-setup 'new-frame)
|
||||
;; In `quit-restore' parameter record that we popped up this window
|
||||
;; on a new frame, the buffer, and which window was selected before.
|
||||
(set-window-parameter
|
||||
|
@ -3841,9 +3828,8 @@ means that the currently selected window is not acceptable. It
|
|||
should choose or create a window, display the specified buffer in
|
||||
it, and return the window.
|
||||
|
||||
The function specified here is responsible for setting the value
|
||||
of `display-buffer-window' and the quit-restore parameter of the
|
||||
window used."
|
||||
The function specified here is responsible for setting the
|
||||
quit-restore and help-setup parameters of the window used."
|
||||
:type '(choice
|
||||
(const nil)
|
||||
(function :tag "function"))
|
||||
|
@ -3913,8 +3899,8 @@ second. If `special-display-function' specifies some other
|
|||
function, that function is called with the buffer named
|
||||
BUFFER-NAME as first, and the element's cdr as second argument.
|
||||
In any case, that function is responsible for setting the value
|
||||
of `display-buffer-window' and the quit-restore parameter of the
|
||||
window used.
|
||||
The function specified here is responsible for setting the
|
||||
quit-restore and help-setup parameters of the window used.
|
||||
|
||||
If this variable appears \"not to work\", because you added a
|
||||
name to it but the corresponding buffer is displayed in the
|
||||
|
@ -4115,9 +4101,8 @@ A buffer is special when its name is either listed in
|
|||
`special-display-buffer-names' or matches a regexp in
|
||||
`special-display-regexps'.
|
||||
|
||||
The function specified here is responsible for setting the value
|
||||
of `display-buffer-window' and the quit-restore parameter of the
|
||||
window used."
|
||||
The function specified here is responsible for setting the
|
||||
quit-restore and help-setup parameters of the window used."
|
||||
:type 'function
|
||||
:group 'frames)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue