diff options
| author | Kenichi Handa | 2003-03-18 04:23:50 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-03-18 04:23:50 +0000 |
| commit | 6053d86a69a1cb1810cb417181236fee0f228d37 (patch) | |
| tree | ff1fcbbfa6c3b0ff5f86f7e68ea93617129e5a6e | |
| parent | 701117d5c676f42b2552132e6450b6651f980b8b (diff) | |
| download | emacs-6053d86a69a1cb1810cb417181236fee0f228d37.tar.gz emacs-6053d86a69a1cb1810cb417181236fee0f228d37.zip | |
(find-coding-systems-for-charsets):
Use find-coding-systems-string instead of looking up
char-coding-system-table.
| -rw-r--r-- | lisp/international/mule-cmds.el | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 3aa900fb329..82c9af33161 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -483,7 +483,10 @@ element `undecided'." | |||
| 483 | 483 | ||
| 484 | (defun find-coding-systems-for-charsets (charsets) | 484 | (defun find-coding-systems-for-charsets (charsets) |
| 485 | "Return a list of proper coding systems to encode characters of CHARSETS. | 485 | "Return a list of proper coding systems to encode characters of CHARSETS. |
| 486 | CHARSETS is a list of character sets." | 486 | CHARSETS is a list of character sets. |
| 487 | It actually checks at most the first 96 characters of each charset. | ||
| 488 | So, if a charset of dimension two is included in CHARSETS, the value may | ||
| 489 | contain a coding system that can't encode all characters of the charset." | ||
| 487 | (cond ((or (null charsets) | 490 | (cond ((or (null charsets) |
| 488 | (and (= (length charsets) 1) | 491 | (and (= (length charsets) 1) |
| 489 | (eq 'ascii (car charsets)))) | 492 | (eq 'ascii (car charsets)))) |
| @@ -493,21 +496,31 @@ CHARSETS is a list of character sets." | |||
| 493 | '(raw-text emacs-mule)) | 496 | '(raw-text emacs-mule)) |
| 494 | (t | 497 | (t |
| 495 | (let ((codings t) | 498 | (let ((codings t) |
| 496 | charset l ll) | 499 | charset l str) |
| 497 | (while (and codings charsets) | 500 | (while (and codings charsets) |
| 498 | (setq charset (car charsets) charsets (cdr charsets)) | 501 | (setq charset (car charsets) charsets (cdr charsets)) |
| 499 | (unless (eq charset 'ascii) | 502 | (unless (eq charset 'ascii) |
| 500 | (setq l (aref char-coding-system-table (make-char charset))) | 503 | (setq str (make-string 96 32)) |
| 504 | (if (= (charset-dimension charset) 1) | ||
| 505 | (if (= (charset-chars charset) 96) | ||
| 506 | (dotimes (i 96) | ||
| 507 | (aset str i (make-char charset (+ i 32)))) | ||
| 508 | (dotimes (i 94) | ||
| 509 | (aset str i (make-char charset (+ i 33))))) | ||
| 510 | (if (= (charset-chars charset) 96) | ||
| 511 | (dotimes (i 96) | ||
| 512 | (aset str i (make-char charset 32 (+ i 32)))) | ||
| 513 | (dotimes (i 94) | ||
| 514 | (aset str i (make-char charset 33 (+ i 33)))))) | ||
| 515 | (setq l (find-coding-systems-string str)) | ||
| 501 | (if (eq codings t) | 516 | (if (eq codings t) |
| 502 | (setq codings l) | 517 | (setq codings l) |
| 503 | (let ((ll nil)) | 518 | (let ((ll nil)) |
| 504 | (while codings | 519 | (dolist (elt codings) |
| 505 | (if (memq (car codings) l) | 520 | (if (memq elt l) |
| 506 | (setq ll (cons (car codings) ll))) | 521 | (setq ll (cons elt ll)))) |
| 507 | (setq codings (cdr codings))) | ||
| 508 | (setq codings ll))))) | 522 | (setq codings ll))))) |
| 509 | (append codings | 523 | codings)))) |
| 510 | (char-table-extra-slot char-coding-system-table 0)))))) | ||
| 511 | 524 | ||
| 512 | (defun find-multibyte-characters (from to &optional maxcount excludes) | 525 | (defun find-multibyte-characters (from to &optional maxcount excludes) |
| 513 | "Find multibyte characters in the region specified by FROM and TO. | 526 | "Find multibyte characters in the region specified by FROM and TO. |