comparison lisp/window-xemacs.el @ 903:4a27df428c73

[xemacs-hg @ 2002-07-06 05:48:14 by andyp] sync with 21.4
author andyp
date Sat, 06 Jul 2002 05:48:22 +0000
parents 576fb035e263
children a123f88fa975
comparison
equal deleted inserted replaced
902:2fd2239ea63a 903:4a27df428c73
214 (with-current-buffer buffer 214 (with-current-buffer buffer
215 (setq __buffer-dedicated-frame frame)))) 215 (setq __buffer-dedicated-frame frame))))
216 216
217 (defvar display-buffer-function nil 217 (defvar display-buffer-function nil
218 "If non-nil, function to call to handle `display-buffer'. 218 "If non-nil, function to call to handle `display-buffer'.
219 It will receive three args: the same as those to `display-buffer'.") 219 It will receive four args: the same as those to `display-buffer'.")
220 220
221 (defvar pre-display-buffer-function nil 221 (defvar pre-display-buffer-function nil
222 "If non-nil, function that will be called from `display-buffer' 222 "If non-nil, function that will be called from `display-buffer'
223 as the first action. It will receive three args: the same as those 223 as the first action. It will receive four args: the same as those
224 to `display-buffer'. 224 to `display-buffer'.
225 This function may be used to select an appropriate frame for the buffer, 225 This function may be used to select an appropriate frame for the buffer,
226 for example. See also the variable `display-buffer-function', which may 226 for example. See also the variable `display-buffer-function', which may
227 be used to completely replace the `display-buffer' function. 227 be used to completely replace the `display-buffer' function.
228 If the return value of this function is non-nil, it should be a frame, 228 If the return value of this function is non-nil, it should be a frame,
350 window) 350 window)
351 351
352 ;; Can you believe that all of this crap was formerly in C? 352 ;; Can you believe that all of this crap was formerly in C?
353 ;; Praise Jesus that it's not there any more. 353 ;; Praise Jesus that it's not there any more.
354 354
355 (defun display-buffer (buffer &optional not-this-window-p override-frame) 355 (defun display-buffer (buffer &optional not-this-window-p override-frame
356 shrink-to-fit)
356 "Make BUFFER appear in some window on the current frame, but don't select it. 357 "Make BUFFER appear in some window on the current frame, but don't select it.
357 BUFFER can be a buffer or a buffer name. 358 BUFFER can be a buffer or a buffer name.
358 If BUFFER is shown already in some window in the current frame, 359 If BUFFER is shown already in some window in the current frame,
359 just uses that one, unless the window is the selected window and 360 just uses that one, unless the window is the selected window and
360 NOT-THIS-WINDOW-P is non-nil (interactively, with prefix arg). 361 NOT-THIS-WINDOW-P is non-nil (interactively, with prefix arg).
362 If BUFFER has a dedicated frame, display on that frame instead of 363 If BUFFER has a dedicated frame, display on that frame instead of
363 the current frame, unless OVERRIDE-FRAME is non-nil. 364 the current frame, unless OVERRIDE-FRAME is non-nil.
364 365
365 If OVERRIDE-FRAME is non-nil, display on that frame instead of 366 If OVERRIDE-FRAME is non-nil, display on that frame instead of
366 the current frame (or the dedicated frame). 367 the current frame (or the dedicated frame).
368
369 If SHRINK-TO-FIT is non-nil and splitting the window is appropriate, give
370 the new buffer less than half the space if it is small enough to fit.
367 371
368 If `pop-up-windows' is non-nil, always use the 372 If `pop-up-windows' is non-nil, always use the
369 current frame and create a new window regardless of whether the 373 current frame and create a new window regardless of whether the
370 buffer has a dedicated frame, and regardless of whether 374 buffer has a dedicated frame, and regardless of whether
371 OVERRIDE-FRAME was specified. 375 OVERRIDE-FRAME was specified.
388 392
389 (setq explicit-frame 393 (setq explicit-frame
390 (if pre-display-buffer-function 394 (if pre-display-buffer-function
391 (funcall pre-display-buffer-function buffer 395 (funcall pre-display-buffer-function buffer
392 not-this-window-p 396 not-this-window-p
393 override-frame))) 397 override-frame
398 shrink-to-fit)))
394 399
395 ;; Give the user the ability to completely reimplement 400 ;; Give the user the ability to completely reimplement
396 ;; this function via the `display-buffer-function'. 401 ;; this function via the `display-buffer-function'.
397 (if display-buffer-function 402 (if display-buffer-function
398 (throw 'done 403 (throw 'done
399 (funcall display-buffer-function buffer 404 (funcall display-buffer-function buffer
400 not-this-window-p 405 not-this-window-p
401 override-frame))) 406 override-frame
407 shrink-to-fit)))
402 408
403 ;; If the buffer has a dedicated frame, that takes 409 ;; If the buffer has a dedicated frame, that takes
404 ;; precedence over the current frame, and over what the 410 ;; precedence over the current frame, and over what the
405 ;; pre-display-buffer-function did. 411 ;; pre-display-buffer-function did.
406 (let ((dedi (buffer-dedicated-frame buffer))) 412 (let ((dedi (buffer-dedicated-frame buffer)))
613 (window-pixel-height window))) 619 (window-pixel-height window)))
614 (enlarge-window (- (/ (+ (window-height other) 620 (enlarge-window (- (/ (+ (window-height other)
615 (window-height window)) 621 (window-height window))
616 2) 622 2)
617 (window-height upper)) 623 (window-height upper))
618 nil upper))))) 624 nil upper))
625 (if shrink-to-fit
626 (shrink-window-if-larger-than-buffer window)))))
619 627
620 (setq window (get-lru-window target-frame))) 628 (setq window (get-lru-window target-frame)))
621 629
622 ;; Bring the window's previous buffer to the top of the MRU chain. 630 ;; Bring the window's previous buffer to the top of the MRU chain.
623 (if (window-buffer window) 631 (if (window-buffer window)