diff options
| author | Kenichi Handa | 2009-02-13 12:37:53 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2009-02-13 12:37:53 +0000 |
| commit | 8b735b2b9981fa1d9ffd1658922d7fe826fa6372 (patch) | |
| tree | 07d049f823b32260c771045e79aa72d376e8ec1c | |
| parent | d324fa76e5e587232cdbf58beebf90d270d26abe (diff) | |
| download | emacs-8b735b2b9981fa1d9ffd1658922d7fe826fa6372.tar.gz emacs-8b735b2b9981fa1d9ffd1658922d7fe826fa6372.zip | |
(tit-process-header): Use
buffer-substring-no-properties instead of buffer-substring.
(tit-process-body): Likewise.
(tsang-quick-converter): Handle superfluous CR at eol.
(py-converter): Use buffer-substring-no-properties instead of
buffer-substring. Handle superfluous CR at eol.
(ziranma-converter): Likewise
(ctlau-converter): Likewise.
(miscdic-convert): Read a file without eol conversion.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/international/titdic-cnv.el | 54 |
2 files changed, 43 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0296ba443b6..1f0d0bf839f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2009-02-13 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * international/titdic-cnv.el (tit-process-header): Use | ||
| 4 | buffer-substring-no-properties instead of buffer-substring. | ||
| 5 | (tit-process-body): Likewise. | ||
| 6 | (tsang-quick-converter): Handle superfluous CR at eol. | ||
| 7 | (py-converter): Use buffer-substring-no-properties instead of | ||
| 8 | buffer-substring. Handle superfluous CR at eol. | ||
| 9 | (ziranma-converter): Likewise | ||
| 10 | (ctlau-converter): Likewise. | ||
| 11 | (miscdic-convert): Read a file without eol conversion. | ||
| 12 | |||
| 1 | 2009-02-13 Juanma Barranquero <lekktu@gmail.com> | 13 | 2009-02-13 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 14 | ||
| 3 | * minibuffer.el (internal-complete-buffer-except): Doc fix. (Bug#2315) | 15 | * minibuffer.el (internal-complete-buffer-except): Doc fix. (Bug#2315) |
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 470fc623c69..749af106758 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el | |||
| @@ -290,8 +290,9 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy | |||
| 290 | (cond ((looking-at "COMMENT") | 290 | (cond ((looking-at "COMMENT") |
| 291 | (let ((pos (match-end 0))) | 291 | (let ((pos (match-end 0))) |
| 292 | (end-of-line) | 292 | (end-of-line) |
| 293 | (setq tit-comments (cons (buffer-substring pos (point)) | 293 | (setq tit-comments |
| 294 | tit-comments)))))) | 294 | (cons (buffer-substring-no-properties pos (point)) |
| 295 | tit-comments)))))) | ||
| 295 | ((= ch ?M) ; MULTICHOICE, MOVERIGHT, MOVELEFT | 296 | ((= ch ?M) ; MULTICHOICE, MOVERIGHT, MOVELEFT |
| 296 | (cond ((looking-at "MULTICHOICE:[ \t]*") | 297 | (cond ((looking-at "MULTICHOICE:[ \t]*") |
| 297 | (goto-char (match-end 0)) | 298 | (goto-char (match-end 0)) |
| @@ -335,7 +336,7 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy | |||
| 335 | tit-keyprompt))))))) | 336 | tit-keyprompt))))))) |
| 336 | (end-of-line) | 337 | (end-of-line) |
| 337 | (princ ";; ") | 338 | (princ ";; ") |
| 338 | (princ (buffer-substring pos (point))) | 339 | (princ (buffer-substring-no-properties pos (point))) |
| 339 | (princ "\n") | 340 | (princ "\n") |
| 340 | (forward-line 1))) | 341 | (forward-line 1))) |
| 341 | 342 | ||
| @@ -431,7 +432,7 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy | |||
| 431 | (forward-line 1) | 432 | (forward-line 1) |
| 432 | (setq pos (point)) | 433 | (setq pos (point)) |
| 433 | (skip-chars-forward "^ \t\n") | 434 | (skip-chars-forward "^ \t\n") |
| 434 | (setq key (buffer-substring pos (point))) | 435 | (setq key (buffer-substring-no-properties pos (point))) |
| 435 | (skip-chars-forward " \t") | 436 | (skip-chars-forward " \t") |
| 436 | (setq ch (following-char)) | 437 | (setq ch (following-char)) |
| 437 | (if (or (= ch ?#) (= ch ?\n)) | 438 | (if (or (= ch ?#) (= ch ?\n)) |
| @@ -450,12 +451,13 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy | |||
| 450 | (setq translations | 451 | (setq translations |
| 451 | (if translations | 452 | (if translations |
| 452 | (concat translations | 453 | (concat translations |
| 453 | (buffer-substring pos (point))) | 454 | (buffer-substring-no-properties pos (point))) |
| 454 | (buffer-substring pos (point))))) | 455 | (buffer-substring-no-properties pos (point))))) |
| 455 | (while (not (eolp)) | 456 | (while (not (eolp)) |
| 456 | (setq pos (point)) | 457 | (setq pos (point)) |
| 457 | (skip-chars-forward "^ \t\n") | 458 | (skip-chars-forward "^ \t\n") |
| 458 | (setq translations (cons (buffer-substring pos (point)) | 459 | (setq translations (cons (buffer-substring-no-properties |
| 460 | pos (point)) | ||
| 459 | translations)) | 461 | translations)) |
| 460 | (skip-chars-forward " \t") | 462 | (skip-chars-forward " \t") |
| 461 | (setq ch (following-char)) | 463 | (setq ch (following-char)) |
| @@ -778,9 +780,6 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." | |||
| 778 | ;; Handle double CR line ends, which result when checking out of | 780 | ;; Handle double CR line ends, which result when checking out of |
| 779 | ;; CVS on MS-Windows. | 781 | ;; CVS on MS-Windows. |
| 780 | (goto-char (point-min)) | 782 | (goto-char (point-min)) |
| 781 | (while (re-search-forward "\r\r$" nil t) | ||
| 782 | (replace-match "")) | ||
| 783 | (goto-char (point-min)) | ||
| 784 | (search-forward "A440") | 783 | (search-forward "A440") |
| 785 | (beginning-of-line) | 784 | (beginning-of-line) |
| 786 | (let ((table (make-hash-table :test 'equal)) | 785 | (let ((table (make-hash-table :test 'equal)) |
| @@ -789,13 +788,13 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"." | |||
| 789 | (forward-char 5) | 788 | (forward-char 5) |
| 790 | (let ((trans (char-to-string (following-char))) | 789 | (let ((trans (char-to-string (following-char))) |
| 791 | key slot) | 790 | key slot) |
| 792 | (re-search-forward "[A-Z]+$" nil t) | 791 | (re-search-forward "\\([A-Z]+\\)\r*$" nil t) |
| 793 | (setq key (downcase | 792 | (setq key (downcase |
| 794 | (if (or tsang-p | 793 | (if (or tsang-p |
| 795 | (<= (- (match-end 0) (match-beginning 0)) 1)) | 794 | (<= (- (match-end 1) (match-beginning 1)) 1)) |
| 796 | (match-string 0) | 795 | (match-string 1) |
| 797 | (string (char-after (match-beginning 0)) | 796 | (string (char-after (match-beginning 1)) |
| 798 | (char-after (1- (match-end 0))))))) | 797 | (char-after (1- (match-end 1))))))) |
| 799 | (setq val (gethash key table)) | 798 | (setq val (gethash key table)) |
| 800 | (if val (setq trans (concat val trans))) | 799 | (if val (setq trans (concat val trans))) |
| 801 | (puthash key trans table) | 800 | (puthash key trans table) |
| @@ -909,7 +908,7 @@ method `chinese-tonepy' with which you must specify tones by digits | |||
| 909 | nil nil nil nil)\n\n") | 908 | nil nil nil nil)\n\n") |
| 910 | (insert "(quail-define-rules\n") | 909 | (insert "(quail-define-rules\n") |
| 911 | (let ((pos (point))) | 910 | (let ((pos (point))) |
| 912 | (insert-buffer-substring dicbuf) | 911 | (insert-buffer-substring-no-properties dicbuf) |
| 913 | (goto-char pos) | 912 | (goto-char pos) |
| 914 | (re-search-forward "^[a-z]") | 913 | (re-search-forward "^[a-z]") |
| 915 | (beginning-of-line) | 914 | (beginning-of-line) |
| @@ -920,6 +919,8 @@ method `chinese-tonepy' with which you must specify tones by digits | |||
| 920 | (insert "\" \"") | 919 | (insert "\" \"") |
| 921 | (delete-char 1) | 920 | (delete-char 1) |
| 922 | (end-of-line) | 921 | (end-of-line) |
| 922 | (while (= (preceding-char) ?\r) | ||
| 923 | (delete-char -1)) | ||
| 923 | (insert "\")") | 924 | (insert "\")") |
| 924 | (forward-line 1))) | 925 | (forward-line 1))) |
| 925 | (insert ")\n")) | 926 | (insert ")\n")) |
| @@ -933,15 +934,18 @@ method `chinese-tonepy' with which you must specify tones by digits | |||
| 933 | (save-excursion | 934 | (save-excursion |
| 934 | (set-buffer dicbuf) | 935 | (set-buffer dicbuf) |
| 935 | (goto-char (point-min)) | 936 | (goto-char (point-min)) |
| 936 | (search-forward "%keyname end\n") | 937 | (search-forward "\n%keyname end") |
| 938 | (forward-line 1) | ||
| 937 | (let ((table (make-hash-table :test 'equal)) | 939 | (let ((table (make-hash-table :test 'equal)) |
| 938 | elt pos key trans val) | 940 | elt pos key trans val) |
| 939 | (while (not (eobp)) | 941 | (while (not (eobp)) |
| 940 | (setq pos (point)) | 942 | (setq pos (point)) |
| 941 | (skip-chars-forward "^ \t") | 943 | (skip-chars-forward "^ \t") |
| 942 | (setq key (buffer-substring pos (point))) | 944 | (setq key (buffer-substring-no-properties pos (point))) |
| 943 | (skip-chars-forward " \t") | 945 | (skip-chars-forward " \t") |
| 944 | (setq trans (vector (buffer-substring (point) (line-end-position)))) | 946 | (setq pos (point)) |
| 947 | (skip-chars-forward "^\r\n") | ||
| 948 | (setq trans (vector (buffer-substring-no-properties pos (point)))) | ||
| 945 | (setq val (gethash key table)) | 949 | (setq val (gethash key table)) |
| 946 | (if val (setq trans (vconcat val trans))) | 950 | (if val (setq trans (vconcat val trans))) |
| 947 | (puthash key trans table) | 951 | (puthash key trans table) |
| @@ -1051,12 +1055,13 @@ To input symbols and punctuations, type `/' followed by one of `a' to | |||
| 1051 | (save-excursion | 1055 | (save-excursion |
| 1052 | (set-buffer dicbuf) | 1056 | (set-buffer dicbuf) |
| 1053 | (goto-char (point-min)) | 1057 | (goto-char (point-min)) |
| 1054 | (search-forward "#\n#<hr>\n") | 1058 | (re-search-forward "^#<hr>") |
| 1059 | (forward-line 1) | ||
| 1055 | (setq dicbuf-start (point)) | 1060 | (setq dicbuf-start (point)) |
| 1056 | (goto-char (point-max)) | 1061 | (goto-char (point-max)) |
| 1057 | (forward-line -1) | 1062 | (re-search-backward "^<hr>") |
| 1058 | (setq dicbuf-end (point))) | 1063 | (setq dicbuf-end (point))) |
| 1059 | (insert-buffer-substring dicbuf dicbuf-start dicbuf-end) | 1064 | (insert-buffer-substring-no-properties dicbuf dicbuf-start dicbuf-end) |
| 1060 | ;; CTLau-b5.html contains characters (0xa1 0xbc) which show up as | 1065 | ;; CTLau-b5.html contains characters (0xa1 0xbc) which show up as |
| 1061 | ;; hollow boxes when the original characters in CTLau.html from | 1066 | ;; hollow boxes when the original characters in CTLau.html from |
| 1062 | ;; which the file is converted have no Big5 equivalent. Go | 1067 | ;; which the file is converted have no Big5 equivalent. Go |
| @@ -1078,6 +1083,8 @@ To input symbols and punctuations, type `/' followed by one of `a' to | |||
| 1078 | (insert "\" \"") | 1083 | (insert "\" \"") |
| 1079 | (delete-char 1) | 1084 | (delete-char 1) |
| 1080 | (end-of-line) | 1085 | (end-of-line) |
| 1086 | (while (= (preceding-char) ?\r) | ||
| 1087 | (delete-char -1)) | ||
| 1081 | (insert "\")") | 1088 | (insert "\")") |
| 1082 | (forward-line 1))) | 1089 | (forward-line 1))) |
| 1083 | (insert ")\n")) | 1090 | (insert ")\n")) |
| @@ -1168,7 +1175,8 @@ the generated Quail package is saved." | |||
| 1168 | (if (eq coding 'iso-2022-cn-ext) "Chinese-CNS" | 1175 | (if (eq coding 'iso-2022-cn-ext) "Chinese-CNS" |
| 1169 | "Chinese-GB")) | 1176 | "Chinese-GB")) |
| 1170 | "\" \"" title "\" t\n") | 1177 | "\" \"" title "\" t\n") |
| 1171 | (let* ((coding-system-for-read coding) | 1178 | (let* ((coding-system-for-read |
| 1179 | (coding-system-change-eol-conversion coding 'unix)) | ||
| 1172 | (dicbuf (find-file-noselect filename))) | 1180 | (dicbuf (find-file-noselect filename))) |
| 1173 | (funcall converter dicbuf name title) | 1181 | (funcall converter dicbuf name title) |
| 1174 | (kill-buffer dicbuf))) | 1182 | (kill-buffer dicbuf))) |