;; Return the buffer.
buffer)))
-(defun temp-buffer-window-show (&optional buffer action)
+(defun temp-buffer-window-show (buffer &optional action)
"Show temporary buffer BUFFER in a window.
Return the window showing BUFFER. Pass ACTION as action argument
to `display-buffer'."
(let ((buffer (make-symbol "buffer"))
(window (make-symbol "window"))
(value (make-symbol "value")))
- (macroexp-let2 nil vbuffer-or-name buffer-or-name
- (macroexp-let2 nil vaction action
- (macroexp-let2 nil vquit-function quit-function
- `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
- (standard-output ,buffer)
- ,window ,value)
- (setq ,value (progn ,@body))
- (with-current-buffer ,buffer
- (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
-
- (if (functionp ,vquit-function)
- (funcall ,vquit-function ,window ,value)
- ,value)))))))
+ (macroexp-let2* nil ((vbuffer-or-name buffer-or-name)
+ (vaction action)
+ (vquit-function quit-function))
+ `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
+ (standard-output ,buffer)
+ ,window ,value)
+ (setq ,value (progn ,@body))
+ (with-current-buffer ,buffer
+ (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
+
+ (if (functionp ,vquit-function)
+ (funcall ,vquit-function ,window ,value)
+ ,value)))))
(defmacro with-current-buffer-window (buffer-or-name action quit-function &rest body)
"Evaluate BODY with a buffer BUFFER-OR-NAME current and show that buffer.
(let ((buffer (make-symbol "buffer"))
(window (make-symbol "window"))
(value (make-symbol "value")))
- (macroexp-let2 nil vbuffer-or-name buffer-or-name
- (macroexp-let2 nil vaction action
- (macroexp-let2 nil vquit-function quit-function
- `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
- (standard-output ,buffer)
- ,window ,value)
- (with-current-buffer ,buffer
- (setq ,value (progn ,@body))
- (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
-
- (if (functionp ,vquit-function)
- (funcall ,vquit-function ,window ,value)
- ,value)))))))
+ (macroexp-let2* nil ((vbuffer-or-name buffer-or-name)
+ (vaction action)
+ (vquit-function quit-function))
+ `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
+ (standard-output ,buffer)
+ ,window ,value)
+ (with-current-buffer ,buffer
+ (setq ,value (progn ,@body))
+ (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
+
+ (if (functionp ,vquit-function)
+ (funcall ,vquit-function ,window ,value)
+ ,value)))))
(defmacro with-displayed-buffer-window (buffer-or-name action quit-function &rest body)
"Show a buffer BUFFER-OR-NAME and evaluate BODY in that buffer.
(let ((buffer (make-symbol "buffer"))
(window (make-symbol "window"))
(value (make-symbol "value")))
- (macroexp-let2 nil vbuffer-or-name buffer-or-name
- (macroexp-let2 nil vaction action
- (macroexp-let2 nil vquit-function quit-function
- `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
- (standard-output ,buffer)
- ,window ,value)
- (with-current-buffer ,buffer
- (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
-
- (let ((inhibit-read-only t)
- (inhibit-modification-hooks t))
- (setq ,value (progn ,@body)))
-
- (set-window-point ,window (point-min))
-
- (when (functionp (cdr (assq 'window-height (cdr ,vaction))))
- (ignore-errors
- (funcall (cdr (assq 'window-height (cdr ,vaction))) ,window)))
+ (macroexp-let2* nil ((vbuffer-or-name buffer-or-name)
+ (vaction action)
+ (vquit-function quit-function))
+ `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
+ (standard-output ,buffer)
+ ,window ,value)
+ (with-current-buffer ,buffer
+ (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
+
+ (let ((inhibit-read-only t)
+ (inhibit-modification-hooks t))
+ (setq ,value (progn ,@body)))
+
+ (set-window-point ,window (point-min))
+
+ (when (functionp (cdr (assq 'window-height (cdr ,vaction))))
+ (ignore-errors
+ (funcall (cdr (assq 'window-height (cdr ,vaction))) ,window)))
- (if (functionp ,vquit-function)
- (funcall ,vquit-function ,window ,value)
- ,value)))))))
+ (if (functionp ,vquit-function)
+ (funcall ,vquit-function ,window ,value)
+ ,value)))))
;; The following two functions are like `window-next-sibling' and
;; `window-prev-sibling' but the WINDOW argument is _not_ optional (so
(defalias 'window-height 'window-total-height)
(defalias 'window-width 'window-body-width)
-;; Eventually the following two should work pixelwise.
-
-;; See discussion in bug#4543.
(defun window-full-height-p (&optional window)
"Return t if WINDOW is as high as its containing frame.
More precisely, return t if and only if the total height of
frame. WINDOW must be a valid window and defaults to the
selected one."
(setq window (window-normalize-window window))
- (= (window-pixel-height window)
- (window-pixel-height (frame-root-window window))))
+ (if (window-minibuffer-p window)
+ (eq window (frame-root-window (window-frame window)))
+ (= (window-pixel-height window)
+ (window-pixel-height (frame-root-window window)))))
(defun window-full-width-p (&optional window)
"Return t if WINDOW is as wide as its containing frame.
(window-body-height window pixelwise)))
(defun window-current-scroll-bars (&optional window)
- "Return the current scroll bar settings for WINDOW.
+ "Return the current scroll bar types for WINDOW.
WINDOW must be a live window and defaults to the selected one.
The return value is a cons cell (VERTICAL . HORIZONTAL) where
VERTICAL specifies the current location of the vertical scroll
-bars (`left', `right', or nil), and HORIZONTAL specifies the
-current location of the horizontal scroll bars (`top', `bottom',
-or nil).
+bar (`left', `right' or nil), and HORIZONTAL specifies the
+current location of the horizontal scroll bar (`bottom' or nil).
Unlike `window-scroll-bars', this function reports the scroll bar
type actually used, once frame defaults and `scroll-bar-mode' are
taken into account."
(setq window (window-normalize-window window t))
- (let ((vert (nth 2 (window-scroll-bars window)))
- (hor nil))
- (when (or (eq vert t) (eq hor t))
- (let ((fcsb (frame-current-scroll-bars (window-frame window))))
- (if (eq vert t)
- (setq vert (car fcsb)))
- (if (eq hor t)
- (setq hor (cdr fcsb)))))
- (cons vert hor)))
+ (let ((vertical (nth 2 (window-scroll-bars window)))
+ (horizontal (nth 5 (window-scroll-bars window)))
+ (inherited (frame-current-scroll-bars (window-frame window))))
+ (when (eq vertical t)
+ (setq vertical (car inherited)))
+ (when (eq horizontal t)
+ (setq horizontal (cdr inherited)))
+ (cons vertical (and horizontal 'bottom))))
(defun walk-windows (fun &optional minibuf all-frames)
"Cycle through all live windows, calling FUN for each one.
(height
(+ (cdr value)
(window-bottom-divider-width)
- (nth 3 (window-scroll-bars)))))
+ (window-scroll-bar-height))))
;; Don't change height or width when the window's size is fixed
;; in either direction or ONLY forbids it.
(cond
;; height. Its width remains fixed.
(setq height (+ (cdr (window-text-pixel-size
nil nil t nil (frame-pixel-height) t))
- (nth 3 (window-scroll-bars window))
+ (window-scroll-bar-height window)
(window-bottom-divider-width)))
;; Round height.
(unless pixelwise
(defun handle-select-window (event)
"Handle select-window events."
- (interactive "e")
+ (interactive "^e")
(let ((window (posn-window (event-start event))))
(unless (or (not (window-live-p window))
;; Don't switch if we're currently in the minibuffer.