diff options
| author | Stefan Monnier | 2004-11-14 06:31:12 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-11-14 06:31:12 +0000 |
| commit | 6babdce9e8750afafdccefe1bae1cd5cf2d84990 (patch) | |
| tree | dffe9ff20860f6925224665020dd854668303e46 | |
| parent | 9de133097713c6c4ecd5a0138d2aae1b93069fd7 (diff) | |
| download | emacs-6babdce9e8750afafdccefe1bae1cd5cf2d84990.tar.gz emacs-6babdce9e8750afafdccefe1bae1cd5cf2d84990.zip | |
(winner-active-region, winner-edges, winner-window-list): Define at toplevel.
(winner-mode-map): Move init inside declaration.
| -rw-r--r-- | lisp/winner.el | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/lisp/winner.el b/lisp/winner.el index e5b48889156..603eb80d9f0 100644 --- a/lisp/winner.el +++ b/lisp/winner.el | |||
| @@ -44,29 +44,24 @@ | |||
| 44 | (eval-when-compile | 44 | (eval-when-compile |
| 45 | (require 'cl)) | 45 | (require 'cl)) |
| 46 | 46 | ||
| 47 | (eval-when-compile | 47 | |
| 48 | (cond | 48 | (defmacro winner-active-region () |
| 49 | ((eq (aref (emacs-version) 0) ?X) | 49 | (if (fboundp 'region-active-p) |
| 50 | (defmacro winner-active-region () | 50 | '(region-active-p) |
| 51 | '(region-active-p)) | 51 | 'mark-active)) |
| 52 | (defsetf winner-active-region () (store) | 52 | |
| 53 | (defsetf winner-active-region () (store) | ||
| 54 | (if (fboundp 'zmacs-activate-region) | ||
| 53 | `(if ,store (zmacs-activate-region) | 55 | `(if ,store (zmacs-activate-region) |
| 54 | (zmacs-deactivate-region)))) | 56 | (zmacs-deactivate-region)) |
| 55 | (t (defmacro winner-active-region () | 57 | `(setq mark-active ,store))) |
| 56 | 'mark-active) | ||
| 57 | (defsetf winner-active-region () (store) | ||
| 58 | `(setq mark-active ,store)))) ) | ||
| 59 | 58 | ||
| 60 | (eval-and-compile | 59 | (defalias 'winner-edges |
| 61 | (cond | 60 | (if (featurep 'xemacs) 'window-pixel-edges 'window-edges)) |
| 62 | ((eq (aref (emacs-version) 0) ?X) | 61 | (defalias 'winner-window-list |
| 63 | (defalias 'winner-edges 'window-pixel-edges) | 62 | (if (featurep 'xemacs) |
| 64 | (defsubst winner-window-list () | 63 | (lambda () (delq (minibuffer-window) (window-list nil 0))) |
| 65 | (remq (minibuffer-window) | 64 | (lambda () (window-list nil 0)))) |
| 66 | (window-list nil 0)))) | ||
| 67 | (t (defalias 'winner-edges 'window-edges) | ||
| 68 | (defsubst winner-window-list () | ||
| 69 | (window-list nil 0)))) ) | ||
| 70 | 65 | ||
| 71 | (require 'ring) | 66 | (require 'ring) |
| 72 | 67 | ||
| @@ -86,8 +81,7 @@ | |||
| 86 | "Toggle winner-mode. | 81 | "Toggle winner-mode. |
| 87 | Setting this variable directly does not take effect; | 82 | Setting this variable directly does not take effect; |
| 88 | use either \\[customize] or the function `winner-mode'." | 83 | use either \\[customize] or the function `winner-mode'." |
| 89 | :set #'(lambda (symbol value) | 84 | :set #'(lambda (symbol value) (funcall symbol (or value 0))) |
| 90 | (winner-mode (or value 0))) | ||
| 91 | :initialize 'custom-initialize-default | 85 | :initialize 'custom-initialize-default |
| 92 | :type 'boolean | 86 | :type 'boolean |
| 93 | :group 'winner | 87 | :group 'winner |
| @@ -363,7 +357,12 @@ You may want to include buffer names such as *Help*, *Apropos*, | |||
| 363 | :type 'hook | 357 | :type 'hook |
| 364 | :group 'winner) | 358 | :group 'winner) |
| 365 | 359 | ||
| 366 | (defvar winner-mode-map nil "Keymap for Winner mode.") | 360 | (defvar winner-mode-map |
| 361 | (let ((map (make-sparse-keymap))) | ||
| 362 | (define-key map [(control c) left] 'winner-undo) | ||
| 363 | (define-key map [(control c) right] 'winner-redo) | ||
| 364 | map) | ||
| 365 | "Keymap for Winner mode.") | ||
| 367 | 366 | ||
| 368 | ;; Check if `window-configuration-change-hook' is working. | 367 | ;; Check if `window-configuration-change-hook' is working. |
| 369 | (defun winner-hook-installed-p () | 368 | (defun winner-hook-installed-p () |
| @@ -389,7 +388,7 @@ With arg, turn Winner mode on if and only if arg is positive." | |||
| 389 | (cond | 388 | (cond |
| 390 | ((winner-hook-installed-p) | 389 | ((winner-hook-installed-p) |
| 391 | (add-hook 'window-configuration-change-hook 'winner-change-fun) | 390 | (add-hook 'window-configuration-change-hook 'winner-change-fun) |
| 392 | (add-hook 'post-command-hook 'winner-save-old-configurations)) | 391 | (add-hook 'post-command-hook 'winner-save-old-configurations)) |
| 393 | (t (add-hook 'post-command-hook 'winner-save-conditionally))) | 392 | (t (add-hook 'post-command-hook 'winner-save-conditionally))) |
| 394 | (add-hook 'minibuffer-setup-hook 'winner-save-unconditionally) | 393 | (add-hook 'minibuffer-setup-hook 'winner-save-unconditionally) |
| 395 | (setq winner-modified-list (frame-list)) | 394 | (setq winner-modified-list (frame-list)) |
| @@ -472,17 +471,11 @@ In other words, \"undo\" changes in window configuration." | |||
| 472 | 471 | ||
| 473 | ;;; To be evaluated when the package is loaded: | 472 | ;;; To be evaluated when the package is loaded: |
| 474 | 473 | ||
| 475 | (unless winner-mode-map | ||
| 476 | (setq winner-mode-map (make-sparse-keymap)) | ||
| 477 | (define-key winner-mode-map [(control c) left] 'winner-undo) | ||
| 478 | (define-key winner-mode-map [(control c) right] 'winner-redo)) | ||
| 479 | |||
| 480 | (unless (or (assq 'winner-mode minor-mode-map-alist) | 474 | (unless (or (assq 'winner-mode minor-mode-map-alist) |
| 481 | winner-dont-bind-my-keys) | 475 | winner-dont-bind-my-keys) |
| 482 | (push (cons 'winner-mode winner-mode-map) | 476 | (push (cons 'winner-mode winner-mode-map) |
| 483 | minor-mode-map-alist)) | 477 | minor-mode-map-alist)) |
| 484 | 478 | ||
| 485 | (provide 'winner) | 479 | (provide 'winner) |
| 486 | 480 | ;; arch-tag: 686d1c1b-010e-42ca-a192-b5685112418f | |
| 487 | ;;; arch-tag: 686d1c1b-010e-42ca-a192-b5685112418f | ||
| 488 | ;;; winner.el ends here | 481 | ;;; winner.el ends here |