aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/window.el75
2 files changed, 47 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 74d66809d55..a267c726986 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12012-11-16 Martin Rudalics <rudalics@gmx.at>
2
3 * window.el (enlarge-window, shrink-window): Don't mention return
4 value in doc-string (Bug#12896).
5 (window--display-buffer): Don't resize frames - it won't work
6 with all window managers and defeat pop-up-frame-alist.
7 (display-buffer-alist): In doc-string explain that CONDITION can
8 be a function and which arguments are passed to it (Bug#12854).
9 (display-buffer-assq-regexp): New argument ACTION. Handle lambda
10 expressions (Bug#12854).
11 (display-buffer): Pass ACTION argument to
12 display-buffer-assq-regexp.
13
12012-11-16 Glenn Morris <rgm@gnu.org> 142012-11-16 Glenn Morris <rgm@gnu.org>
2 15
3 * window.el (fit-frame-to-buffer-bottom-margin) 16 * window.el (fit-frame-to-buffer-bottom-margin)
diff --git a/lisp/window.el b/lisp/window.el
index c9ea8351e8c..9ac3a4ecda0 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2571,8 +2571,7 @@ move it as far as possible in the desired direction."
2571Interactively, if no argument is given, make the selected window 2571Interactively, if no argument is given, make the selected window
2572one line taller. If optional argument HORIZONTAL is non-nil, 2572one line taller. If optional argument HORIZONTAL is non-nil,
2573make selected window wider by DELTA columns. If DELTA is 2573make selected window wider by DELTA columns. If DELTA is
2574negative, shrink selected window by -DELTA lines or columns. 2574negative, shrink selected window by -DELTA lines or columns."
2575Return nil."
2576 (interactive "p") 2575 (interactive "p")
2577 (let ((minibuffer-window (minibuffer-window))) 2576 (let ((minibuffer-window (minibuffer-window)))
2578 (cond 2577 (cond
@@ -2605,8 +2604,7 @@ Interactively, if no argument is given, make the selected window
2605one line smaller. If optional argument HORIZONTAL is non-nil, 2604one line smaller. If optional argument HORIZONTAL is non-nil,
2606make selected window narrower by DELTA columns. If DELTA is 2605make selected window narrower by DELTA columns. If DELTA is
2607negative, enlarge selected window by -DELTA lines or columns. 2606negative, enlarge selected window by -DELTA lines or columns.
2608Also see the `window-min-height' variable. 2607Also see the `window-min-height' variable."
2609Return nil."
2610 (interactive "p") 2608 (interactive "p")
2611 (let ((minibuffer-window (minibuffer-window))) 2609 (let ((minibuffer-window (minibuffer-window)))
2612 (cond 2610 (cond
@@ -5176,11 +5174,12 @@ is higher than WINDOW."
5176 (error nil)))) 5174 (error nil))))
5177 5175
5178(defun window--display-buffer (buffer window type &optional alist dedicated) 5176(defun window--display-buffer (buffer window type &optional alist dedicated)
5179 "Display BUFFER in WINDOW and make its frame visible. 5177 "Display BUFFER in WINDOW.
5180TYPE must be one of the symbols `reuse', `window' or `frame' and 5178TYPE must be one of the symbols `reuse', `window' or `frame' and
5181is passed unaltered to `display-buffer-record-window'. Set 5179is passed unaltered to `display-buffer-record-window'. ALIST is
5182`window-dedicated-p' to DEDICATED if non-nil. Return WINDOW if 5180the alist argument of `display-buffer'. Set `window-dedicated-p'
5183BUFFER and WINDOW are live." 5181to DEDICATED if non-nil. Return WINDOW if BUFFER and WINDOW are
5182live."
5184 (when (and (buffer-live-p buffer) (window-live-p window)) 5183 (when (and (buffer-live-p buffer) (window-live-p window))
5185 (display-buffer-record-window type window buffer) 5184 (display-buffer-record-window type window buffer)
5186 (unless (eq buffer (window-buffer window)) 5185 (unless (eq buffer (window-buffer window))
@@ -5193,10 +5192,10 @@ BUFFER and WINDOW are live."
5193 (let ((parameter (window-parameter window 'quit-restore)) 5192 (let ((parameter (window-parameter window 'quit-restore))
5194 (height (cdr (assq 'window-height alist))) 5193 (height (cdr (assq 'window-height alist)))
5195 (width (cdr (assq 'window-width alist)))) 5194 (width (cdr (assq 'window-width alist))))
5196 (when (or (memq type '(window frame)) 5195 (when (or (eq type 'window)
5197 (and (eq (car parameter) 'same) 5196 (and (eq (car parameter) 'same)
5198 (memq (nth 1 parameter) '(window frame)))) 5197 (eq (nth 1 parameter) 'window)))
5199 ;; Adjust height of new window or frame. 5198 ;; Adjust height of window if asked for.
5200 (cond 5199 (cond
5201 ((not height)) 5200 ((not height))
5202 ((numberp height) 5201 ((numberp height)
@@ -5207,19 +5206,12 @@ BUFFER and WINDOW are live."
5207 (* (window-total-size (frame-root-window window)) 5206 (* (window-total-size (frame-root-window window))
5208 height)))) 5207 height))))
5209 (delta (- new-height (window-total-size window)))) 5208 (delta (- new-height (window-total-size window))))
5210 (cond 5209 (when (and (window--resizable-p window delta nil 'safe)
5211 ((and (window--resizable-p window delta nil 'safe) 5210 (window-combined-p window))
5212 (window-combined-p window)) 5211 (window-resize window delta nil 'safe))))
5213 (window-resize window delta nil 'safe))
5214 ((or (eq type 'frame)
5215 (and (eq (car parameter) 'same)
5216 (eq (nth 1 parameter) 'frame)))
5217 (set-frame-height
5218 (window-frame window)
5219 (+ (frame-height (window-frame window)) delta))))))
5220 ((functionp height) 5212 ((functionp height)
5221 (ignore-errors (funcall height window)))) 5213 (ignore-errors (funcall height window))))
5222 ;; Adjust width of a window or frame. 5214 ;; Adjust width of window if asked for.
5223 (cond 5215 (cond
5224 ((not width)) 5216 ((not width))
5225 ((numberp width) 5217 ((numberp width)
@@ -5230,18 +5222,12 @@ BUFFER and WINDOW are live."
5230 (* (window-total-size (frame-root-window window) t) 5222 (* (window-total-size (frame-root-window window) t)
5231 width)))) 5223 width))))
5232 (delta (- new-width (window-total-size window t)))) 5224 (delta (- new-width (window-total-size window t))))
5233 (cond 5225 (when (and (window--resizable-p window delta t 'safe)
5234 ((and (window--resizable-p window delta t 'safe) 5226 (window-combined-p window t))
5235 (window-combined-p window t)) 5227 (window-resize window delta t 'safe))))
5236 (window-resize window delta t 'safe))
5237 ((or (eq type 'frame)
5238 (and (eq (car parameter) 'same)
5239 (eq (nth 1 parameter) 'frame)))
5240 (set-frame-width
5241 (window-frame window)
5242 (+ (frame-width (window-frame window)) delta))))))
5243 ((functionp width) 5228 ((functionp width)
5244 (ignore-errors (funcall width window)))))) 5229 (ignore-errors (funcall width window))))))
5230
5245 window)) 5231 window))
5246 5232
5247(defun window--maybe-raise-frame (frame) 5233(defun window--maybe-raise-frame (frame)
@@ -5301,13 +5287,19 @@ See `display-buffer' for details.")
5301 "Alist of conditional actions for `display-buffer'. 5287 "Alist of conditional actions for `display-buffer'.
5302This is a list of elements (CONDITION . ACTION), where: 5288This is a list of elements (CONDITION . ACTION), where:
5303 5289
5304 CONDITION is either a regexp matching buffer names, or a function 5290 CONDITION is either a regexp matching buffer names, or a
5305 that takes a buffer and returns a boolean. 5291 function that takes two arguments - a buffer name and the
5292 ACTION argument of `display-buffer' - and returns a boolean.
5306 5293
5307 ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a 5294 ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a
5308 function or a list of functions. Each such function should 5295 function or a list of functions. Each such function should
5309 accept two arguments: a buffer to display and an alist of the 5296 accept two arguments: a buffer to display and an alist of the
5310 same form as ALIST. See `display-buffer' for details." 5297 same form as ALIST. See `display-buffer' for details.
5298
5299`display-buffer' scans this alist until it either finds a
5300matching regular expression or the function specified by a
5301condition returns non-nil. In any of these cases, it adds the
5302associated action to the list of actions it will try."
5311 :type `(alist :key-type 5303 :type `(alist :key-type
5312 (choice :tag "Condition" 5304 (choice :tag "Condition"
5313 regexp 5305 regexp
@@ -5341,15 +5333,16 @@ specified, e.g. by the user options `display-buffer-alist' or
5341`display-buffer-base-action'. See `display-buffer'.") 5333`display-buffer-base-action'. See `display-buffer'.")
5342(put 'display-buffer-fallback-action 'risky-local-variable t) 5334(put 'display-buffer-fallback-action 'risky-local-variable t)
5343 5335
5344(defun display-buffer-assq-regexp (buffer-name alist) 5336(defun display-buffer-assq-regexp (buffer-name alist action)
5345 "Retrieve ALIST entry corresponding to BUFFER-NAME." 5337 "Retrieve ALIST entry corresponding to BUFFER-NAME.
5338ACTION is the action argument passed to `display-buffer'."
5346 (catch 'match 5339 (catch 'match
5347 (dolist (entry alist) 5340 (dolist (entry alist)
5348 (let ((key (car entry))) 5341 (let ((key (car entry)))
5349 (when (or (and (stringp key) 5342 (when (or (and (stringp key)
5350 (string-match-p key buffer-name)) 5343 (string-match-p key buffer-name))
5351 (and (symbolp key) (functionp key) 5344 (and (functionp key)
5352 (funcall key buffer-name alist))) 5345 (funcall key buffer-name action)))
5353 (throw 'match (cdr entry))))))) 5346 (throw 'match (cdr entry)))))))
5354 5347
5355(defvar display-buffer--same-window-action 5348(defvar display-buffer--same-window-action
@@ -5459,8 +5452,8 @@ argument, ACTION is t."
5459 (funcall display-buffer-function buffer inhibit-same-window) 5452 (funcall display-buffer-function buffer inhibit-same-window)
5460 ;; Otherwise, use the defined actions. 5453 ;; Otherwise, use the defined actions.
5461 (let* ((user-action 5454 (let* ((user-action
5462 (display-buffer-assq-regexp (buffer-name buffer) 5455 (display-buffer-assq-regexp
5463 display-buffer-alist)) 5456 (buffer-name buffer) display-buffer-alist action))
5464 (special-action (display-buffer--special-action buffer)) 5457 (special-action (display-buffer--special-action buffer))
5465 ;; Extra actions from the arguments to this function: 5458 ;; Extra actions from the arguments to this function:
5466 (extra-action 5459 (extra-action