Commit 875d9106 authored by Dave Love's avatar Dave Love
Browse files

Revert to using

translation-table-for-input instead of keyboard-translate-table.
parent eb9fc9e6
......@@ -56,12 +56,12 @@
;; `utf-fragment-on-decoding' which may specify decoding Greek and
;; Cyrillic into 8859 charsets.
;; Unification also arranges for the `keyboard-translate-table'
;; variable to be set either globally or locally. This is used to
;; translate input characters appropriately for the buffer's coding
;; system (if possible). Unification on decoding sets it globally to
;; translate to Unicode. Unification on encoding uses hooks to set it
;; up locally to buffers. Thus in the latter case, typing `"a' into a
;; Unification also arranges for `translation-table-for-input' to be
;; set either globally or locally. This is used to translate input
;; characters appropriately for the buffer's coding system (if
;; possible). Unification on decoding sets it globally to translate
;; to Unicode. Unification on encoding uses hooks to set it up
;; locally to buffers. Thus in the latter case, typing `"a' into a
;; Latin-1 buffer using the `latin-2-prefix' method translates the
;; generated latin-iso8859-2 `,Bd(B' into latin-iso8859-1 `,Ad(B'.
......@@ -155,9 +155,9 @@ Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
"Used as `translation-table-for-encode' for iso-8859-15.
Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
(setq-default keyboard-translate-table (make-translation-table))
(setq translation-table-for-input (make-translation-table))
;; It will normally be set locally, before the major mode is invoked.
(put 'keyboard-translate-table 'permanent-local t)
(put 'translation-table-for-input 'permanent-local t)
(define-translation-table 'ucs-translation-table-for-decode)
......@@ -1179,11 +1179,9 @@ everything on input operations."
;; For CCL coding systems other than mule-utf-*
(define-translation-table 'ucs-translation-table-for-decode
ucs-mule-8859-to-mule-unicode)
;; Translate keyboard input globally.
(let ((table (default-value 'keyboard-translate-table)))
(map-char-table (lambda (k v)
(aset table k v))
ucs-mule-to-mule-unicode))
;; Translate Quail input globally.
(setq-default translation-table-for-input ucs-mule-to-mule-unicode)
;; In case these are set up, but we should use the global
;; translation-table.
(remove-hook 'set-buffer-major-mode-hook 'ucs-set-table-for-input)
......@@ -1230,10 +1228,7 @@ unification on input operations."
(set-char-table-parent standard-translation-table-for-decode nil)
;; For CCL coding systems other than mule-utf-* (e.g. cyrillic-koi8).
(define-translation-table 'ucs-translation-table-for-decode)
(let ((table (default-value 'keyboard-translate-table)))
(map-char-table (lambda (k v)
(aset table k nil))
ucs-mule-to-mule-unicode)))
(setq-default translation-table-for-input nil))
(when for-encode
;; Make mule-utf-* disabled for all characters in
......@@ -2452,13 +2447,13 @@ Interactively, prompts for a hex string giving the code."
safe-charsets)))
(cond ((eq cs 'vietnamese-viscii)
(coding-system-put 'vietnamese-viscii
'keyboard-translate-table
'translation-table-for-input
encode-translator)
(coding-system-put 'vietnamese-viqr
'keyboard-translate-table
'translation-table-for-input
encode-translator))
((memq cs '(lao thai-tis620 tibetan-iso-8bit))
(coding-system-put cs 'keyboard-translate-table cs)))))
(coding-system-put cs 'translation-table-for-input cs)))))
(dolist (c safe-charsets)
(aset table (make-char c) t))))
......@@ -2483,10 +2478,11 @@ directly to a byte value 233. By default, in contrast, you would be
prompted for a general coding system to use for saving the file, which
can cope with separate Latin-1 and Latin-9 representations of e-acute.
Also sets hooks that arrange `keyboard-translate-table' to be set up
locally. This will often allow input to conform with what the
buffer's file coding system can encode. Thus you could use a Latin-2
input method to search for e-acute in a Latin-1 buffer.
Also sets hooks that arrange `translation-table-for-input' to be set
up locally. This will often allow input generated by Quail input
methods to conform with what the buffer's file coding system can
encode. Thus you could use a Latin-2 input method to search for
e-acute in a Latin-1 buffer.
See also command `unify-8859-on-decoding-mode'."
:group 'mule
......@@ -2504,7 +2500,8 @@ On decoding, i.e. input operations, non-ASCII characters from the
built-in ISO 8859 charsets are unified by mapping them into the
`iso-latin-1' and `mule-unicode-0100-24ff' charsets.
Also sets `keyboard-translate-table' globally.
Also sets `translation-table-for-input' globally, so that keyboard input
produces unified characters.
See also command `unify-8859-on-encoding-mode' and the user option
`utf-fragment-on-decoding'."
......@@ -2524,9 +2521,9 @@ See also command `unify-8859-on-encoding-mode' and the user option
;; Arrange to set up the translation-table for keyboard input. This
;; probably isn't foolproof.
(defun ucs-set-table-for-input ()
"Set up an appropriate `keyboard-translate-table' for current buffer."
"Set up an appropriate `translation-table-for-input' for current buffer."
(when (and unify-8859-on-encoding-mode
(char-table-p keyboard-translate-table))
(char-table-p translation-table-for-input))
(let ((cs (and buffer-file-coding-system
(coding-system-base buffer-file-coding-system)))
table)
......@@ -2537,14 +2534,10 @@ See also command `unify-8859-on-encoding-mode' and the user option
(when cs
(setq table (coding-system-get cs 'translation-table-for-encode))
(unless (char-table-p table)
(setq table (coding-system-get cs 'keyboard-translate-table)))
(setq table (coding-system-get cs 'translation-table-for-input)))
(when (char-table-p table)
(set (make-variable-buffer-local 'keyboard-translate-table)
(let ((new (copy-sequence table)))
(set-char-table-parent
new (default-value 'keyboard-translate-table))
new)))))))
(set (make-variable-buffer-local 'translation-table-for-input)
table))))))
;; The minibuffer needs to acquire a `buffer-file-coding-system' for
;; the above to work in it.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment