Mercurial > hg > xemacs-beta
comparison lisp/window-xemacs.el @ 4674:e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
author | Mike Sperber <sperber@deinprogramm.de> |
---|---|
date | Mon, 03 Aug 2009 10:30:47 +0200 |
parents | 11d71be1c232 |
children | f00192e1cd49 308d34e9f07d |
comparison
equal
deleted
inserted
replaced
4673:11d71be1c232 | 4674:e95ddfd6a409 |
---|---|
308 (unwind-protect | 308 (unwind-protect |
309 (progn ,@body) | 309 (progn ,@body) |
310 (setq ,mapping (set-window-configuration/mapping ,window-config))) | 310 (setq ,mapping (set-window-configuration/mapping ,window-config))) |
311 ,mapping))) | 311 ,mapping))) |
312 | 312 |
313 (defun set-window-configuration (configuration) | 313 (defun set-window-configuration (configuration &optional set-frame-size-p) |
314 "Set the configuration of windows and buffers as specified by CONFIGURATION. | |
315 CONFIGURATION must be a value previously returned | |
316 by `current-window-configuration'." | |
317 (set-window-configuration/mapping configuration) | |
318 nil) ; make sure nobody relies on mapping return value | |
319 | |
320 (defun set-window-configuration/mapping (configuration) | |
321 "Set the configuration of windows and buffers as specified by CONFIGURATION. | 314 "Set the configuration of windows and buffers as specified by CONFIGURATION. |
322 CONFIGURATION must be a value previously returned | 315 CONFIGURATION must be a value previously returned |
323 by `current-window-configuration'. | 316 by `current-window-configuration'. |
317 If SET-FRAME-SIZE-P is true, the frame size is also restored. | |
318 " | |
319 (set-window-configuration/mapping configuration set-frame-size-p) | |
320 nil) ; make sure nobody relies on mapping return value | |
321 | |
322 (defun set-window-configuration/mapping (configuration &optional set-frame-size-p) | |
323 "Set the configuration of windows and buffers as specified by CONFIGURATION. | |
324 CONFIGURATION must be a value previously returned | |
325 by `current-window-configuration'. | |
326 If SET-FRAME-SIZE-P is true, the frame size is also restored. | |
324 Return alist mapping old windows to new windows. | 327 Return alist mapping old windows to new windows. |
325 This alist maps the originally captured windows to the windows that correspond | 328 This alist maps the originally captured windows to the windows that correspond |
326 to them in the restored configuration. It does not include entries for | 329 to them in the restored configuration. It does not include entries for |
327 windows that have not changed identity." | 330 windows that have not changed identity." |
328 (let ((frame (window-configuration-frame configuration))) | 331 (let ((frame (window-configuration-frame configuration))) |
329 (if (and (frame-live-p frame) | 332 (if (and (frame-live-p frame) |
330 (not (window-configuration-equal configuration | 333 (not (window-configuration-equal configuration |
331 (current-window-configuration)))) | 334 (current-window-configuration)))) |
332 (really-set-window-configuration frame configuration)))) | 335 (really-set-window-configuration frame configuration set-frame-size-p)))) |
333 | 336 |
334 (defun really-set-window-configuration (frame configuration) | 337 (defun really-set-window-configuration (frame configuration set-frame-size-p) |
335 "Set the window configuration CONFIGURATION on live frame FRAME. | 338 "Set the window configuration CONFIGURATION on live frame FRAME. |
339 If SET-FRAME-SIZE-P is true, the frame size is also restored. | |
336 Return alist mapping old windows to new windows." | 340 Return alist mapping old windows to new windows." |
337 ;; avoid potential temporary problems | 341 ;; avoid potential temporary problems |
338 (setq window-min-width 0) | 342 (setq window-min-width 0) |
339 (setq window-min-height 0) | 343 (setq window-min-height 0) |
340 (setq minibuffer-scroll-window nil) | 344 (setq minibuffer-scroll-window nil) |
341 | 345 |
342 (frame-reduce-to-one-window frame) | 346 (frame-reduce-to-one-window frame) |
343 (set-window-configuration-frame-size configuration) | 347 (if set-frame-size-p |
348 (set-window-configuration-frame-size configuration)) | |
344 | 349 |
345 ;; avoid setting these if they're already up-to-date | 350 ;; avoid setting these if they're already up-to-date |
346 ;; This also avoids potential inaccuracies in these settings --Mike | 351 ;; This also avoids potential inaccuracies in these settings --Mike |
347 (when window-configuration-includes-position | 352 (when window-configuration-includes-position |
348 (let ((left (window-configuration-frame-left configuration)) | 353 (let ((left (window-configuration-frame-left configuration)) |
377 | 382 |
378 (let ((buffer (window-configuration-current-buffer configuration))) | 383 (let ((buffer (window-configuration-current-buffer configuration))) |
379 (if (buffer-live-p buffer) | 384 (if (buffer-live-p buffer) |
380 (set-buffer buffer) | 385 (set-buffer buffer) |
381 (set-buffer (car (buffer-list))))) | 386 (set-buffer (car (buffer-list))))) |
387 ; this resets the window configuration so that the frame is filled | |
388 (if (not set-frame-size-p) | |
389 (set-frame-pixel-size frame (frame-pixel-width frame) (frame-pixel-height frame))) | |
382 (car mapping))) | 390 (car mapping))) |
383 | 391 |
384 (defun set-window-configuration-frame-size (configuration) | 392 (defun set-window-configuration-frame-size (configuration) |
385 "Restore the frame size of a window configuration." | 393 "Restore the frame size of a window configuration." |
386 (set-frame-pixel-size | 394 (set-frame-pixel-size |