Convert consecutive FSF copyright years to ranges.
[bpt/emacs.git] / leim / quail / japanese.el
index fa87a99..dd9eb6e 100644 (file)
@@ -1,16 +1,20 @@
 ;;; japanese.el --- Quail package for inputting Japanese  -*-coding: iso-2022-7bit;-*-
 
-;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
-;; Licensed to the Free Software Foundation.
+;; Copyright (C) 2001-2011
+;;   Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010, 2011
+;;   National Institute of Advanced Industrial Science and Technology (AIST)
+;;   Registration Number H14PRO021
 
 ;; Keywords: multilingual, input method, Japanese
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,9 +22,7 @@
 ;; GNU General Public License for more details.
 
 ;; 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., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
                (or quail-current-str quail-current-key)
              ""))
     (if (integerp control-flag)
-       (if (= control-flag 0)
-           (setq quail-current-str (aref quail-current-key 0))
-         (cond ((= (aref quail-current-key 0) ?n)
+       (let ((keylen (length quail-current-key)))
+         (cond ((= control-flag 0)
+                (setq quail-current-str (aref quail-current-key 0)
+                      control-flag t))
+               ((= (aref quail-current-key 0) ?n)
                 (setq quail-current-str ?\e$B$s\e(B)
                 (if (and quail-japanese-use-double-n
+                         (> keylen 0)
                          (= (aref quail-current-key 1) ?n))
                     (setq control-flag t)))
-               ((= (aref quail-current-key 0) (aref quail-current-key 1))
+               ((and (> keylen 1)
+                     (= (aref quail-current-key 0) (aref quail-current-key 1)))
                 (setq quail-current-str ?\e$B$C\e(B))
                (t
                 (setq quail-current-str (aref quail-current-key 0))))
          (if (integerp control-flag)
              (setq unread-command-events
-                   (list (aref quail-current-key control-flag)))))))
+                   (string-to-list
+                    (substring quail-current-key control-flag)))))))
   control-flag)
 
 ;; Convert Hiragana <-> Katakana in the current translation region.
@@ -79,9 +86,9 @@
   (when (= (char-before (overlay-end quail-conv-overlay)) ?n)
     ;; The last char is `n'.  We had better convert it to `\e$B$s\e(B'
     ;; before kana-kanji conversion.
-    (goto-char (overlay-end quail-conv-overlay))
-    (delete-char -1)
-    (insert ?\e$B$s\e(B))
+    (goto-char (1- (overlay-end quail-conv-overlay)))
+    (insert ?\e$B$s\e(B)
+    (delete-char 1))
   (let* ((from (copy-marker (overlay-start quail-conv-overlay)))
         (len (- (overlay-end quail-conv-overlay) from)))
     (quail-delete-overlays)
@@ -543,5 +550,4 @@ qq: toggle between this input method and the input method `japanese-ascii'.
                          (vector (japanese-katakana (aref trans 0))))
                         (t trans)))))
 
-;;; arch-tag: 47e0bfd4-6ecc-4d01-89a8-d687c5e01ff7
 ;;; japanese.el ends here