]> code.delx.au - gnu-emacs/blobdiff - lisp/international/titdic-cnv.el
Ibuffer: Mark buffers by content
[gnu-emacs] / lisp / international / titdic-cnv.el
index e68dc8bdc173d3fb357e3afbe6f0cb24fae783eb..61f440d5d86086b02cde6e890ca3732fbc9315ee 100644 (file)
@@ -1,6 +1,6 @@
 ;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package -*- coding:iso-2022-7bit; -*-
 
-;; Copyright (C) 1997-1998, 2000-201 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2016 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -86,7 +86,7 @@
   '(("chinese-4corner" "\e$(0(?-F\e(B")
     ("chinese-array30" "\e$(0#R#O\e(B")
     ("chinese-ccdospy" "\e$AKuF4\e(B"
-     "Pinyin base input method for Chinese charset GB2312 \(`chinese-gb2312').
+     "Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312').
 
 Pinyin is the standard Roman transliteration method for Chinese.
 For the detail of Pinyin system, see the documentation of the input
@@ -103,7 +103,7 @@ For example:
 
 \\<quail-translation-docstring>
 
-For double-width GB2312 characters correponding to ASCII, use the
+For double-width GB2312 characters corresponding to ASCII, use the
 input method `chinese-qj'.")
 
     ("chinese-ecdict" "\e$(05CKH\e(B"
@@ -122,17 +122,17 @@ compose one Chinese character.
 
 In this input method, you enter a Chinese character by first typing
 keys corresponding to Zhuyin symbols (see the above table) followed by
-SPC, 1, 2, 3, or 4 specifing a tone (SPC:\e$(0?v(N\e(B, 1:\e$(0M=Vy\e(B, 2:\e$(0Dm(N\e(B, 3: \e$(0&9Vy\e(B,
+SPC, 1, 2, 3, or 4 specifying a tone (SPC:\e$(0?v(N\e(B, 1:\e$(0M=Vy\e(B, 2:\e$(0Dm(N\e(B, 3: \e$(0&9Vy\e(B,
 4:\e$(0(+Vy\e(B).
 
 \\<quail-translation-docstring>")
 
     ("chinese-punct-b5" "\e$(0O:\e(BB"
-     "Input method for Chinese punctuations and symbols of Big5
+     "Input method for Chinese punctuation and symbols of Big5
 \(`chinese-big5-1' and `chinese-big5-2').")
 
     ("chinese-punct" "\e$A1j\e(BG"
-     "Input method for Chinese punctuations and symbols of GB2312
+     "Input method for Chinese punctuation and symbols of GB2312
 \(`chinese-gb2312').")
 
     ("chinese-py-b5" "\e$(03<\e(BB"
@@ -191,7 +191,7 @@ For instance, to input \e$ADc\e(B, you type \"n i 3 3\", the first \"n i\" is
 a Pinyin, the next \"3\" specifies tone, and the last \"3\" selects
 the third character from the candidate list.
 
-For double-width GB2312 characters correponding to ASCII, use the
+For double-width GB2312 characters corresponding to ASCII, use the
 input method `chinese-qj'.")
 
     ("chinese-zozy" "\e$(0I\0D\e(B"
@@ -203,7 +203,7 @@ compose a Chinese character.
 
 In this input method, you enter a Chinese character by first typing
 keys corresponding to Zhuyin symbols (see the above table) followed by
-SPC, 6, 3, 4, or 7 specifing a tone (SPC:\e$(0?v(N\e(B, 6:\e$(0Dm(N\e(B, 3:\e$(0&9Vy\e(B, 4:\e$(0(+Vy\e(B,
+SPC, 6, 3, 4, or 7 specifying a tone (SPC:\e$(0?v(N\e(B, 6:\e$(0Dm(N\e(B, 3:\e$(0&9Vy\e(B, 4:\e$(0(+Vy\e(B,
 7:\e$(0M=Vy\e(B).
 
 \\<quail-translation-docstring>")))
@@ -272,14 +272,12 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:\e$(0?v(N\e(B, 6:\e$(0Dm(N\e(B, 3:\e$(0&9Vy\e
 
     (princ ";; Quail package `")
     (princ package)
-    (princ (format "' -*- coding:%s -*-\n" coding-system-for-write))
-    (princ ";;   Generated by the command `titdic-convert'\n;;\tDate: ")
-    (princ (current-time-string))
-    (princ "\n;;\tOriginal TIT dictionary file: ")
+    (princ "\n")
+    (princ (substitute-command-keys
+           ";;   Generated by the command `titdic-convert'\n"))
+    (princ ";;\tOriginal TIT dictionary file: ")
     (princ (file-name-nondirectory filename))
-    (princ "\n\n;;; Comment:\n\n")
-    (princ ";; Byte-compile this file again after any modification.\n\n")
-    (princ ";;; Start of the header of original TIT dictionary.\n\n")
+    (princ "\n\n")
 
     (while (not (eobp))
       (let ((ch (following-char))
@@ -305,7 +303,7 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:\e$(0?v(N\e(B, 6:\e$(0Dm(N\e(B, 3:\e$(0&9Vy\e
               (cond ((looking-at "PROMPT:[ \t]*")
                      (goto-char (match-end 0))
                      (setq tit-prompt (tit-read-key-value))
-                     ;; Some TIT dictionaies that are encoded by
+                     ;; Some TIT dictionaries that are encoded by
                      ;; euc-china contains invalid character at the tail.
                      (let* ((last (aref tit-prompt (1- (length tit-prompt))))
                             (split (split-char last)))
@@ -519,7 +517,13 @@ the generated Quail package is saved."
          (widen)
 
          ;; Process the body part
-         (tit-process-body))))))
+         (tit-process-body)
+
+         (princ ";; Local Variables:\n")
+         (princ ";; version-control: never\n")
+         (princ ";; no-update-autoloads: t\n")
+         (princ (format ";; coding: %s\n" coding-system-for-write))
+         (princ ";; End:\n"))))))
 
 ;;;###autoload
 (defun batch-titdic-convert (&optional force)
@@ -559,9 +563,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
            (message "Converting %s to quail-package..." file)
            (titdic-convert file targetdir))
          (setq files (cdr files)))
-       (setq command-line-args-left (cdr command-line-args-left)))
-      (message "Byte-compile the created files by:")
-      (message "  %% emacs -batch -f batch-byte-compile XXX.el")))
+       (setq command-line-args-left (cdr command-line-args-left)))))
   (kill-emacs 0))
 
 \f
@@ -645,8 +647,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
 ;; details.
 ;;
 ;; You should have received a copy of the GNU General Public License along with
-;; CCE; see the file COPYING.  If not, write to the Free Software Foundation,
-;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.")
+;; CCE.  If not, see <http://www.gnu.org/licenses/>.")
 
     ("chinese-ziranma" "\e$AWTH;\e(B"
      "ziranma.cin" cn-gb-2312 "ZIRANMA.el"
@@ -674,8 +675,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
 ;; details.
 ;;
 ;; You should have received a copy of the GNU General Public License along with
-;; CCE; see the file COPYING.  If not, write to the Free Software Foundation,
-;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.")
+;; CCE.  If not, see <http://www.gnu.org/licenses/>.")
 
     ("chinese-ctlau" "\e$AAuTA\e(B"
      "CTLau.html" cn-gb-2312 "CTLau.el"
@@ -700,8 +700,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
 ;; # GNU General Public License for more details.
 ;; #
 ;; # You should have received a copy of the GNU General Public License
-;; # along with this program; if not, write to the Free Software Foundation,
-;; # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.")
+;; # along with this program.  If not, see <http://www.gnu.org/licenses/>.")
 
     ("chinese-ctlaub" "\e$(0N,Gn\e(B"
      "CTLau-b5.html" big5 "CTLau-b5.el"
@@ -726,15 +725,14 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
 ;; # GNU General Public License for more details.
 ;; #
 ;; # You should have received a copy of the GNU General Public License
-;; # along with this program; if not, write to the Free Software Foundation,
-;; # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.")
+;; # along with this program.  If not, see <http://www.gnu.org/licenses/>.")
     ))
 
 ;; Generate a code of a Quail package in the current buffer from Tsang
 ;; dictionary in the buffer DICBUF.  The input method name of the
 ;; Quail package is NAME, and the title string is TITLE.
 
-;; TSANG-P is non-nil, genereate \e$(06AQo\e(B input method.  Otherwise
+;; TSANG-P is non-nil, generate \e$(06AQo\e(B input method.  Otherwise
 ;; generate \e$(0X|/y\e(B (simple version of \e$(06AQo\e(B).  If BIG5-P is non-nil, the
 ;; input method is for inputting Big5 characters.  Otherwise the input
 ;; method is for inputting CNS characters.
@@ -801,36 +799,36 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
     (setq dic (sort dic (function (lambda (x y) (string< (car x ) (car y))))))
     (dolist (elt dic)
       (insert (format "(%S\t%S)\n" (car elt) (cdr elt))))
-    (let ((punctuations '((";" "\e$(0!'!2!"!#!.!/\e(B" "\e$(G!'!2!"!#!.!/\e(B")
-                         (":" "\e$(0!(!+!3!%!$!&!0!1\e(B" "\e$(G!(!+!3!%!$!&!0!1\e(B")
-                         ("'" "\e$(0!e!d\e(B" "\e$(G!e!d\e(B")
-                         ("\"" "\e$(0!g!f!h!i!q\e(B" "\e$(G!g!f!h!i!q\e(B")
-                         ("\\" "\e$(0"`"b#M\e(B" "\e$(G"`"b#M\e(B")
-                         ("|" "\e$(0!6!8!:"^\e(B" "\e$(G!6!8!:"^\e(B")
-                         ("/" "\e$(0"_"a#L\e(B" "\e$(G"_"a#L\e(B")
-                         ("?" "\e$(0!)!4\e(B" "\e$(G!)!4\e(B")
-                         ("<" "\e$(0!R"6"A!T"H\e(B" "\e$(G!R"6"A!T"H\e(B")
-                         (">" "\e$(0!S"7"B!U\e(B" "\e$(G!S"7"B!U\e(B")
-                         ("[" "\e$(0!F!J!b!H!L!V!Z!X!\\e(B" "\e$(G!F!J!b!H!L!V!Z!X!\\e(B")
-                         ("]" "\e$(0!G!K!c!I!M!W![!Y!]\e(B" "\e$(G!G!K!c!I!M!W![!Y!]\e(B")
-                         ("{" "\e$(0!B!`!D\e(B " "\e$(G!B!`!D\e(B ")
-                         ("}" "\e$(0!C!a!E\e(B" "\e$(G!C!a!E\e(B")
-                         ("`" "\e$(0!j!k\e(B" "\e$(G!j!k\e(B")
-                         ("~" "\e$(0"D"+",!<!=\e(B" "\e$(G"D"+",!<!=\e(B")
-                         ("!" "\e$(0!*!5\e(B" "\e$(G!*!5\e(B")
-                         ("@" "\e$(0"i"n\e(B" "\e$(G"i"n\e(B")
-                         ("#" "\e$(0!l"-\e(B" "\e$(G!l"-\e(B")
-                         ("$" "\e$(0"c"l\e(B" "\e$(G"c"l\e(B")
-                         ("%" "\e$(0"h"m\e(B" "\e$(G"h"m\e(B")
-                         ("&" "\e$(0!m".\e(B" "\e$(G!m".\e(B")
-                         ("*" "\e$(0!n"/!o!w!x\e(B" "\e$(G!n"/!o!w!x\e(B")
-                         ("(" "\e$(0!>!^!@\e(B" "\e$(G!>!^!@\e(B")
-                         (")" "\e$(0!?!_!A\e(B" "\e$(G!?!_!A\e(B")
-                         ("-" "\e$(0!7!9"#"$"1"@\e(B" "\e$(G!7!9"#"$"1"@\e(B")
-                         ("_" "\e$(0"%"&\e(B" "\e$(G"%"&\e(B")
-                         ("=" "\e$(0"8"C\e(B" "\e$(G"8"C\e(B")
-                         ("+" "\e$(0"0"?\e(B" "\e$(G"0"?\e(B"))))
-    (dolist (elt punctuations)
+    (let ((punctuation '((";" "\e$(0!'!2!"!#!.!/\e(B" "\e$(G!'!2!"!#!.!/\e(B")
+                        (":" "\e$(0!(!+!3!%!$!&!0!1\e(B" "\e$(G!(!+!3!%!$!&!0!1\e(B")
+                        ("'" "\e$(0!e!d\e(B" "\e$(G!e!d\e(B")
+                        ("\"" "\e$(0!g!f!h!i!q\e(B" "\e$(G!g!f!h!i!q\e(B")
+                        ("\\" "\e$(0"`"b#M\e(B" "\e$(G"`"b#M\e(B")
+                        ("|" "\e$(0!6!8!:"^\e(B" "\e$(G!6!8!:"^\e(B")
+                        ("/" "\e$(0"_"a#L\e(B" "\e$(G"_"a#L\e(B")
+                        ("?" "\e$(0!)!4\e(B" "\e$(G!)!4\e(B")
+                        ("<" "\e$(0!R"6"A!T"H\e(B" "\e$(G!R"6"A!T"H\e(B")
+                        (">" "\e$(0!S"7"B!U\e(B" "\e$(G!S"7"B!U\e(B")
+                        ("[" "\e$(0!F!J!b!H!L!V!Z!X!\\e(B" "\e$(G!F!J!b!H!L!V!Z!X!\\e(B")
+                        ("]" "\e$(0!G!K!c!I!M!W![!Y!]\e(B" "\e$(G!G!K!c!I!M!W![!Y!]\e(B")
+                        ("{" "\e$(0!B!`!D\e(B " "\e$(G!B!`!D\e(B ")
+                        ("}" "\e$(0!C!a!E\e(B" "\e$(G!C!a!E\e(B")
+                        ("`" "\e$(0!j!k\e(B" "\e$(G!j!k\e(B")
+                        ("~" "\e$(0"D"+",!<!=\e(B" "\e$(G"D"+",!<!=\e(B")
+                        ("!" "\e$(0!*!5\e(B" "\e$(G!*!5\e(B")
+                        ("@" "\e$(0"i"n\e(B" "\e$(G"i"n\e(B")
+                        ("#" "\e$(0!l"-\e(B" "\e$(G!l"-\e(B")
+                        ("$" "\e$(0"c"l\e(B" "\e$(G"c"l\e(B")
+                        ("%" "\e$(0"h"m\e(B" "\e$(G"h"m\e(B")
+                        ("&" "\e$(0!m".\e(B" "\e$(G!m".\e(B")
+                        ("*" "\e$(0!n"/!o!w!x\e(B" "\e$(G!n"/!o!w!x\e(B")
+                        ("(" "\e$(0!>!^!@\e(B" "\e$(G!>!^!@\e(B")
+                        (")" "\e$(0!?!_!A\e(B" "\e$(G!?!_!A\e(B")
+                        ("-" "\e$(0!7!9"#"$"1"@\e(B" "\e$(G!7!9"#"$"1"@\e(B")
+                        ("_" "\e$(0"%"&\e(B" "\e$(G"%"&\e(B")
+                        ("=" "\e$(0"8"C\e(B" "\e$(G"8"C\e(B")
+                        ("+" "\e$(0"0"?\e(B" "\e$(G"0"?\e(B"))))
+    (dolist (elt punctuation)
       (insert (format "(%S %S)\n" (concat "z" (car elt))
                      (if big5-p (nth 1 elt) (nth 2 elt))))))
     (insert ")\n")))
@@ -1017,7 +1015,7 @@ To input words of more than three letters, you type 4 keys, initials
 of the first three letters and the last letter.  For instance,
 \"bjdt\" inputs \e$A11>)5gJSL(\e(B.
 
-To input symbols and punctuations, type `/' followed by one of `a' to
+To input symbols and punctuation, type `/' followed by one of `a' to
 `z', then select one of the candidates."))
     (insert "  '((\"\C-?\" . quail-delete-last-char)
    (\".\" . quail-next-translation)
@@ -1153,10 +1151,9 @@ the generated Quail package is saved."
        (setq coding-system-for-write
              (coding-system-change-eol-conversion coding 'unix))
        (with-temp-file (expand-file-name quailfile dirname)
-         (insert (format ";; Quail package `%s' -*- coding:%s -*-\n"
-                          name coding))
-         (insert ";;   Generated by the command `miscdic-convert'\n")
-         (insert ";;   Date: " (current-time-string) "\n")
+         (insert (format-message ";; Quail package `%s'\n" name))
+         (insert (format-message
+                  ";;   Generated by the command `miscdic-convert'\n"))
          (insert ";;   Source dictionary file: " dicfile "\n")
          (insert ";;   Copyright notice of the source file\n")
          (insert ";;------------------------------------------------------\n")
@@ -1174,12 +1171,18 @@ the generated Quail package is saved."
                  (coding-system-change-eol-conversion coding 'unix))
                 (dicbuf (find-file-noselect filename)))
            (funcall converter dicbuf name title)
-           (kill-buffer dicbuf)))
+           (kill-buffer dicbuf))
+         (insert ";; Local Variables:\n"
+                 ";; version-control: never\n"
+                 ";; no-update-autoloads: t\n"
+                 (format ";; coding: %s\n" coding)
+                 ";; End:\n\n"
+                 ";;; " quailfile " ends here\n"))
        (message "Converting %s to %s...done" dicfile quailfile))
       (setq tail (cdr tail)))))
 
 (defun batch-miscdic-convert ()
-  "Run `miscdic-convert' on the files remaing on the command line.
+  "Run `miscdic-convert' on the files remaining on the command line.
 Use this from the command line, with `-batch';
 it won't work in an interactive Emacs.
 If there's an argument \"-dir\", the next argument specifies a directory
@@ -1204,8 +1207,7 @@ to store generated Quail packages."
        (miscdic-convert filename dir))))
   (kill-emacs 0))
 
-;; Local Variables:
-;; coding: iso-2022-7bit
-;; End:
+;; Prevent "Local Variables" above confusing Emacs.
+\f
 
 ;;; titdic-cnv.el ends here