diff options
| author | Karoly Lorentey | 2005-06-27 00:39:09 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-06-27 00:39:09 +0000 |
| commit | 40df3a9982975aba7fd04392507537129879d2d5 (patch) | |
| tree | 65e17ae1dc712cb0fd45c7356f6445ce22988426 | |
| parent | d836b39b818551c04c7e598176d3f26be7abfa5e (diff) | |
| download | emacs-40df3a9982975aba7fd04392507537129879d2d5.tar.gz emacs-40df3a9982975aba7fd04392507537129879d2d5.zip | |
Replace encoded-kbd-mode with display-specific encoded-kbd-setup-display. (Doesn't work yet.)
* lisp/international/encoded-kb.el (saved-key-translation-map): Remove.
(encoded-kbd-mode): Remove.
(encoded-kbd-setup-display): New function.
* lisp/international/mule.el (set-keyboard-coding-system): Use it.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-361
| -rw-r--r-- | lisp/international/encoded-kb.el | 93 | ||||
| -rw-r--r-- | lisp/international/mule.el | 7 |
2 files changed, 47 insertions, 53 deletions
diff --git a/lisp/international/encoded-kb.el b/lisp/international/encoded-kb.el index 3da034a05ed..3e9de740581 100644 --- a/lisp/international/encoded-kb.el +++ b/lisp/international/encoded-kb.el | |||
| @@ -251,59 +251,54 @@ The following key sequence may cause multilingual text insertion." | |||
| 251 | (t | 251 | (t |
| 252 | nil))) | 252 | nil))) |
| 253 | 253 | ||
| 254 | ;; key-translation-map at the time Encoded-kbd mode is turned on is | ||
| 255 | ;; saved here. | ||
| 256 | (defvar saved-key-translation-map nil) | ||
| 257 | |||
| 258 | ;; Input mode at the time Encoded-kbd mode is turned on is saved here. | 254 | ;; Input mode at the time Encoded-kbd mode is turned on is saved here. |
| 255 | ;; XXX This should be made display-local somehow. | ||
| 259 | (defvar saved-input-mode nil) | 256 | (defvar saved-input-mode nil) |
| 260 | 257 | ||
| 261 | (put 'encoded-kbd-mode 'permanent-local t) | ||
| 262 | ;;;###autoload | 258 | ;;;###autoload |
| 263 | (define-minor-mode encoded-kbd-mode | 259 | (defun encoded-kbd-setup-display (display) |
| 264 | "Toggle Encoded-kbd minor mode. | 260 | "Set up a `key-translation-map' for `keyboard-coding-system' on DISPLAY. |
| 265 | With arg, turn Encoded-kbd mode on if and only if arg is positive. | 261 | |
| 266 | 262 | DISPLAY may be a display id, a frame, or nil for the selected frame's display." | |
| 267 | You should not turn this mode on manually, instead use the command | 263 | (let ((frame (if (framep display) display (car (frames-on-display-list display))))) |
| 268 | \\[set-keyboard-coding-system] which turns on or off this mode | 264 | (when frame |
| 269 | automatically. | 265 | (with-selected-frame frame |
| 270 | 266 | (message (format "encoded-kbd-setup-display %s %s %s" display frame key-translation-map)) | |
| 271 | In Encoded-kbd mode, a text sent from keyboard is accepted | 267 | ;; Remove any previous encoded-kb keymap from key-translation-map. |
| 272 | as a multilingual text encoded in a coding system set by | 268 | (let ((m key-translation-map)) |
| 273 | \\[set-keyboard-coding-system]." | 269 | (if (equal (keymap-prompt m) "encoded-kb") |
| 274 | :global t :group 'keyboard :group 'mule | 270 | (setq key-translation-map (keymap-parent m)) |
| 275 | 271 | (while (keymap-parent m) | |
| 276 | (if encoded-kbd-mode | 272 | (if (equal (keymap-prompt (keymap-parent m)) "encoded-kb") |
| 277 | ;; We are turning on Encoded-kbd mode. | 273 | (set-keymap-parent m (keymap-parent (keymap-parent m)))) |
| 278 | (let ((coding (keyboard-coding-system)) | 274 | (setq m (keymap-parent m))))) |
| 279 | result) | 275 | |
| 280 | (or saved-key-translation-map | 276 | (if (keyboard-coding-system) |
| 281 | (if (keymapp key-translation-map) | 277 | ;; We are turning on Encoded-kbd mode. |
| 282 | (setq saved-key-translation-map | 278 | (let ((coding (keyboard-coding-system)) |
| 283 | (copy-keymap key-translation-map)) | 279 | (keymap (make-sparse-keymap "encoded-kb")) |
| 284 | (setq key-translation-map (make-sparse-keymap)))) | 280 | result) |
| 285 | (or saved-input-mode | 281 | (set-keymap-parent keymap key-translation-map) |
| 286 | (setq saved-input-mode | 282 | (setq key-translation-map keymap) |
| 287 | (current-input-mode))) | 283 | (or saved-input-mode |
| 288 | (setq result (and coding (encoded-kbd-setup-keymap coding))) | 284 | (setq saved-input-mode (current-input-mode))) |
| 289 | (if result | 285 | (setq result (and coding (encoded-kbd-setup-keymap coding))) |
| 290 | (if (eq result 8) | 286 | (if result |
| 291 | (set-input-mode | 287 | (if (eq result 8) |
| 292 | (nth 0 saved-input-mode) | 288 | (set-input-mode |
| 293 | (nth 1 saved-input-mode) | 289 | (nth 0 saved-input-mode) |
| 294 | 'use-8th-bit | 290 | (nth 1 saved-input-mode) |
| 295 | (nth 3 saved-input-mode))) | 291 | 'use-8th-bit |
| 296 | (setq encoded-kbd-mode nil | 292 | (nth 3 saved-input-mode))) |
| 297 | saved-key-translation-map nil | 293 | (setq saved-input-mode nil) |
| 298 | saved-input-mode nil) | 294 | (error "Unsupported coding system in Encoded-kbd mode: %S" |
| 299 | (error "Unsupported coding system in Encoded-kbd mode: %S" | 295 | coding))) |
| 300 | coding))) | 296 | ;; We are turning off Encoded-kbd mode. |
| 301 | 297 | (and saved-input-mode | |
| 302 | ;; We are turning off Encoded-kbd mode. | 298 | (apply 'set-input-mode saved-input-mode)) |
| 303 | (setq key-translation-map saved-key-translation-map | 299 | (setq saved-input-mode nil)) |
| 304 | saved-key-translation-map nil) | 300 | (when (not (eq (selected-frame) frame)) |
| 305 | (apply 'set-input-mode saved-input-mode) | 301 | (error "Anyátok picsája!")))))) |
| 306 | (setq saved-input-mode nil))) | ||
| 307 | 302 | ||
| 308 | (provide 'encoded-kb) | 303 | (provide 'encoded-kb) |
| 309 | 304 | ||
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 74c4b96c3d4..dbb8df39a7e 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -1232,9 +1232,8 @@ See also the command `set-keyboard-coding-system'.") | |||
| 1232 | 1232 | ||
| 1233 | (defun set-keyboard-coding-system (coding-system &optional display) | 1233 | (defun set-keyboard-coding-system (coding-system &optional display) |
| 1234 | "Set coding system for keyboard input on DISPLAY to CODING-SYSTEM. | 1234 | "Set coding system for keyboard input on DISPLAY to CODING-SYSTEM. |
| 1235 | In addition, this command enables Encoded-kbd minor mode. | 1235 | In addition, this command calls `encoded-kbd-setup-display' to set up the |
| 1236 | \(If CODING-SYSTEM is nil, Encoded-kbd mode is turned off -- see | 1236 | translation of keyboard input events to the specified coding system. |
| 1237 | `encoded-kbd-mode'.) | ||
| 1238 | 1237 | ||
| 1239 | For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. | 1238 | For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. |
| 1240 | The default is determined by the selected language environment | 1239 | The default is determined by the selected language environment |
| @@ -1257,7 +1256,7 @@ The setting has no effect on graphical displays." | |||
| 1257 | (setq default-keyboard-coding-system coding-system)) | 1256 | (setq default-keyboard-coding-system coding-system)) |
| 1258 | (set-keyboard-coding-system-internal coding-system display) | 1257 | (set-keyboard-coding-system-internal coding-system display) |
| 1259 | (setq keyboard-coding-system coding-system) | 1258 | (setq keyboard-coding-system coding-system) |
| 1260 | (encoded-kbd-mode (if coding-system 1 0))) | 1259 | (encoded-kbd-setup-display display)) |
| 1261 | 1260 | ||
| 1262 | (defcustom keyboard-coding-system nil | 1261 | (defcustom keyboard-coding-system nil |
| 1263 | "Specify coding system for keyboard input. | 1262 | "Specify coding system for keyboard input. |