summaryrefslogtreecommitdiff
path: root/lisp/help.el
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2012-09-30 11:10:59 +0200
committerMartin Rudalics <rudalics@gmx.at>2012-09-30 11:10:59 +0200
commit5938d5196d09aff887aa74603c102b1f303a613a (patch)
tree57c528aafa761114bf2528593a85642e6e3e5e21 /lisp/help.el
parenta97dc380601446c00adfbd1d8e86e73e7d81a359 (diff)
downloademacs-5938d5196d09aff887aa74603c102b1f303a613a.tar.gz
Handle window-height and window-width alist entries in `display-buffer'.
In buffer display functions handle window-height/window-width alist entries. Suggested by Juri Linkov as fix for Bug#1806. * window.el (window--display-buffer): New argument ALIST. Obey window-height and window-width alist entries. (window--try-to-split-window): New argument ALIST. Bind window-combination-limit to t when the window's size shall be changed and window-combination-limit equals `window-size'. (display-buffer-in-atom-window) (display-buffer-in-major-side-window) (display-buffer-in-side-window, display-buffer-same-window) (display-buffer-reuse-window, display-buffer-pop-up-frame) (display-buffer-pop-up-window, display-buffer-below-selected) (display-buffer-at-bottom, display-buffer-in-previous-window) (display-buffer-use-some-window): Adjust all callers of window--display-buffer and window--try-to-split-window. (fit-frame-to-buffer): New option. (fit-window-to-buffer): Can resize frames if fit-frame-to-buffer is non-nil. (display-buffer-in-major-side-window): Evaluate window-height / window-width alist entries. * help.el (temp-buffer-resize-frames) (temp-buffer-resize-regexps): Remove options. (temp-buffer-resize-mode): Adjust doc-string. (resize-temp-buffer-window): Don't consult temp-buffer-resize-regexps. Use fit-frame-to-buffer instead of temp-buffer-resize-frames. * dired.el (dired-mark-pop-up): Call display-buffer-below-selected with a fit-window-to-buffer alist entry. * window.c (Vwindow_combination_limit): New default value. (Qwindow_size): New symbol replacing Qtemp_buffer_resize.
Diffstat (limited to 'lisp/help.el')
-rw-r--r--lisp/help.el70
1 files changed, 22 insertions, 48 deletions
diff --git a/lisp/help.el b/lisp/help.el
index 707c8e3c84f..0df9c607f69 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -981,26 +981,6 @@ function is called, the window to be resized is selected."
:group 'help
:version "24.2")
-(defcustom temp-buffer-resize-frames nil
- "Non-nil means `temp-buffer-resize-mode' can resize frames.
-A frame can be resized if and only if its root window is a live
-window. The height of the root window is subject to the values of
-`temp-buffer-max-height' and `window-min-height'."
- :type 'boolean
- :version "24.2"
- :group 'help)
-
-(defcustom temp-buffer-resize-regexps nil
- "List of regexps that inhibit Temp Buffer Resize mode.
-Any window of a buffer whose name matches one of these regular
-expressions is left alone by Temp Buffer Resize mode."
- :type '(repeat
- :tag "Buffer"
- :value ""
- (regexp :format "%v"))
- :version "24.3"
- :group 'help)
-
(define-minor-mode temp-buffer-resize-mode
"Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode).
With a prefix argument ARG, enable Temp Buffer Resize mode if ARG
@@ -1014,9 +994,8 @@ fit the buffer's contents, but never more than
A window is resized only if it has been specially created for the
buffer. Windows that have shown another buffer before are not
-resized. A window showing a buffer whose name matches any of the
-expressions in `temp-buffer-resize-regexps' is not resized. A
-frame is resized only if `temp-buffer-resize-frames' is non-nil.
+resized. A frame is resized only if `fit-frame-to-buffer' is
+non-nil.
This mode is used by `help', `apropos' and `completion' buffers,
and some others."
@@ -1034,33 +1013,28 @@ WINDOW can be any live window and defaults to the selected one.
Do not make WINDOW higher than `temp-buffer-max-height' nor
smaller than `window-min-height'. Do nothing if WINDOW is not
vertically combined or some of its contents are scrolled out of
-view. Do nothing if the name of WINDOW's buffer matches an
-expression in `temp-buffer-resize-regexps'."
+view."
(setq window (window-normalize-window window t))
(let ((buffer-name (buffer-name (window-buffer window))))
- (unless (catch 'found
- (dolist (regexp temp-buffer-resize-regexps)
- (when (string-match regexp buffer-name)
- (throw 'found t))))
- (let ((height (if (functionp temp-buffer-max-height)
- (with-selected-window window
- (funcall temp-buffer-max-height (window-buffer)))
- temp-buffer-max-height))
- (quit-cadr (cadr (window-parameter window 'quit-restore))))
- (cond
- ;; Don't resize WINDOW if it showed another buffer before.
- ((and (eq quit-cadr 'window)
- (pos-visible-in-window-p (point-min) window)
- (window-combined-p window))
- (fit-window-to-buffer window height))
- ((and temp-buffer-resize-frames
- (eq quit-cadr 'frame)
- (eq window (frame-root-window window)))
- (let ((frame (window-frame window)))
- (fit-frame-to-buffer
- frame (+ (frame-height frame)
- (- (window-total-size window))
- height)))))))))
+ (let ((height (if (functionp temp-buffer-max-height)
+ (with-selected-window window
+ (funcall temp-buffer-max-height (window-buffer)))
+ temp-buffer-max-height))
+ (quit-cadr (cadr (window-parameter window 'quit-restore))))
+ (cond
+ ;; Don't resize WINDOW if it showed another buffer before.
+ ((and (eq quit-cadr 'window)
+ (pos-visible-in-window-p (point-min) window)
+ (window-combined-p window))
+ (fit-window-to-buffer window height))
+ ((and fit-frame-to-buffer
+ (eq quit-cadr 'frame)
+ (eq window (frame-root-window window)))
+ (let ((frame (window-frame window)))
+ (fit-frame-to-buffer
+ frame (+ (frame-height frame)
+ (- (window-total-size window))
+ height))))))))
;;; Help windows.
(defcustom help-window-select 'other