]> code.delx.au - gnu-emacs/blobdiff - lisp/international/ucs-tables.el
(decode-coding-inserted-region): Call
[gnu-emacs] / lisp / international / ucs-tables.el
index 476c8dfc19116516d0f49984ba14fd266cc9da96..a8ca220466a612214dfd12c3046fdd71d2a6d02c 100644 (file)
@@ -1,6 +1,9 @@
 ;;; ucs-tables.el --- translation to, from and via Unicode  -*- coding: iso-2022-7bit -*-
 
-;; Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003
+;;   National Institute of Advanced Industrial Science and Technology (AIST)
+;;   Registration Number H14PRO021
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
@@ -19,8 +22,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -1247,12 +1250,14 @@ unification on input operations."
   "Insert the Emacs character representation of the given Unicode.
 Interactively, prompts for a hex string giving the code."
   (interactive "sUnicode (hex): ")
-  (let ((c (decode-char 'ucs (if (integerp arg)
-                                arg
-                              (string-to-number arg 16)))))
+  (or (integerp arg)
+      (setq arg (string-to-number arg 16)))
+  (let ((c (decode-char 'ucs arg)))
     (if c
        (insert c)
-      (error "Character can't be decoded to UCS"))))
+      (if (or (< arg 0) (> arg #x10FFFF))
+         (error "Not a Unicode character code: 0x%X" arg)
+       (error "Character U+%04X is not yet supported" arg)))))
 
 ;;; Dealing with non-8859 character sets.
 
@@ -2434,7 +2439,7 @@ Interactively, prompts for a hex string giving the code."
 The ISO 8859 characters sets overlap, e.g. 8859-1 (Latin-1) and
 8859-15 (Latin-9) differ only in a few characters.  Emacs normally
 distinguishes equivalent characters from those ISO-8859 character sets
-which are built in to Emacs.  This behaviour is essentially inherited
+which are built in to Emacs.  This behavior is essentially inherited
 from the European-originated international standards.  Treating them
 equivalently, by translating to and from a single representation is
 called `unification'.  (The `utf-8' coding system treats the
@@ -2494,8 +2499,10 @@ See also command `unify-8859-on-encoding-mode' and the user option
 ;; normal-mode and minibuffer-setup-hook.
 (defun ucs-set-table-for-input (&optional buffer)
   "Set up an appropriate `translation-table-for-input' for BUFFER.
-BUFFER defaults to the current buffer."
+BUFFER defaults to the current buffer.  This function is
+automatically called directly at the end of `get-buffer-create'."
   (when (and unify-8859-on-encoding-mode
+             (not unify-8859-on-decoding-mode)
             (char-table-p translation-table-for-input))
     (let ((cs (and buffer-file-coding-system
                   (coding-system-base buffer-file-coding-system)))
@@ -2510,13 +2517,15 @@ BUFFER defaults to the current buffer."
        (if (and table (symbolp table))
            (setq table (get table 'translation-table)))
        (unless (char-table-p table)
-         (setq table (coding-system-get cs 'translation-table-for-input)))
+         (setq table (coding-system-get cs 'translation-table-for-input))
+         (if (and table (symbolp table))
+             (setq table (get table 'translation-table))))
        (when (char-table-p table)
          (if buffer
              (with-current-buffer buffer
-               (set (make-variable-buffer-local 'translation-table-for-input)
+               (set (make-local-variable 'translation-table-for-input)
                     table))
-           (set (make-variable-buffer-local 'translation-table-for-input)
+           (set (make-local-variable 'translation-table-for-input)
                 table)))))))
 
 ;; The minibuffer needs to acquire a `buffer-file-coding-system' for
@@ -2533,5 +2542,5 @@ Intended to be added to `minibuffer-setup-hook'."
 
 (provide 'ucs-tables)
 
-;;; arch-tag: b497e22b-7fe1-486a-9352-e2d7f7d76a76
+;; arch-tag: b497e22b-7fe1-486a-9352-e2d7f7d76a76
 ;;; ucs-tables.el ends here