diff options
| -rw-r--r-- | lisp/international/ucs-tables.el | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/international/ucs-tables.el b/lisp/international/ucs-tables.el index 99574ad315c..6380e7addbf 100644 --- a/lisp/international/ucs-tables.el +++ b/lisp/international/ucs-tables.el | |||
| @@ -1182,9 +1182,8 @@ everything on input operations." | |||
| 1182 | 1182 | ||
| 1183 | ;; Translate Quail input globally. | 1183 | ;; Translate Quail input globally. |
| 1184 | (setq-default translation-table-for-input ucs-mule-to-mule-unicode) | 1184 | (setq-default translation-table-for-input ucs-mule-to-mule-unicode) |
| 1185 | ;; In case these are set up, but we should use the global | 1185 | ;; In case this is set up, but we should use the global |
| 1186 | ;; translation-table. | 1186 | ;; translation-table. |
| 1187 | (remove-hook 'set-buffer-major-mode-hook 'ucs-set-table-for-input) | ||
| 1188 | (remove-hook 'minibuffer-setup-hook 'ucs-minibuffer-setup)) | 1187 | (remove-hook 'minibuffer-setup-hook 'ucs-minibuffer-setup)) |
| 1189 | 1188 | ||
| 1190 | (when for-encode | 1189 | (when for-encode |
| @@ -1212,10 +1211,6 @@ everything on input operations." | |||
| 1212 | ;; Update the table of what encodes to what. | 1211 | ;; Update the table of what encodes to what. |
| 1213 | (register-char-codings coding-system table) | 1212 | (register-char-codings coding-system table) |
| 1214 | (coding-system-put coding-system 'translation-table-for-encode table))) | 1213 | (coding-system-put coding-system 'translation-table-for-encode table))) |
| 1215 | ;; Arrange local translation-tables for keyboard input. See also | ||
| 1216 | ;; `set-buffer-file-coding-system' and `normal-mode'. These | ||
| 1217 | ;; _appear_ to be the best places to hook in. | ||
| 1218 | (add-hook 'set-buffer-major-mode-hook 'ucs-set-table-for-input) | ||
| 1219 | (add-hook 'minibuffer-setup-hook 'ucs-minibuffer-setup))) | 1214 | (add-hook 'minibuffer-setup-hook 'ucs-minibuffer-setup))) |
| 1220 | 1215 | ||
| 1221 | (defun ucs-fragment-8859 (for-encode for-decode) | 1216 | (defun ucs-fragment-8859 (for-encode for-decode) |
| @@ -1279,7 +1274,6 @@ unification on input operations." | |||
| 1279 | (set-char-table-parent safe nil)) | 1274 | (set-char-table-parent safe nil)) |
| 1280 | (coding-system-put coding-system 'translation-table-for-encode nil))) | 1275 | (coding-system-put coding-system 'translation-table-for-encode nil))) |
| 1281 | (optimize-char-table char-coding-system-table) | 1276 | (optimize-char-table char-coding-system-table) |
| 1282 | (remove-hook 'set-buffer-major-mode-hook 'ucs-set-table-for-input) | ||
| 1283 | (remove-hook 'minibuffer-setup-hook 'ucs-minibuffer-setup))) | 1277 | (remove-hook 'minibuffer-setup-hook 'ucs-minibuffer-setup))) |
| 1284 | 1278 | ||
| 1285 | (defun ucs-insert (arg) | 1279 | (defun ucs-insert (arg) |
| @@ -2519,15 +2513,18 @@ See also command `unify-8859-on-encoding-mode' and the user option | |||
| 2519 | (ucs-unify-8859 t nil) | 2513 | (ucs-unify-8859 t nil) |
| 2520 | 2514 | ||
| 2521 | ;; Arrange to set up the translation-table for keyboard input. This | 2515 | ;; Arrange to set up the translation-table for keyboard input. This |
| 2522 | ;; probably isn't foolproof. | 2516 | ;; is called from get-buffer-create, set-buffer-file-coding-system, |
| 2523 | (defun ucs-set-table-for-input () | 2517 | ;; normal-mode and minibuffer-setup-hook. |
| 2524 | "Set up an appropriate `translation-table-for-input' for current buffer." | 2518 | (defun ucs-set-table-for-input (&optional buffer) |
| 2519 | "Set up an appropriate `translation-table-for-input' for BUFFER. | ||
| 2520 | BUFFER defaults to the current buffer." | ||
| 2525 | (when (and unify-8859-on-encoding-mode | 2521 | (when (and unify-8859-on-encoding-mode |
| 2526 | (char-table-p translation-table-for-input)) | 2522 | (char-table-p translation-table-for-input)) |
| 2527 | (let ((cs (and buffer-file-coding-system | 2523 | (let ((cs (and buffer-file-coding-system |
| 2528 | (coding-system-base buffer-file-coding-system))) | 2524 | (coding-system-base buffer-file-coding-system))) |
| 2529 | table) | 2525 | table) |
| 2530 | (if (eq cs 'undecided) | 2526 | (if (or (null cs) |
| 2527 | (eq cs 'undecided)) | ||
| 2531 | (setq cs | 2528 | (setq cs |
| 2532 | (and default-buffer-file-coding-system | 2529 | (and default-buffer-file-coding-system |
| 2533 | (coding-system-base default-buffer-file-coding-system)))) | 2530 | (coding-system-base default-buffer-file-coding-system)))) |
| @@ -2536,8 +2533,12 @@ See also command `unify-8859-on-encoding-mode' and the user option | |||
| 2536 | (unless (char-table-p table) | 2533 | (unless (char-table-p table) |
| 2537 | (setq table (coding-system-get cs 'translation-table-for-input))) | 2534 | (setq table (coding-system-get cs 'translation-table-for-input))) |
| 2538 | (when (char-table-p table) | 2535 | (when (char-table-p table) |
| 2539 | (set (make-variable-buffer-local 'translation-table-for-input) | 2536 | (if buffer |
| 2540 | table)))))) | 2537 | (with-current-buffer buffer |
| 2538 | (set (make-variable-buffer-local 'translation-table-for-input) | ||
| 2539 | table)) | ||
| 2540 | (set (make-variable-buffer-local 'translation-table-for-input) | ||
| 2541 | table))))))) | ||
| 2541 | 2542 | ||
| 2542 | ;; The minibuffer needs to acquire a `buffer-file-coding-system' for | 2543 | ;; The minibuffer needs to acquire a `buffer-file-coding-system' for |
| 2543 | ;; the above to work in it. | 2544 | ;; the above to work in it. |