;; 2005, 2006, 2007
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H14PRO021
+;; Copyright (C) 2003
+;; National Institute of Advanced Industrial Science and Technology (AIST)
+;; Registration Number H13PRO009
;; Keywords: Quail, TIT, cxterm
(princ ";; Quail package `")
(princ package)
- (princ "' -*- coding:iso-2022-7bit; ")
+ (princ (format "' -*- coding:%s; " coding-system-for-write))
(princ "byte-compile-disable-print-circle:t; -*-\n")
(princ ";; Generated by the command `titdic-convert'\n;;\tDate: ")
(princ (current-time-string))
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-unix))
+ (let ((coding-system-for-write nil))
(with-temp-file (tit-make-quail-package-file-name filename dirname)
- ;; Explicitly speficy eol format to `unix'.
- (set-buffer-file-coding-system 'iso-2022-7bit-unix)
(let ((standard-output (current-buffer)))
(with-temp-buffer
(set-buffer-multibyte nil)
(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)
+ ;; Explicitly set eol format to `unix'.
+ (setq coding-system-for-write
+ (coding-system-change-eol-conversion coding-system 'unix))
+ (remove-text-properties (point-min) (point-max) '(charset nil)))
+ (set-buffer-multibyte t)
;; 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 in multibyte mode.
- (with-current-buffer standard-output
- (set-buffer-multibyte t))
- (set-buffer-multibyte t)
+ ;; 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)
+ ;; Process the body part
(tit-process-body))))))
;;;###autoload
(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
slot
name title dicfile coding quailfile converter copyright
dicbuf)
converter (nth 5 slot)
copyright (nth 6 slot))
(message "Converting %s to %s..." dicfile quailfile)
+ ;; Explicitly set eol format to `unix'.
+ (setq coding-system-for-write
+ (coding-system-change-eol-conversion coding 'unix))
(with-temp-file (expand-file-name quailfile dirname)
- ;; Explicitly speficy eol format to `unix'.
- (set-buffer-file-coding-system 'iso-2022-7bit-unix)
- (insert ";; Quail package `" name "' -*- coding:iso-2022-7bit; ")
- (insert "byte-compile-disable-print-circle:t; -*-\n");
+ (insert (format ";; Quail package `%s' -*- coding:%s; " name coding))
+ (insert "byte-compile-disable-print-circle:t; -*-\n")
(insert ";; Generated by the command `miscdic-convert'\n")
(insert ";; Date: " (current-time-string) "\n")
(insert ";; Source dictionary file: " dicfile "\n")
(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)))
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))