/[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.28 by lute, Mon Jul 4 23:09:00 2005 UTC revision 1.29 by lektu, Wed Jul 13 11:03:18 2005 UTC
# Line 78  Line 78 
78    
79  ;;;###autoload  ;;;###autoload
80  (defcustom winner-mode nil  (defcustom winner-mode nil
81    "Toggle winner-mode.    "Toggle Winner mode.
82  Setting this variable directly does not take effect;  Setting this variable directly does not take effect;
83  use either \\[customize] or the function `winner-mode'."  use either \\[customize] or the function `winner-mode'."
84    :set #'(lambda (symbol value) (funcall symbol (or value 0)))    :set #'(lambda (symbol value) (funcall symbol (or value 0)))
# Line 98  use either \\[customize] or the function Line 98  use either \\[customize] or the function
98    :group 'winner)    :group 'winner)
99    
100  (defcustom winner-boring-buffers '("*Completions*")  (defcustom winner-boring-buffers '("*Completions*")
101    "`winner-undo' will not restore windows displaying any of these \    "`winner-undo' will not restore windows displaying any of these buffers.
 buffers.  
102  You may want to include buffer names such as *Help*, *Apropos*,  You may want to include buffer names such as *Help*, *Apropos*,
103  *Buffer List*, *info* and *Compile-Log*."  *Buffer List*, *info* and *Compile-Log*."
104    :type '(repeat string)    :type '(repeat string)
# Line 108  You may want to include buffer names suc Line 107  You may want to include buffer names suc
107    
108    
109    
110   ;;;; Saving old configurations (internal variables and subroutines)  
111    ;;;; Saving old configurations (internal variables and subroutines)
112    
113    
114  ;;; Current configuration  ;;; Current configuration
# Line 162  You may want to include buffer names suc Line 162  You may want to include buffer names suc
162  ;; Find the right ring.  If it does not exist, create one.  ;; Find the right ring.  If it does not exist, create one.
163  (defsubst winner-ring (frame)  (defsubst winner-ring (frame)
164    (or (cdr (assq frame winner-ring-alist))    (or (cdr (assq frame winner-ring-alist))
165        (progn        (let ((ring (make-ring winner-ring-size)))
166          (let ((ring (make-ring winner-ring-size)))          (ring-insert ring (winner-configuration frame))
167            (ring-insert ring (winner-configuration frame))          (push (cons frame ring) winner-ring-alist)
168            (push (cons frame ring) winner-ring-alist)          ring)))
           ring))))  
169    
170   ;; If the same command is called several times in a row,  
171    ;; If the same command is called several times in a row,
172  ;; we only save one window configuration.  ;; we only save one window configuration.
173  (defvar winner-last-command nil)  (defvar winner-last-command nil)
174    
# Line 176  You may want to include buffer names suc Line 176  You may want to include buffer names suc
176  (defvar winner-last-frames nil)  (defvar winner-last-frames nil)
177    
178    
179  (defun winner-equal (a b)  (defsubst winner-equal (a b)
180    "Check whether two Winner configurations (as produced by    "Check whether two Winner configurations (as produced by
181  `winner-conf') are equal."  `winner-conf') are equal."
182    (equal (cdr a) (cdr b)))    (equal (cdr a) (cdr b)))
# Line 240  You may want to include buffer names suc Line 240  You may want to include buffer names suc
240    
241    
242    
243   ;;;; Restoring configurations  
244    ;;;; Restoring configurations
245    
246  ;; Works almost as `set-window-configuration',  ;; Works almost as `set-window-configuration',
247  ;; but does not change the contents or the size of the minibuffer,  ;; but does not change the contents or the size of the minibuffer,
# Line 301  You may want to include buffer names suc Line 302  You may want to include buffer names suc
302                    winner-point-alist)                    winner-point-alist)
303              (point)))))))              (point)))))))
304    
305   ;; Make sure point does not end up in the minibuffer and delete  
306    ;; Make sure point does not end up in the minibuffer and delete
307  ;; windows displaying dead or boring buffers  ;; windows displaying dead or boring buffers
308  ;; (c.f. `winner-boring-buffers').  Return nil iff all the windows  ;; (c.f. `winner-boring-buffers').  Return nil iff all the windows
309  ;; should be deleted.  Preserve correct points and marks.  ;; should be deleted.  Preserve correct points and marks.
# Line 410  With arg, turn Winner mode on if and onl Line 412  With arg, turn Winner mode on if and onl
412  (defvar winner-undo-frame nil)  (defvar winner-undo-frame nil)
413    
414  (defvar winner-pending-undo-ring nil  (defvar winner-pending-undo-ring nil
415    "The ring currently used by winner undo.")    "The ring currently used by `winner-undo'.")
416  (defvar winner-undo-counter nil)  (defvar winner-undo-counter nil)
417  (defvar winner-undone-data  nil) ; There confs have been passed.  (defvar winner-undone-data  nil) ; There confs have been passed.
418    
# Line 437  In other words, \"undo\" changes in wind Line 439  In other words, \"undo\" changes in wind
439    
440    
441    
442   (defun winner-undo-this ()             ; The heart of winner undo.  
443    (defun winner-undo-this ()              ; The heart of winner undo.
444    (loop    (loop
445     (cond     (cond
446      ((>= winner-undo-counter (ring-length winner-pending-undo-ring))      ((>= winner-undo-counter (ring-length winner-pending-undo-ring))
# Line 467  In other words, \"undo\" changes in wind Line 470  In other words, \"undo\" changes in wind
470         (ring-ref winner-pending-undo-ring 0)))         (ring-ref winner-pending-undo-ring 0)))
471      (unless (eq (selected-window) (minibuffer-window))      (unless (eq (selected-window) (minibuffer-window))
472        (message "Winner undid undo")))        (message "Winner undid undo")))
473     (t (error "Previous command was not a winner-undo"))))     (t (error "Previous command was not a `winner-undo'"))))
474    
475  ;;; To be evaluated when the package is loaded:  ;;; To be evaluated when the package is loaded:
476    

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

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