aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2004-10-19 11:09:12 +0000
committerKenichi Handa2004-10-19 11:09:12 +0000
commit98223b7320eb3e4e4770067e6e668b11947edc25 (patch)
tree8167796f9f600039980884e9d1c6aeb73d6c3e5b
parent4792e554eea7e511c2c17726ec383b2f95691fa2 (diff)
downloademacs-98223b7320eb3e4e4770067e6e668b11947edc25.tar.gz
emacs-98223b7320eb3e4e4770067e6e668b11947edc25.zip
(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.
-rw-r--r--lisp/international/titdic-cnv.el25
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index 2891dcca52d..e5772fdec00 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -270,7 +270,8 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy
270 (tit-keyprompt nil)) 270 (tit-keyprompt nil))
271 271
272 (princ ";; Quail package `") 272 (princ ";; Quail package `")
273 (princ package) (princ "' -*- coding:iso-2022-7bit; -*-\n") 273 (princ package)
274 (princ (format "' -*- coding:%s; -*-\n" coding-system-for-write))
274 (princ ";; Generated by the command `titdic-convert'\n;;\tDate: ") 275 (princ ";; Generated by the command `titdic-convert'\n;;\tDate: ")
275 (princ (current-time-string)) 276 (princ (current-time-string))
276 (princ "\n;;\tOriginal TIT dictionary file: ") 277 (princ "\n;;\tOriginal TIT dictionary file: ")
@@ -468,9 +469,8 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy
468Optional argument DIRNAME if specified is the directory name under which 469Optional argument DIRNAME if specified is the directory name under which
469the generated Quail package is saved." 470the generated Quail package is saved."
470 (interactive "FTIT dictionary file: ") 471 (interactive "FTIT dictionary file: ")
471 (let ((coding-system-for-write 'iso-2022-7bit)) 472 (let ((coding-system-for-write nil))
472 (with-temp-file (tit-make-quail-package-file-name filename dirname) 473 (with-temp-file (tit-make-quail-package-file-name filename dirname)
473 (set-buffer-file-coding-system 'iso-2022-7bit)
474 (let ((standard-output (current-buffer))) 474 (let ((standard-output (current-buffer)))
475 (with-temp-buffer 475 (with-temp-buffer
476 (set-buffer-multibyte nil) 476 (set-buffer-multibyte nil)
@@ -495,7 +495,9 @@ the generated Quail package is saved."
495 (setq coding-system (nth 1 slot)) 495 (setq coding-system (nth 1 slot))
496 (message "Decoding with coding system %s..." coding-system) 496 (message "Decoding with coding system %s..." coding-system)
497 (goto-char (point-min)) 497 (goto-char (point-min))
498 (decode-coding-region (point-min) (point-max) coding-system)) 498 (decode-coding-region (point-min) (point-max) coding-system)
499 (setq coding-system-for-write coding-system)
500 (remove-text-properties (point-min) (point-max) '(charset nil)))
499 501
500 (set-buffer-multibyte t) 502 (set-buffer-multibyte t)
501 ;; Set point the starting position of the body part. 503 ;; Set point the starting position of the body part.
@@ -1106,8 +1108,7 @@ the generated Quail package is saved."
1106 (or (file-readable-p filename) 1108 (or (file-readable-p filename)
1107 (error "%s does not exist" filename)) 1109 (error "%s does not exist" filename))
1108 (let ((tail quail-misc-package-ext-info) 1110 (let ((tail quail-misc-package-ext-info)
1109 (default-buffer-file-coding-system 'iso-2022-7bit) 1111 coding-system-for-write
1110 (coding-system-for-write 'iso-2022-7bit)
1111 slot 1112 slot
1112 name title dicfile coding quailfile converter copyright 1113 name title dicfile coding quailfile converter copyright
1113 dicbuf) 1114 dicbuf)
@@ -1134,9 +1135,10 @@ the generated Quail package is saved."
1134 converter (nth 5 slot) 1135 converter (nth 5 slot)
1135 copyright (nth 6 slot)) 1136 copyright (nth 6 slot))
1136 (message "Converting %s to %s..." dicfile quailfile) 1137 (message "Converting %s to %s..." dicfile quailfile)
1138 (setq coding-system-for-write coding)
1137 (with-temp-file (expand-file-name quailfile dirname) 1139 (with-temp-file (expand-file-name quailfile dirname)
1138 (set-buffer-file-coding-system 'iso-2022-7bit) 1140 (insert (format ";; Quail package `%s' -*- coding:%s; -*-\n"
1139 (insert ";; Quail package `" name "' -*- coding:iso-2022-7bit; -*-\n") 1141 name coding))
1140 (insert ";; Generated by the command `miscdic-convert'\n") 1142 (insert ";; Generated by the command `miscdic-convert'\n")
1141 (insert ";; Date: " (current-time-string) "\n") 1143 (insert ";; Date: " (current-time-string) "\n")
1142 (insert ";; Source dictionary file: " dicfile "\n") 1144 (insert ";; Source dictionary file: " dicfile "\n")
@@ -1148,7 +1150,9 @@ the generated Quail package is saved."
1148 (insert ";;; Code:\n\n") 1150 (insert ";;; Code:\n\n")
1149 (insert "(require 'quail)\n") 1151 (insert "(require 'quail)\n")
1150 (insert "(quail-define-package \"" name "\" \"" 1152 (insert "(quail-define-package \"" name "\" \""
1151 (if (eq coding 'big5) "Chinese-BIG5" "Chinese-CNS") 1153 (if (eq coding 'big5) "Chinese-BIG5"
1154 (if (eq coding 'iso-2022-cn-ext) "Chinese-CNS"
1155 "Chinese-GB"))
1152 "\" \"" title "\" t\n") 1156 "\" \"" title "\" t\n")
1153 (let* ((coding-system-for-read coding) 1157 (let* ((coding-system-for-read coding)
1154 (dicbuf (find-file-noselect filename))) 1158 (dicbuf (find-file-noselect filename)))
@@ -1178,7 +1182,8 @@ to store generated Quail packages."
1178 command-line-args-left (cdr command-line-args-left)) 1182 command-line-args-left (cdr command-line-args-left))
1179 (if (file-directory-p filename) 1183 (if (file-directory-p filename)
1180 (dolist (file (directory-files filename t nil t)) 1184 (dolist (file (directory-files filename t nil t))
1181 (miscdic-convert file dir)) 1185 (or (file-directory-p file)
1186 (miscdic-convert file dir)))
1182 (miscdic-convert filename dir)))) 1187 (miscdic-convert filename dir))))
1183 (kill-emacs 0)) 1188 (kill-emacs 0))
1184 1189