[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (no subject)
From: |
Stefan Monnier |
Subject: |
Re: (no subject) |
Date: |
Mon, 19 Nov 2001 19:29:57 -0500 |
> Sam Steingold <address@hidden> writes:
> > I noticed an "Encoded-kbd" in mode line in _all_ windows.
> > Since the mode line real estate is scarce,
> > I am not sure this is a good idea.
>
> I agree, and actually, long ago, we reached a consensus that
> we should not display that string in mode-line.
How about the patch below which gets rid of the "Encoded-kbd" string
and uses define-minor-mode. There's just one thing fishy:
what is that (put 'encoded-kbd-mode 'permanent-local t) doing there ?
That variable doesn't seem to be made buffer-local. Is the permanent-local
added just for "in case someone makes it buffer-local" ?
Stefan
Index: international/encoded-kb.el
===================================================================
RCS file: /cvs/emacs/lisp/international/encoded-kb.el,v
retrieving revision 1.23
diff -c -r1.23 encoded-kb.el
*** international/encoded-kb.el 2001/07/15 19:53:53 1.23
--- international/encoded-kb.el 2001/11/20 00:28:20
***************
*** 24,50 ****
;;; 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
--- 24,32 ----
***************
*** 305,312 ****
;; Input mode at the time Encoded-kbd mode is turned on is saved here.
(defvar saved-input-mode nil)
;;;###autoload
! (defun encoded-kbd-mode (&optional arg)
"Toggle Encoded-kbd minor mode.
With arg, turn Encoded-kbd mode on if and only if arg is positive.
--- 287,295 ----
;; 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
! (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,328 ****
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)))
(if encoded-kbd-mode
(let ((coding (keyboard-coding-system)))
(setq saved-input-mode (current-input-mode))
--- 300,308 ----
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]."
! :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,380 ****
(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-kb.el ends here
--- 354,359 ----
(setq encoded-kbd-mode nil)
(error "Coding-system `%s' is not supported in Encoded-kbd mode"
(keyboard-coding-system))))
! (encoded-kbd-setup-keymap coding))))
;;; encoded-kb.el ends here