Mercurial > emacs
changeset 41715:3fb1c54eb631
(encoded-kbd-mode): Use define-minor-mode.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 01 Dec 2001 00:18:21 +0000 |
parents | d03985d6f325 |
children | e467d0e8f243 |
files | lisp/international/encoded-kb.el |
diffstat | 1 files changed, 6 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/international/encoded-kb.el Sat Dec 01 00:17:08 2001 +0000 +++ b/lisp/international/encoded-kb.el Sat Dec 01 00:18:21 2001 +0000 @@ -24,27 +24,9 @@ ;;; Code: -(defvar encoded-kbd-mode nil - "Non-nil if in Encoded-kbd minor mode.") -(put 'encoded-kbd-mode 'permanent-local t) - -;;; (let ((slot (assq 'encoded-kbd-mode minor-mode-alist)) -;;; (name " Encoded-kbd")) -;;; (if slot -;;; (setcar (cdr slot) name) -;;; (setq minor-mode-alist -;;; (cons '(encoded-kbd-mode " Encoded-kbd") minor-mode-alist)))) - (defconst encoded-kbd-mode-map (make-sparse-keymap) "Keymap for Encoded-kbd minor mode.") -(let ((slot (assq 'encoded-kbd-mode minor-mode-map-alist))) - (if slot - (setcdr slot encoded-kbd-mode-map) - (setq minor-mode-map-alist - (cons (cons 'encoded-kbd-mode encoded-kbd-mode-map) - minor-mode-map-alist)))) - ;; Subsidiary keymaps for handling ISO2022 escape sequences. (defvar encoded-kbd-iso2022-esc-map @@ -305,8 +287,9 @@ ;; Input mode at the time Encoded-kbd mode is turned on is saved here. (defvar saved-input-mode nil) +(put 'encoded-kbd-mode 'permanent-local t) ;;;###autoload -(defun encoded-kbd-mode (&optional arg) +(define-minor-mode encoded-kbd-mode "Toggle Encoded-kbd minor mode. With arg, turn Encoded-kbd mode on if and only if arg is positive. @@ -317,12 +300,9 @@ In Encoded-kbd mode, a text sent from keyboard is accepted as a multilingual text encoded in a coding system set by \\[set-keyboard-coding-system]." - (if encoded-kbd-mode - ;; We must at first reset input-mode to the original. - (apply 'set-input-mode saved-input-mode)) - (setq encoded-kbd-mode - (if (null arg) (null encoded-kbd-mode) - (> (prefix-numeric-value arg) 0))) + :global t + ;; We must at first reset input-mode to the original. + (if saved-input-mode (apply 'set-input-mode saved-input-mode)) (if encoded-kbd-mode (let ((coding (keyboard-coding-system))) (setq saved-input-mode (current-input-mode)) @@ -374,7 +354,6 @@ (setq encoded-kbd-mode nil) (error "Coding-system `%s' is not supported in Encoded-kbd mode" (keyboard-coding-system)))) - (encoded-kbd-setup-keymap coding) - (run-hooks 'encoded-kbd-mode-hook)))) + (encoded-kbd-setup-keymap coding)))) ;;; encoded-kb.el ends here