/[emacs]/emacs/lisp/winner.el
ViewVC logotype

Diff of /emacs/lisp/winner.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by rms, Tue Feb 26 16:08:29 2002 UTC revision 1.22.4.1 by miles, Fri Apr 4 06:20:12 2003 UTC
# Line 70  Line 70 
70    
71  (require 'ring)  (require 'ring)
72    
73  (when (fboundp 'defgroup)  (unless (fboundp 'defgroup)
74    (defgroup winner nil    (defmacro defgroup (&rest rest)))
75      "Restoring window configurations."  
76      :group 'windows))  (defgroup winner nil
77      "Restoring window configurations."
78      :group 'windows)
79    
80  (unless (fboundp 'defcustom)  (unless (fboundp 'defcustom)
81    (defmacro defcustom (symbol &optional initvalue docs &rest rest)    (defmacro defcustom (symbol &optional initvalue docs &rest rest)
# Line 126  You may want to include buffer names suc Line 128  You may want to include buffer names suc
128                  while (= a b)                  while (= a b)
129                  finally return (< a b)))))                  finally return (< a b)))))
130    
131  (defun winner-win-data ()  (defun winner-win-data ()
132    ;; Essential properties of the windows in the selected frame.    ;; Essential properties of the windows in the selected frame.
133    (loop for win in (winner-sorted-window-list)    (loop for win in (winner-sorted-window-list)
134          collect (cons (winner-edges win) (window-buffer win))))          collect (cons (winner-edges win) (window-buffer win))))
135            
136  ;; This variable is updated with the current window configuration  ;; This variable is updated with the current window configuration
137  ;; every time it changes.  ;; every time it changes.
138  (defvar winner-currents nil)  (defvar winner-currents nil)
# Line 260  You may want to include buffer names suc Line 262  You may want to include buffer names suc
262       ((window-live-p chosen) (select-window chosen))       ((window-live-p chosen) (select-window chosen))
263       ((window-minibuffer-p (selected-window))       ((window-minibuffer-p (selected-window))
264        (other-window 1)))        (other-window 1)))
265      (when (/= minisize (window-height miniwin))      (when (/= minisize (window-height miniwin))
266        (letf (((selected-window) miniwin) )        (letf (((selected-window) miniwin) )
267          (setf (window-height) minisize)))))          (setf (window-height) minisize)))))
268    
# Line 277  You may want to include buffer names suc Line 279  You may want to include buffer names suc
279    (letf (((current-buffer)))    (letf (((current-buffer)))
280      (loop with alist      (loop with alist
281            for win in (winner-window-list)            for win in (winner-window-list)
282            for entry =            for entry =
283            (or (assq (window-buffer win) alist)            (or (assq (window-buffer win) alist)
284                (car (push (list (set-buffer (window-buffer win))                (car (push (list (set-buffer (window-buffer win))
285                                 (cons (mark t) (winner-active-region)))                                 (cons (mark t) (winner-active-region)))
# Line 333  You may want to include buffer names suc Line 335  You may want to include buffer names suc
335    
336        ;; Restore marks        ;; Restore marks
337        (letf (((current-buffer)))        (letf (((current-buffer)))
338          (loop for buf in buffers          (loop for buf in buffers
339                for entry = (cadr (assq buf winner-point-alist))                for entry = (cadr (assq buf winner-point-alist))
340                do (progn (set-buffer buf)                do (progn (set-buffer buf)
341                          (set-mark (car entry))                          (set-mark (car entry))
# Line 382  With arg, turn Winner mode on if and onl Line 384  With arg, turn Winner mode on if and onl
384                  (not winner-mode))))                  (not winner-mode))))
385      (cond      (cond
386       ;; Turn mode on       ;; Turn mode on
387       (on-p       (on-p
388        (setq winner-mode t)        (setq winner-mode t)
389        (cond        (cond
390         ((winner-hook-installed-p)         ((winner-hook-installed-p)
# Line 433  In other words, \"undo\" changes in wind Line 435  In other words, \"undo\" changes in wind
435          (message "Winner undo (%d / %d)"          (message "Winner undo (%d / %d)"
436                   winner-undo-counter                   winner-undo-counter
437                   (1- (ring-length winner-pending-undo-ring)))))))                   (1- (ring-length winner-pending-undo-ring)))))))
438    
439            
440    
441   (defun winner-undo-this ()             ; The heart of winner undo.   (defun winner-undo-this ()             ; The heart of winner undo.
442    (loop    (loop
443     (cond     (cond
444      ((>= winner-undo-counter (ring-length winner-pending-undo-ring))      ((>= winner-undo-counter (ring-length winner-pending-undo-ring))
445       (message "No further window configuration undo information")       (message "No further window configuration undo information")
446       (return nil))       (return nil))
447    
448      ((and                               ; If possible configuration      ((and                               ; If possible configuration
449        (winner-set (ring-ref winner-pending-undo-ring        (winner-set (ring-ref winner-pending-undo-ring
450                              winner-undo-counter))                              winner-undo-counter))
# Line 453  In other words, \"undo\" changes in wind Line 455  In other words, \"undo\" changes in wind
455       (return t))                        ; .. then everything is fine.       (return t))                        ; .. then everything is fine.
456      (t ;; Otherwise, discharge it (and try the next one).      (t ;; Otherwise, discharge it (and try the next one).
457       (ring-remove winner-pending-undo-ring winner-undo-counter)))))       (ring-remove winner-pending-undo-ring winner-undo-counter)))))
458    
459    
460  (defun winner-redo ()                   ; If you change your mind.  (defun winner-redo ()                   ; If you change your mind.
461    "Restore a more recent window configuration saved by Winner mode."    "Restore a more recent window configuration saved by Winner mode."

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.22.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26