comparison lisp/winner.el @ 49597:e88404e8f2cf

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 12:29:42 +0000
parents ee08f1e3d269
children 695cf19ef79e d7ddb3e565de
comparison
equal deleted inserted replaced
49596:b06535145619 49597:e88404e8f2cf
126 (loop for a in (winner-edges x) 126 (loop for a in (winner-edges x)
127 for b in (winner-edges y) 127 for b in (winner-edges y)
128 while (= a b) 128 while (= a b)
129 finally return (< a b))))) 129 finally return (< a b)))))
130 130
131 (defun winner-win-data () 131 (defun winner-win-data ()
132 ;; Essential properties of the windows in the selected frame. 132 ;; Essential properties of the windows in the selected frame.
133 (loop for win in (winner-sorted-window-list) 133 (loop for win in (winner-sorted-window-list)
134 collect (cons (winner-edges win) (window-buffer win)))) 134 collect (cons (winner-edges win) (window-buffer win))))
135 135
136 ;; This variable is updated with the current window configuration 136 ;; This variable is updated with the current window configuration
137 ;; every time it changes. 137 ;; every time it changes.
138 (defvar winner-currents nil) 138 (defvar winner-currents nil)
139 139
140 ;; The current configuration (+ the buffers involved). 140 ;; The current configuration (+ the buffers involved).
260 (set-window-configuration winconf)) 260 (set-window-configuration winconf))
261 (cond 261 (cond
262 ((window-live-p chosen) (select-window chosen)) 262 ((window-live-p chosen) (select-window chosen))
263 ((window-minibuffer-p (selected-window)) 263 ((window-minibuffer-p (selected-window))
264 (other-window 1))) 264 (other-window 1)))
265 (when (/= minisize (window-height miniwin)) 265 (when (/= minisize (window-height miniwin))
266 (letf (((selected-window) miniwin) ) 266 (letf (((selected-window) miniwin) )
267 (setf (window-height) minisize))))) 267 (setf (window-height) minisize)))))
268 268
269 269
270 270
277 277
278 (defun winner-make-point-alist () 278 (defun winner-make-point-alist ()
279 (letf (((current-buffer))) 279 (letf (((current-buffer)))
280 (loop with alist 280 (loop with alist
281 for win in (winner-window-list) 281 for win in (winner-window-list)
282 for entry = 282 for entry =
283 (or (assq (window-buffer win) alist) 283 (or (assq (window-buffer win) alist)
284 (car (push (list (set-buffer (window-buffer win)) 284 (car (push (list (set-buffer (window-buffer win))
285 (cons (mark t) (winner-active-region))) 285 (cons (mark t) (winner-active-region)))
286 alist))) 286 alist)))
287 do (push (cons win (window-point win)) 287 do (push (cons win (window-point win))
333 winner-boring-buffers))) 333 winner-boring-buffers)))
334 (push win xwins))) ; delete this window 334 (push win xwins))) ; delete this window
335 335
336 ;; Restore marks 336 ;; Restore marks
337 (letf (((current-buffer))) 337 (letf (((current-buffer)))
338 (loop for buf in buffers 338 (loop for buf in buffers
339 for entry = (cadr (assq buf winner-point-alist)) 339 for entry = (cadr (assq buf winner-point-alist))
340 do (progn (set-buffer buf) 340 do (progn (set-buffer buf)
341 (set-mark (car entry)) 341 (set-mark (car entry))
342 (setf (winner-active-region) (cdr entry))))) 342 (setf (winner-active-region) (cdr entry)))))
343 ;; Delete windows, whose buffers are dead or boring. 343 ;; Delete windows, whose buffers are dead or boring.
382 (interactive "P") 382 (interactive "P")
383 (let ((on-p (if arg (> (prefix-numeric-value arg) 0) 383 (let ((on-p (if arg (> (prefix-numeric-value arg) 0)
384 (not winner-mode)))) 384 (not winner-mode))))
385 (cond 385 (cond
386 ;; Turn mode on 386 ;; Turn mode on
387 (on-p 387 (on-p
388 (setq winner-mode t) 388 (setq winner-mode t)
389 (cond 389 (cond
390 ((winner-hook-installed-p) 390 ((winner-hook-installed-p)
391 (add-hook 'window-configuration-change-hook 'winner-change-fun) 391 (add-hook 'window-configuration-change-hook 'winner-change-fun)
392 (add-hook 'post-command-hook 'winner-save-old-configurations)) 392 (add-hook 'post-command-hook 'winner-save-old-configurations))
433 (when (and (winner-undo-this) 433 (when (and (winner-undo-this)
434 (not (window-minibuffer-p (selected-window)))) 434 (not (window-minibuffer-p (selected-window))))
435 (message "Winner undo (%d / %d)" 435 (message "Winner undo (%d / %d)"
436 winner-undo-counter 436 winner-undo-counter
437 (1- (ring-length winner-pending-undo-ring))))))) 437 (1- (ring-length winner-pending-undo-ring)))))))
438 438
439 439
440 440
441 (defun winner-undo-this () ; The heart of winner undo. 441 (defun winner-undo-this () ; The heart of winner undo.
442 (loop 442 (loop
443 (cond 443 (cond
444 ((>= winner-undo-counter (ring-length winner-pending-undo-ring)) 444 ((>= winner-undo-counter (ring-length winner-pending-undo-ring))
445 (message "No further window configuration undo information") 445 (message "No further window configuration undo information")
446 (return nil)) 446 (return nil))
447 447
448 ((and ; If possible configuration 448 ((and ; If possible configuration
449 (winner-set (ring-ref winner-pending-undo-ring 449 (winner-set (ring-ref winner-pending-undo-ring
450 winner-undo-counter)) 450 winner-undo-counter))
451 ; .. and new configuration 451 ; .. and new configuration
452 (let ((data (winner-win-data))) 452 (let ((data (winner-win-data)))
453 (and (not (member data winner-undone-data)) 453 (and (not (member data winner-undone-data))
454 (push data winner-undone-data)))) 454 (push data winner-undone-data))))
455 (return t)) ; .. then everything is fine. 455 (return t)) ; .. then everything is fine.
456 (t ;; Otherwise, discharge it (and try the next one). 456 (t ;; Otherwise, discharge it (and try the next one).
457 (ring-remove winner-pending-undo-ring winner-undo-counter))))) 457 (ring-remove winner-pending-undo-ring winner-undo-counter)))))
458 458
459 459
460 (defun winner-redo () ; If you change your mind. 460 (defun winner-redo () ; If you change your mind.
461 "Restore a more recent window configuration saved by Winner mode." 461 "Restore a more recent window configuration saved by Winner mode."
462 (interactive) 462 (interactive)
463 (cond 463 (cond