44 |
(eval-when-compile |
(eval-when-compile |
45 |
(require 'cl)) |
(require 'cl)) |
46 |
|
|
47 |
(eval-when-compile |
|
48 |
(cond |
(defmacro winner-active-region () |
49 |
((eq (aref (emacs-version) 0) ?X) |
(if (fboundp 'region-active-p) |
50 |
(defmacro winner-active-region () |
'(region-active-p) |
51 |
'(region-active-p)) |
'mark-active)) |
52 |
(defsetf winner-active-region () (store) |
|
53 |
|
(defsetf winner-active-region () (store) |
54 |
|
(if (fboundp 'zmacs-activate-region) |
55 |
`(if ,store (zmacs-activate-region) |
`(if ,store (zmacs-activate-region) |
56 |
(zmacs-deactivate-region)))) |
(zmacs-deactivate-region)) |
57 |
(t (defmacro winner-active-region () |
`(setq mark-active ,store))) |
|
'mark-active) |
|
|
(defsetf winner-active-region () (store) |
|
|
`(setq mark-active ,store)))) ) |
|
58 |
|
|
59 |
(eval-and-compile |
(defalias 'winner-edges |
60 |
(cond |
(if (featurep 'xemacs) 'window-pixel-edges 'window-edges)) |
61 |
((eq (aref (emacs-version) 0) ?X) |
(defalias 'winner-window-list |
62 |
(defalias 'winner-edges 'window-pixel-edges) |
(if (featurep 'xemacs) |
63 |
(defsubst winner-window-list () |
(lambda () (delq (minibuffer-window) (window-list nil 0))) |
64 |
(remq (minibuffer-window) |
(lambda () (window-list nil 0)))) |
|
(window-list nil 0)))) |
|
|
(t (defalias 'winner-edges 'window-edges) |
|
|
(defsubst winner-window-list () |
|
|
(window-list nil 0)))) ) |
|
65 |
|
|
66 |
(require 'ring) |
(require 'ring) |
67 |
|
|
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) |
:set #'(lambda (symbol value) (funcall symbol (or value 0))) |
|
(winner-mode (or value 0))) |
|
85 |
:initialize 'custom-initialize-default |
:initialize 'custom-initialize-default |
86 |
:type 'boolean |
:type 'boolean |
87 |
:group 'winner |
:group 'winner |
357 |
:type 'hook |
:type 'hook |
358 |
:group 'winner) |
:group 'winner) |
359 |
|
|
360 |
(defvar winner-mode-map nil "Keymap for Winner mode.") |
(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.") |
366 |
|
|
367 |
;; Check if `window-configuration-change-hook' is working. |
;; Check if `window-configuration-change-hook' is working. |
368 |
(defun winner-hook-installed-p () |
(defun winner-hook-installed-p () |
388 |
(cond |
(cond |
389 |
((winner-hook-installed-p) |
((winner-hook-installed-p) |
390 |
(add-hook 'window-configuration-change-hook 'winner-change-fun) |
(add-hook 'window-configuration-change-hook 'winner-change-fun) |
391 |
(add-hook 'post-command-hook 'winner-save-old-configurations)) |
(add-hook 'post-command-hook 'winner-save-old-configurations)) |
392 |
(t (add-hook 'post-command-hook 'winner-save-conditionally))) |
(t (add-hook 'post-command-hook 'winner-save-conditionally))) |
393 |
(add-hook 'minibuffer-setup-hook 'winner-save-unconditionally) |
(add-hook 'minibuffer-setup-hook 'winner-save-unconditionally) |
394 |
(setq winner-modified-list (frame-list)) |
(setq winner-modified-list (frame-list)) |
471 |
|
|
472 |
;;; To be evaluated when the package is loaded: |
;;; To be evaluated when the package is loaded: |
473 |
|
|
|
(unless winner-mode-map |
|
|
(setq winner-mode-map (make-sparse-keymap)) |
|
|
(define-key winner-mode-map [(control c) left] 'winner-undo) |
|
|
(define-key winner-mode-map [(control c) right] 'winner-redo)) |
|
|
|
|
474 |
(unless (or (assq 'winner-mode minor-mode-map-alist) |
(unless (or (assq 'winner-mode minor-mode-map-alist) |
475 |
winner-dont-bind-my-keys) |
winner-dont-bind-my-keys) |
476 |
(push (cons 'winner-mode winner-mode-map) |
(push (cons 'winner-mode winner-mode-map) |
477 |
minor-mode-map-alist)) |
minor-mode-map-alist)) |
478 |
|
|
479 |
(provide 'winner) |
(provide 'winner) |
480 |
|
;; arch-tag: 686d1c1b-010e-42ca-a192-b5685112418f |
|
;;; arch-tag: 686d1c1b-010e-42ca-a192-b5685112418f |
|
481 |
;;; winner.el ends here |
;;; winner.el ends here |