changeset 46670:7de6082f2633

Doc fixes. (tit-process-header): Add coding cookie. (titdic-convert): Force writing as iso-2022-7bit.
author Dave Love <fx@gnu.org>
date Wed, 24 Jul 2002 22:18:11 +0000
parents 2e1d0030538f
children 1c5996975536
files lisp/international/titdic-cnv.el
diffstat 1 files changed, 47 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/titdic-cnv.el	Wed Jul 24 19:58:44 2002 +0000
+++ b/lisp/international/titdic-cnv.el	Wed Jul 24 22:18:11 2002 +0000
@@ -1,4 +1,4 @@
-;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package
+;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package -*- coding:iso-2022-7bit; -*-
 
 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
 ;; Licensed to the Free Software Foundation.
@@ -73,7 +73,7 @@
 ;; dictionary.  The extra docstring in this alist is to add more
 ;; information.
 ;; The command describe-input-method shows the automatically generated
-;; docstring, then an extra docstrings while replacing the form \<VAR>
+;; docstring, then an extra docstring while replacing the form \<VAR>
 ;; by the value of variable VAR.  For instance, the form
 ;; \<quail-translation-docstring> is replaced by a description about
 ;; how to select a translation from a list of candidates.
@@ -84,7 +84,7 @@
     ("chinese-ccdospy" "$AKuF4(B"
      "Pinyin base input method for Chinese charset GB2312 \(`chinese-gb2312').
 
-Pinyin is the standared roman transliteration method for Chinese.
+Pinyin is the standard Roman transliteration method for Chinese.
 For the detail of Pinyin system, see the documentation of the input
 method `chinese-py'.
 
@@ -92,7 +92,7 @@
 difference is that you type a single key for these Pinyin spelling.
     Pinyin:  zh  en  eng ang ch  an  ao  ai  ong sh  ing  yu($A(9(B)
     keyseq:   a   f   g   h   i   j   k   l   s   u   y   v
-For expample:
+For example:
     Chinese:  $A0!(B    $A9{(B    $AVP(B    $AND(B    $A9b(B    $ASq(B    $AH+(B
     Pinyin:   a    guo   zhong  wen  guang  yu   quan
     Keyseq:   a1   guo4   as1   wf4  guh1  yu..6 qvj6
@@ -267,8 +267,8 @@
 	(tit-keyprompt nil))
 
     (princ ";; Quail package `")
-    (princ package)
-    (princ "' generated by the command `titdic-convert'\n;;\tDate: ")
+    (princ package) (princ "' -*- coding:iso-2022-7bit; -*-\n")
+    (princ ";;   Generated by the command `titdic-convert'\n;;\tDate: ")
     (princ (current-time-string))
     (princ "\n;;\tOriginal TIT dictionary file: ")
     (princ (file-name-nondirectory filename))
@@ -465,50 +465,51 @@
 Optional argument DIRNAME if specified is the directory name under which
 the generated Quail package is saved."
   (interactive "FTIT dictionary file: ")
-  (with-temp-file  (tit-make-quail-package-file-name filename dirname)
-    (set-buffer-file-coding-system 'iso-2022-7bit)
-    (let ((standard-output (current-buffer)))
-      (with-temp-buffer
-	(let ((coding-system-for-read 'no-conversion))
-	  (insert-file-contents (expand-file-name filename)))
-	(set-buffer-multibyte t)
+  (let ((coding-system-for-write 'iso-2022-7bit))
+    (with-temp-file  (tit-make-quail-package-file-name filename dirname)
+      (set-buffer-file-coding-system 'iso-2022-7bit)
+      (let ((standard-output (current-buffer)))
+	(with-temp-buffer
+	  (set-buffer-multibyte nil)
+	  (let ((coding-system-for-read 'no-conversion))
+	    (insert-file-contents (expand-file-name filename)))
 	
-	;; Decode the buffer contents from the encoding specified by a
-	;; value of the key "ENCODE:".
-	(if (not (search-forward "\nBEGIN" nil t))
-	    (error "TIT dictionary doesn't have body part"))
-	(let ((limit (point))
-	      coding-system slot)
+	  ;; Decode the buffer contents from the encoding specified by a
+	  ;; value of the key "ENCODE:".
+	  (if (not (search-forward "\nBEGIN" nil t))
+	      (error "TIT dictionary doesn't have body part"))
+	  (let ((limit (point))
+		coding-system slot)
+	    (goto-char (point-min))
+	    (if (re-search-forward "^ENCODE:[ \t]*" limit t)
+		(progn
+		  (goto-char (match-end 0))
+		  (setq tit-encode (tit-read-key-value)))
+	      (setq tit-encode tit-default-encode))
+	    (setq slot (assoc tit-encode tit-encode-list))
+	    (if (not slot)
+		(error "Invalid ENCODE: value in TIT dictionary"))
+	    (setq coding-system (nth 1 slot))
+	    (message "Decoding with coding system %s..." coding-system)
+	    (goto-char (point-min))
+	    (decode-coding-region (point-min) (point-max) coding-system))
+
+	  ;; Set point the starting position of the body part.
 	  (goto-char (point-min))
-	  (if (re-search-forward "^ENCODE:[ \t]*" limit t)
-	      (progn
-		(goto-char (match-end 0))
-		(setq tit-encode (tit-read-key-value)))
-	    (setq tit-encode tit-default-encode))
-	  (setq slot (assoc tit-encode tit-encode-list))
-	  (if (not slot)
-	      (error "Invalid ENCODE: value in TIT dictionary"))
-	  (setq coding-system (nth 1 slot))
-	  (message "Decoding with coding system %s..." coding-system)
-	  (goto-char (point-min))
-	  (decode-coding-region (point-min) (point-max) coding-system))
+	  (if (not (search-forward "\nBEGIN" nil t))
+	      (error "TIT dictionary can't be decoded correctly"))
 
-	;; Set point the starting position of the body part.
-	(goto-char (point-min))
-	(if (not (search-forward "\nBEGIN" nil t))
-	    (error "TIT dictionary can't be decoded correctly"))
+	  ;; Process the header part.
+	  (forward-line 1)
+	  (narrow-to-region (point-min) (point))
+	  (tit-process-header filename)
+	  (widen)
 
-	;; Process the header part.
-	(forward-line 1)
-	(narrow-to-region (point-min) (point))
-	(tit-process-header filename)
-	(widen)
-
-	;; Process the body part.  For speed, we turn off multibyte facility.
-	(with-current-buffer standard-output
-	  (set-buffer-multibyte nil))
-	(set-buffer-multibyte nil)
-	(tit-process-body)))))
+	  ;; Process the body part.  For speed, we turn off multibyte facility.
+	  (with-current-buffer standard-output
+	    (set-buffer-multibyte nil))
+	  (set-buffer-multibyte nil)
+	  (tit-process-body))))))
 
 ;;;###autoload
 (defun batch-titdic-convert (&optional force)