Mercurial > hg > xemacs-beta
comparison lisp/window-xemacs.el @ 3646:b6287dbce5f0
[xemacs-hg @ 2006-10-31 09:16:27 by michaels]
2006-10-28 Nix <nix@esperi.org.uk>
* window-xemacs.el (window-configuration-includes-position): New.
* window-xemacs.el (window-configuration-equal): Use it: window
configurations with distinct positions are equal by default.
* window-xemacs.el (really-set-window-configuration): Do not
restore window positions unless requested.
author | michaels |
---|---|
date | Tue, 31 Oct 2006 09:16:29 +0000 |
parents | 469ce4fa0ade |
children | db22824aa020 |
comparison
equal
deleted
inserted
replaced
3645:bb49f3386667 | 3646:b6287dbce5f0 |
---|---|
105 (set-window-buffer window (get-buffer-create buffer))) | 105 (set-window-buffer window (get-buffer-create buffer))) |
106 (set-window-dedicated-p window (not (null buffer)))) | 106 (set-window-dedicated-p window (not (null buffer)))) |
107 | 107 |
108 ;; Window configurations | 108 ;; Window configurations |
109 | 109 |
110 (defcustom window-configuration-includes-position nil | |
111 "*Whether restoring window configurations will restore positions too. | |
112 If nil, only the size of windows will be restored. | |
113 | |
114 Note that setting this value to t may have counterintuitive consequences, | |
115 if a window manager employing virtual desktops is in use." | |
116 :type 'boolean | |
117 :group 'windows) | |
118 | |
110 (defstruct saved-window | 119 (defstruct saved-window |
111 currentp minibufferp minibuffer-scrollp | 120 currentp minibufferp minibuffer-scrollp |
112 buffer mark-marker | 121 buffer mark-marker |
113 start-marker | 122 start-marker |
114 point-marker | 123 point-marker |
126 min-width min-height | 135 min-width min-height |
127 saved-root-window) | 136 saved-root-window) |
128 | 137 |
129 (defun window-configuration-equal (conf-1 conf-2) | 138 (defun window-configuration-equal (conf-1 conf-2) |
130 "Returns a boolean indicating whether the two given configurations | 139 "Returns a boolean indicating whether the two given configurations |
131 are identical." | 140 are identical. |
141 | |
142 Window configurations containing windows with different window | |
143 positions are not identical iff `window-configuration-includes-position' | |
144 is t." | |
132 (or (eq conf-1 conf-2) | 145 (or (eq conf-1 conf-2) |
133 (and (eq (window-configuration-frame conf-1) | 146 (and (eq (window-configuration-frame conf-1) |
134 (window-configuration-frame conf-2)) | 147 (window-configuration-frame conf-2)) |
135 (= (window-configuration-frame-pixel-width conf-1) | 148 (= (window-configuration-frame-pixel-width conf-1) |
136 (window-configuration-frame-pixel-width conf-2)) | 149 (window-configuration-frame-pixel-width conf-2)) |
137 (= (window-configuration-frame-pixel-height conf-1) | 150 (= (window-configuration-frame-pixel-height conf-1) |
138 (window-configuration-frame-pixel-height conf-2)) | 151 (window-configuration-frame-pixel-height conf-2)) |
139 (equal (window-configuration-frame-top conf-1) | 152 (if window-configuration-includes-position |
140 (window-configuration-frame-top conf-2)) | 153 (and (equal (window-configuration-frame-top conf-1) |
141 (equal (window-configuration-frame-left conf-1) | 154 (window-configuration-frame-top conf-2)) |
142 (window-configuration-frame-left conf-2)) | 155 (equal (window-configuration-frame-left conf-1) |
156 (window-configuration-frame-left conf-2))) | |
157 t) | |
143 (eq (window-configuration-current-buffer conf-1) | 158 (eq (window-configuration-current-buffer conf-1) |
144 (window-configuration-current-buffer conf-2)) | 159 (window-configuration-current-buffer conf-2)) |
145 (saved-window-equal (window-configuration-saved-root-window conf-1) | 160 (saved-window-equal (window-configuration-saved-root-window conf-1) |
146 (window-configuration-saved-root-window conf-2))))) | 161 (window-configuration-saved-root-window conf-2))))) |
147 | 162 |
292 (frame-reduce-to-one-window frame) | 307 (frame-reduce-to-one-window frame) |
293 (set-window-configuration-frame-size configuration) | 308 (set-window-configuration-frame-size configuration) |
294 | 309 |
295 ; avoid setting these if they're already up-to-date | 310 ; avoid setting these if they're already up-to-date |
296 ; This also avoids potential inaccuracies in these settings --Mike | 311 ; This also avoids potential inaccuracies in these settings --Mike |
297 (let ((left (window-configuration-frame-left configuration)) | 312 (when window-configuration-includes-position |
298 (top (window-configuration-frame-top configuration))) | 313 (let ((left (window-configuration-frame-left configuration)) |
299 (if (not (equal left (frame-property frame 'left))) | 314 (top (window-configuration-frame-top configuration))) |
300 (set-frame-property frame 'left left)) | 315 (if (not (equal left (frame-property frame 'left))) |
301 (if (not (equal top (frame-property frame 'top))) | 316 (set-frame-property frame 'left left)) |
302 (set-frame-property frame 'top top))) | 317 (if (not (equal top (frame-property frame 'top))) |
318 (set-frame-property frame 'top top)))) | |
303 | 319 |
304 ;; these may have changed because of the delete | 320 ;; these may have changed because of the delete |
305 (let ((root-window (frame-root-window frame))) | 321 (let ((root-window (frame-root-window frame))) |
306 (enlarge-window-pixels | 322 (enlarge-window-pixels |
307 (- (window-configuration-minibuffer-pixel-height configuration) | 323 (- (window-configuration-minibuffer-pixel-height configuration) |