summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2019-03-11 09:57:23 +0100
committerMartin Rudalics <rudalics@gmx.at>2019-03-11 09:57:23 +0100
commit95373b69b34f9756d2f05b19798b763d22aa5f0a (patch)
treeffd55c71f1cccf34fc90aeb56dfeb4e78afb1915 /lisp
parent27466c62fdc977e8d3b23c5ae4f529a64ac7374f (diff)
downloademacs-95373b69b34f9756d2f05b19798b763d22aa5f0a.tar.gz
Rewrite minibuffer window resizing code
* src/frame.c (resize_mini_frames): New variable. * src/window.c (resize_mini_window_apply): New function. (grow_mini_window, shrink_mini_window): Remove PIXELWISE argument. Call resize_mini_window_apply to apply changes. (Fresize_mini_window_internal): Call resize_mini_window_apply to apply changes. (Qwindow__resize_mini_frame): New symbol. * src/window.h (grow_mini_window, shrink_mini_window): Adjust external declarations. * src/xdisp.c (resize_mini_window): For minibuffer-only frames call 'window--resize-mini-frame' if resize_mini_frames is non-nil. Offload parts of logic to grow_mini_window and shrink_mini_window which are now called without the PIXELWISE argument. (Vresize_mini_windows): Mention 'resize-mini-frames' in doc-string. * lisp/cus-start.el (resize-mini-frames): Add customization support. * lisp/window.el (window--resize-mini-window): Simplify code. (window--resize-mini-frame): New function. * doc/lispref/minibuf.texi (Minibuffer Windows): Describe new option 'resize-mini-frames'. * etc/NEWS: Mention new option 'resize-mini-frames'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/cus-start.el8
-rw-r--r--lisp/window.el8
2 files changed, 14 insertions, 2 deletions
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 44ce2929d66..baa05d0a89a 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -314,7 +314,13 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
(other :tag "hidden by keypress" 1))
"22.1")
(make-pointer-invisible mouse boolean "23.2")
- (menu-bar-mode frames boolean nil
+ (resize-mini-frames
+ frames (choice
+ (const :tag "Never" nil)
+ (const :tag "Fit frame to buffer" t)
+ (function :tag "User-defined function"))
+ "27.1")
+ (menu-bar-mode frames boolean nil
;; FIXME?
;; :initialize custom-initialize-default
:set custom-set-minor-mode)
diff --git a/lisp/window.el b/lisp/window.el
index a8b65657a49..b769be06337 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2753,7 +2753,7 @@ as small) as possible, but don't signal an error."
;; Sanitize DELTA.
(cond
((<= (+ height delta) 0)
- (setq delta (- (frame-char-height (window-frame window)) height)))
+ (setq delta (- (frame-char-height frame) height)))
((> delta min-delta)
(setq delta min-delta)))
@@ -3381,6 +3381,12 @@ routines."
pixel-delta
(/ pixel-delta (frame-char-height frame)))))
+(defun window--resize-mini-frame (frame)
+ "Resize minibuffer-only frame FRAME."
+ (if (functionp resize-mini-frames)
+ (funcall resize-mini-frames frame)
+ (fit-frame-to-buffer frame)))
+
(defun window--sanitize-window-sizes (horizontal)
"Assert that all windows on selected frame are large enough.
If necessary and possible, make sure that every window on frame