diff options
| author | Stefan Monnier | 2001-12-01 00:18:21 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-12-01 00:18:21 +0000 |
| commit | ff14aafbabd7c6643d19e550ae8a05398bfcdfc4 (patch) | |
| tree | 629ff0d11d85d44be12c4aa8abb96381e956fa8e | |
| parent | 6c0bc4a0b901db9be13c6dfdb8370b160dc144ca (diff) | |
| download | emacs-ff14aafbabd7c6643d19e550ae8a05398bfcdfc4.tar.gz emacs-ff14aafbabd7c6643d19e550ae8a05398bfcdfc4.zip | |
(encoded-kbd-mode): Use define-minor-mode.
| -rw-r--r-- | lisp/international/encoded-kb.el | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/lisp/international/encoded-kb.el b/lisp/international/encoded-kb.el index 754ba2b77c0..c90c1650810 100644 --- a/lisp/international/encoded-kb.el +++ b/lisp/international/encoded-kb.el | |||
| @@ -24,27 +24,9 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | 26 | ||
| 27 | (defvar encoded-kbd-mode nil | ||
| 28 | "Non-nil if in Encoded-kbd minor mode.") | ||
| 29 | (put 'encoded-kbd-mode 'permanent-local t) | ||
| 30 | |||
| 31 | ;;; (let ((slot (assq 'encoded-kbd-mode minor-mode-alist)) | ||
| 32 | ;;; (name " Encoded-kbd")) | ||
| 33 | ;;; (if slot | ||
| 34 | ;;; (setcar (cdr slot) name) | ||
| 35 | ;;; (setq minor-mode-alist | ||
| 36 | ;;; (cons '(encoded-kbd-mode " Encoded-kbd") minor-mode-alist)))) | ||
| 37 | |||
| 38 | (defconst encoded-kbd-mode-map (make-sparse-keymap) | 27 | (defconst encoded-kbd-mode-map (make-sparse-keymap) |
| 39 | "Keymap for Encoded-kbd minor mode.") | 28 | "Keymap for Encoded-kbd minor mode.") |
| 40 | 29 | ||
| 41 | (let ((slot (assq 'encoded-kbd-mode minor-mode-map-alist))) | ||
| 42 | (if slot | ||
| 43 | (setcdr slot encoded-kbd-mode-map) | ||
| 44 | (setq minor-mode-map-alist | ||
| 45 | (cons (cons 'encoded-kbd-mode encoded-kbd-mode-map) | ||
| 46 | minor-mode-map-alist)))) | ||
| 47 | |||
| 48 | ;; Subsidiary keymaps for handling ISO2022 escape sequences. | 30 | ;; Subsidiary keymaps for handling ISO2022 escape sequences. |
| 49 | 31 | ||
| 50 | (defvar encoded-kbd-iso2022-esc-map | 32 | (defvar encoded-kbd-iso2022-esc-map |
| @@ -305,8 +287,9 @@ The following key sequence may cause multilingual text insertion." | |||
| 305 | ;; Input mode at the time Encoded-kbd mode is turned on is saved here. | 287 | ;; Input mode at the time Encoded-kbd mode is turned on is saved here. |
| 306 | (defvar saved-input-mode nil) | 288 | (defvar saved-input-mode nil) |
| 307 | 289 | ||
| 290 | (put 'encoded-kbd-mode 'permanent-local t) | ||
| 308 | ;;;###autoload | 291 | ;;;###autoload |
| 309 | (defun encoded-kbd-mode (&optional arg) | 292 | (define-minor-mode encoded-kbd-mode |
| 310 | "Toggle Encoded-kbd minor mode. | 293 | "Toggle Encoded-kbd minor mode. |
| 311 | With arg, turn Encoded-kbd mode on if and only if arg is positive. | 294 | With arg, turn Encoded-kbd mode on if and only if arg is positive. |
| 312 | 295 | ||
| @@ -317,12 +300,9 @@ automatically. | |||
| 317 | In Encoded-kbd mode, a text sent from keyboard is accepted | 300 | In Encoded-kbd mode, a text sent from keyboard is accepted |
| 318 | as a multilingual text encoded in a coding system set by | 301 | as a multilingual text encoded in a coding system set by |
| 319 | \\[set-keyboard-coding-system]." | 302 | \\[set-keyboard-coding-system]." |
| 320 | (if encoded-kbd-mode | 303 | :global t |
| 321 | ;; We must at first reset input-mode to the original. | 304 | ;; We must at first reset input-mode to the original. |
| 322 | (apply 'set-input-mode saved-input-mode)) | 305 | (if saved-input-mode (apply 'set-input-mode saved-input-mode)) |
| 323 | (setq encoded-kbd-mode | ||
| 324 | (if (null arg) (null encoded-kbd-mode) | ||
| 325 | (> (prefix-numeric-value arg) 0))) | ||
| 326 | (if encoded-kbd-mode | 306 | (if encoded-kbd-mode |
| 327 | (let ((coding (keyboard-coding-system))) | 307 | (let ((coding (keyboard-coding-system))) |
| 328 | (setq saved-input-mode (current-input-mode)) | 308 | (setq saved-input-mode (current-input-mode)) |
| @@ -374,7 +354,6 @@ as a multilingual text encoded in a coding system set by | |||
| 374 | (setq encoded-kbd-mode nil) | 354 | (setq encoded-kbd-mode nil) |
| 375 | (error "Coding-system `%s' is not supported in Encoded-kbd mode" | 355 | (error "Coding-system `%s' is not supported in Encoded-kbd mode" |
| 376 | (keyboard-coding-system)))) | 356 | (keyboard-coding-system)))) |
| 377 | (encoded-kbd-setup-keymap coding) | 357 | (encoded-kbd-setup-keymap coding)))) |
| 378 | (run-hooks 'encoded-kbd-mode-hook)))) | ||
| 379 | 358 | ||
| 380 | ;;; encoded-kb.el ends here | 359 | ;;; encoded-kb.el ends here |