Mercurial > hg > xemacs-beta
comparison lisp/frame.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 | 943eaba38521 |
children | da8cdcec6dff |
comparison
equal
deleted
inserted
replaced
902:2fd2239ea63a | 903:4a27df428c73 |
---|---|
1025 | 1025 |
1026 | 1026 |
1027 ;; The pre-display-buffer-function is called for effect, so this needs to | 1027 ;; The pre-display-buffer-function is called for effect, so this needs to |
1028 ;; actually select the frame it wants. Fdisplay_buffer() takes notice of | 1028 ;; actually select the frame it wants. Fdisplay_buffer() takes notice of |
1029 ;; changes to the selected frame. | 1029 ;; changes to the selected frame. |
1030 (defun get-frame-for-buffer (buffer &optional not-this-window-p on-frame) | 1030 (defun get-frame-for-buffer (buffer &optional not-this-window-p on-frame |
1031 shrink-to-fit) | |
1031 "Select and return a frame in which to display BUFFER. | 1032 "Select and return a frame in which to display BUFFER. |
1032 Normally, the buffer will simply be displayed in the selected frame. | 1033 Normally, the buffer will simply be displayed in the selected frame. |
1033 But if the symbol naming the major-mode of the buffer has a 'frame-name | 1034 But if the symbol naming the major-mode of the buffer has a 'frame-name |
1034 property (which should be a symbol), then the buffer will be displayed in | 1035 property (which should be a symbol), then the buffer will be displayed in |
1035 a frame of that name. If there is no frame of that name, then one is | 1036 a frame of that name. If there is no frame of that name, then one is |
1104 "For use as the value of `temp-buffer-show-function': | 1105 "For use as the value of `temp-buffer-show-function': |
1105 always displays the buffer in the selected frame, regardless of the behavior | 1106 always displays the buffer in the selected frame, regardless of the behavior |
1106 that would otherwise be introduced by the `pre-display-buffer-function', which | 1107 that would otherwise be introduced by the `pre-display-buffer-function', which |
1107 is normally set to `get-frame-for-buffer' (which see)." | 1108 is normally set to `get-frame-for-buffer' (which see)." |
1108 (let ((pre-display-buffer-function nil)) ; turn it off, whatever it is | 1109 (let ((pre-display-buffer-function nil)) ; turn it off, whatever it is |
1109 (let ((window (display-buffer buffer))) | 1110 (let ((window (display-buffer buffer nil nil temp-buffer-shrink-to-fit))) |
1110 (if (not (eq (last-nonminibuf-frame) (window-frame window))) | 1111 (if (not (eq (last-nonminibuf-frame) (window-frame window))) |
1111 ;; only the pre-display-buffer-function should ever do this. | 1112 ;; only the pre-display-buffer-function should ever do this. |
1112 (error "display-buffer switched frames on its own!!")) | 1113 (error "display-buffer switched frames on its own!!")) |
1113 (setq minibuffer-scroll-window window) | 1114 (setq minibuffer-scroll-window window) |
1114 (set-window-start window 1) ; obeys narrowing | 1115 (set-window-start window 1) ; obeys narrowing |
1115 (set-window-point window 1) | 1116 (set-window-point window 1) |
1116 (when temp-buffer-shrink-to-fit | |
1117 (let* ((temp-window-size (round (* temp-buffer-max-height | |
1118 (frame-height (window-frame window))))) | |
1119 (size (window-displayed-height window))) | |
1120 (when (< size temp-window-size) | |
1121 (enlarge-window (- temp-window-size size) nil window))) | |
1122 (shrink-window-if-larger-than-buffer window)) | |
1123 nil))) | 1117 nil))) |
1124 | 1118 |
1125 (setq pre-display-buffer-function 'get-frame-for-buffer) | 1119 (setq pre-display-buffer-function 'get-frame-for-buffer) |
1126 (setq temp-buffer-show-function 'show-temp-buffer-in-current-frame) | 1120 (setq temp-buffer-show-function 'show-temp-buffer-in-current-frame) |
1127 | 1121 |