changeset 90030:f624e8fd4723

(tit-process-header): Fix embedded coding tag. (titdic-convert): Bind coding-system-for-write to the coding system specfied in the map file. Remove `charset' property after decoding. (miscdic-convert): Bind coding-system-for-write to the coding system specfied for the map file. Fix LANGUAGE arg to quail-define-package. (batch-miscdic-convert): Check if a file is directory or not.
author Kenichi Handa <handa@m17n.org>
date Tue, 19 Oct 2004 11:09:12 +0000
parents 5658507496a1
children c5bec160ee85
files lisp/international/titdic-cnv.el
diffstat 1 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/titdic-cnv.el	Sat Oct 16 00:25:26 2004 +0000
+++ b/lisp/international/titdic-cnv.el	Tue Oct 19 11:09:12 2004 +0000
@@ -270,7 +270,8 @@
 	(tit-keyprompt nil))
 
     (princ ";; Quail package `")
-    (princ package) (princ "' -*- coding:iso-2022-7bit; -*-\n")
+    (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: ")
@@ -468,9 +469,8 @@
 Optional argument DIRNAME if specified is the directory name under which
 the generated Quail package is saved."
   (interactive "FTIT dictionary file: ")
-  (let ((coding-system-for-write 'iso-2022-7bit))
+  (let ((coding-system-for-write nil))
     (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)
@@ -495,7 +495,9 @@
 	    (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))
+	    (decode-coding-region (point-min) (point-max) coding-system)
+	    (setq coding-system-for-write coding-system)
+	    (remove-text-properties (point-min) (point-max) '(charset nil)))
 
 	  (set-buffer-multibyte t)
 	  ;; Set point the starting position of the body part.
@@ -1106,8 +1108,7 @@
   (or (file-readable-p filename)
       (error "%s does not exist" filename))
   (let ((tail quail-misc-package-ext-info)
-	(default-buffer-file-coding-system 'iso-2022-7bit)
-	(coding-system-for-write 'iso-2022-7bit)
+	coding-system-for-write
 	slot
 	name title dicfile coding quailfile converter copyright
 	dicbuf)
@@ -1134,9 +1135,10 @@
 	      converter (nth 5 slot)
 	      copyright (nth 6 slot))
 	(message "Converting %s to %s..." dicfile quailfile)
+	(setq coding-system-for-write coding)
 	(with-temp-file (expand-file-name quailfile dirname)
-	  (set-buffer-file-coding-system 'iso-2022-7bit)
-	  (insert ";; Quail package `" name "' -*- coding:iso-2022-7bit; -*-\n")
+	  (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 ";;   Source dictionary file: " dicfile "\n")
@@ -1148,7 +1150,9 @@
 	  (insert ";;; Code:\n\n")
 	  (insert "(require 'quail)\n")
 	  (insert "(quail-define-package \"" name "\" \""
-		  (if (eq coding 'big5) "Chinese-BIG5" "Chinese-CNS")
+		  (if (eq coding 'big5) "Chinese-BIG5"
+		    (if (eq coding 'iso-2022-cn-ext) "Chinese-CNS"
+		      "Chinese-GB"))
 		  "\" \"" title "\" t\n")
 	  (let* ((coding-system-for-read coding)
 		 (dicbuf (find-file-noselect filename)))
@@ -1178,7 +1182,8 @@
 	    command-line-args-left (cdr command-line-args-left))
       (if (file-directory-p filename)
 	  (dolist (file (directory-files filename t nil t))
-	    (miscdic-convert file dir))
+	    (or (file-directory-p file)
+		(miscdic-convert file dir)))
 	(miscdic-convert filename dir))))
   (kill-emacs 0))