(inhibit-modification-hooks t))
(funcall (cdr (assq 'body-function alist)) window)))
- (let* ((quit-restore (window-parameter window 'quit-restore))
+ (let* ((frame (window-frame window))
+ (quit-restore (window-parameter window 'quit-restore))
(window-height (assq 'window-height alist))
(height (cdr window-height))
(window-width (assq 'window-width alist))
(when window-size
(setq resize-temp-buffer-window-inhibit t)))
((consp size)
- (let ((width (car size))
- (height (cdr size))
- (frame (window-frame window)))
- (when (and (numberp width) (numberp height))
- ;; Modifying the parameters of a newly created frame might
- ;; not work everywhere, but then `temp-buffer-resize-mode'
- ;; will certainly fail in a similar fashion.
+ ;; Modifying the parameters of a newly created frame might
+ ;; not work everywhere, but then `temp-buffer-resize-mode'
+ ;; will certainly fail in a similar fashion.
+ (if (eq (car size) 'body-chars)
+ (let ((width (+ (frame-text-width frame)
+ (* (frame-char-width frame) (cadr size))
+ (- (window-body-width window t))))
+ (height (+ (frame-text-height frame)
+ (* (frame-char-height frame) (cddr size))
+ (- (window-body-height window t)))))
+ (modify-frame-parameters
+ frame `((height . (text-pixels . ,height))
+ (width . (text-pixels . ,width)))))
+ (let ((width (- (+ (frame-width frame) (car size))
+ (window-total-width window)))
+ (height (- (+ (frame-height frame) (cdr size))
+ (window-total-height window))))
(modify-frame-parameters
- frame `((height . ,(+ (frame-height frame)
- (- height (window-total-height window))))
- (width . ,(+ (frame-width frame)
- (- width (window-total-width window))))))))
+ frame `((height . ,height) (width . ,width)))))
(setq resize-temp-buffer-window-inhibit t))
- ((functionp size)
+ ((functionp size)
(ignore-errors (funcall size window))
(setq resize-temp-buffer-window-inhibit t))))
((or (eq type 'window)
(and (eq (car quit-restore) 'same)
(eq (nth 1 quit-restore) 'window)))
;; A window that never showed another buffer but BUFFER ever
- ;; since it was created on an existing frame.
- ;;
- ;; Adjust width and/or height of window if asked for.
+ ;; since it was created on an existing frame. Adjust its width
+ ;; and/or height if asked for.
(cond
((not height)
(when window-height
(window-combined-p window))
(window-resize window delta nil 'safe)))
(setq resize-temp-buffer-window-inhibit 'vertical))
- ((functionp height)
+ ((and (consp height) (eq (car height) 'body-lines))
+ (let* ((delta (- (* (frame-char-height frame) (cdr height))
+ (window-body-height window t))))
+ (and (window--resizable-p window delta nil 'safe nil nil nil t)
+ (window-combined-p window)
+ (window-resize window delta nil 'safe t)))
+ (setq resize-temp-buffer-window-inhibit 'vertical))
+ ((functionp height)
(ignore-errors (funcall height window))
(setq resize-temp-buffer-window-inhibit 'vertical)))
;; Adjust width of window if asked for.
(window-combined-p window t))
(window-resize window delta t 'safe)))
(setq resize-temp-buffer-window-inhibit 'horizontal))
+ ((and (consp width) (eq (car width) 'body-columns))
+ (let* ((delta (- (* (frame-char-width frame) (cdr width))
+ (window-body-width window t))))
+ (and (window--resizable-p window delta t 'safe nil nil nil t)
+ (window-combined-p window t)
+ (window-resize window delta t 'safe t)))
+ (setq resize-temp-buffer-window-inhibit 'horizontal))
((functionp width)
(ignore-errors (funcall width window))
(setq resize-temp-buffer-window-inhibit 'horizontal)))
Action alist entries are:
`inhibit-same-window' -- A non-nil value prevents the same
window from being used for display.
-`inhibit-switch-frame' -- A non-nil value prevents any frame used
- for showing the buffer from being raised or selected. Note
- that a window manager may still raise a new frame and give it
- focus, effectively overriding the value specified here.
-`reusable-frames' -- The value specifies the set of frames to
+ `inhibit-switch-frame' -- A non-nil value prevents any frame
+ used for showing the buffer from being raised or selected.
+ Note that a window manager may still raise a new frame and
+ give it focus, effectively overriding the value specified
+ here.
+ `reusable-frames' -- The value specifies the set of frames to
search for a window that already displays the buffer.
Possible values are nil (the selected frame), t (any live
frame), visible (any visible frame), 0 (any visible or
frame parameters to give a new frame, if one is created.
`window-height' -- The value specifies the desired height of the
window chosen and is either an integer (the total height of
- the window), a floating point number (the fraction of its
- total height with respect to the total height of the frame's
- root window) or a function to be called with one argument -
- the chosen window. The function is supposed to adjust the
- height of the window; its return value is ignored. Suitable
- functions are `shrink-window-if-larger-than-buffer' and
- `fit-window-to-buffer'.
+ the window specified in frame lines), a floating point
+ number (the fraction of its total height with respect to the
+ total height of the frame's root window), a cons cell whose
+ car is 'body-lines' and whose cdr is an integer that
+ specifies the height of the window's body in frame lines, or
+ a function to be called with one argument - the chosen
+ window. That function is supposed to adjust the height of
+ the window. Suitable functions are `fit-window-to-buffer'
+ and `shrink-window-if-larger-than-buffer'.
`window-width' -- The value specifies the desired width of the
window chosen and is either an integer (the total width of
- the window), a floating point number (the fraction of its
- total width with respect to the width of the frame's root
- window) or a function to be called with one argument - the
- chosen window. The function is supposed to adjust the width
- of the window; its return value is ignored.
+ the window specified in frame lines), a floating point
+ number (the fraction of its total width with respect to the
+ width of the frame's root window), a cons cell whose car is
+ 'body-columns' and whose cdr is an integer that specifies the
+ width of the window's body in frame columns, or a function to
+ be called with one argument - the chosen window. That
+ function is supposed to adjust the width of the window.
`window-size' -- This entry is only useful for windows appearing
alone on their frame and specifies the desired size of that
window either as a cons of integers (the total width and
- height of the window on that frame), or a function to be
- called with one argument - the chosen window. The function
- is supposed to adjust the size of the frame; its return value
- is ignored.
-`preserve-size' -- The value should be either (t . nil) to
+ height of the window on that frame), a cons cell whose car is
+ 'body-chars' and whose cdr is a cons of integers (the desired
+ width and height of the window's body in columns and lines of
+ its frame), or a function to be called with one argument -
+ the chosen window. That function is supposed to adjust the
+ size of the frame.
+ `preserve-size' -- The value should be either (t . nil) to
preserve the width of the chosen window, (nil . t) to
preserve its height or (t . t) to preserve its height and
width in future changes of the window configuration.
`window-parameters' -- The value specifies an alist of window
- parameters to give the chosen window.
- `allow-no-window' -- A non-nil value means that `display-buffer'
- may not display the buffer and return nil immediately.
- `body-function' -- A function called with one argument - the
- displayed window. It is called after the buffer is
- displayed, and before `window-height', `window-width'
- and `preserve-size' are applied. The function is supposed
- to fill the window body with some contents that might depend
- on dimensions of the displayed window.
-
-The entries `window-height', `window-width' and `preserve-size'
-are applied only when the window used for displaying the buffer
-never showed another buffer before.
+ parameters to give the chosen window. `allow-no-window' -- A
+ non-nil value means that `display-buffer' may not display the
+ buffer and return nil immediately. `body-function' -- A
+ function called with one argument - the displayed window. It
+ is called after the buffer is displayed, and before
+ `window-height', `window-width' and `preserve-size' are
+ applied. The function is supposed to fill the window body
+ with some contents that might depend on dimensions of the
+ displayed window.
+
+The entries `window-height', `window-width', `window-size' and
+`preserve-size' are applied only when the window used for
+displaying the buffer never showed another buffer before.
The ACTION argument can also have a non-nil and non-list value.
This means to display the buffer in a window other than the