diff options
| author | Kenichi Handa | 2003-06-05 23:18:23 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-06-05 23:18:23 +0000 |
| commit | 5d75f46fcaeca06eadbce0c7719ad490511ef5c9 (patch) | |
| tree | 3e53a575d517006da0211f04e55b9a78eaf829e6 | |
| parent | c1ebafd6b3845a2919ea214b5fe0f7afcc072207 (diff) | |
| download | emacs-5d75f46fcaeca06eadbce0c7719ad490511ef5c9.tar.gz emacs-5d75f46fcaeca06eadbce0c7719ad490511ef5c9.zip | |
(set-coding-priority): Re-written.
(make-translation-table): Re-written.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/international/mule.el | 86 |
2 files changed, 32 insertions, 59 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3366d023a09..1163222dbbb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2003-06-06 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * international/mule.el (set-coding-priority): Re-written. | ||
| 4 | (make-translation-table): Re-written. | ||
| 5 | |||
| 1 | 2003-06-05 Kenichi Handa <handa@m17n.org> | 6 | 2003-06-05 Kenichi Handa <handa@m17n.org> |
| 2 | 7 | ||
| 3 | * font-lock.el | 8 | * font-lock.el |
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 5d6f481f556..687a58b94ac 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -615,7 +615,6 @@ encoding. This attribute has a meaning only when `:coding-type' is | |||
| 615 | ((eq coding-type 'utf-16) | 615 | ((eq coding-type 'utf-16) |
| 616 | '(:bom | 616 | '(:bom |
| 617 | :endian)) | 617 | :endian)) |
| 618 | ;; Fixme: CCL definition is broken. | ||
| 619 | ((eq coding-type 'ccl) | 618 | ((eq coding-type 'ccl) |
| 620 | '(:ccl-decoder | 619 | '(:ccl-decoder |
| 621 | :ccl-encoder | 620 | :ccl-encoder |
| @@ -928,28 +927,14 @@ This setting is effective for the next communication only." | |||
| 928 | 927 | ||
| 929 | (setq next-selection-coding-system coding-system)) | 928 | (setq next-selection-coding-system coding-system)) |
| 930 | 929 | ||
| 931 | ;; Fixme: Should this just go? | ||
| 932 | (defun set-coding-priority (arg) | 930 | (defun set-coding-priority (arg) |
| 933 | "Set priority of coding categories according to ARG. | 931 | "Set priority of coding categories according to ARG. |
| 934 | ARG is a list of coding categories ordered by priority. | 932 | ARG is a list of coding categories ordered by priority. |
| 935 | 933 | ||
| 936 | This function is provided for backward compatibility. | 934 | This function is provided for backward compatibility. |
| 937 | Now we have more convenient function `set-coding-system-priority'." | 935 | Now we have more convenient function `set-coding-system-priority'." |
| 938 | (let ((l arg) | 936 | (apply 'set-coding-system-priority |
| 939 | (current-list (copy-sequence coding-category-list))) | 937 | (mapcar #'(lambda (x) (symbol-value x)) arg))) |
| 940 | ;; Check the validity of ARG while deleting coding categories in | ||
| 941 | ;; ARG from CURRENT-LIST. We assume that CODING-CATEGORY-LIST | ||
| 942 | ;; contains all coding categories. | ||
| 943 | (while l | ||
| 944 | (if (or (null (get (car l) 'coding-category-index)) | ||
| 945 | (null (memq (car l) current-list))) | ||
| 946 | (error "Invalid or duplicated element in argument: %s" arg)) | ||
| 947 | (setq current-list (delq (car l) current-list)) | ||
| 948 | (setq l (cdr l))) | ||
| 949 | ;; Update `coding-category-list' and return it. | ||
| 950 | (setq coding-category-list (append arg current-list)) | ||
| 951 | ;; Fixme: not defined. | ||
| 952 | (set-coding-priority-internal))) | ||
| 953 | (make-obsolete 'set-coding-priority 'set-coding-system-priority "22.1") | 938 | (make-obsolete 'set-coding-priority 'set-coding-system-priority "22.1") |
| 954 | 939 | ||
| 955 | ;;; X selections | 940 | ;;; X selections |
| @@ -1418,48 +1403,31 @@ order, and if a previous form already translates TO to some other | |||
| 1418 | character, say TO-ALT, FROM is also translated to TO-ALT." | 1403 | character, say TO-ALT, FROM is also translated to TO-ALT." |
| 1419 | (let ((table (make-char-table 'translation-table)) | 1404 | (let ((table (make-char-table 'translation-table)) |
| 1420 | revlist) | 1405 | revlist) |
| 1421 | (while args | 1406 | (dolist (elts args) |
| 1422 | (let ((elts (car args))) | 1407 | (dolist (elt elts) |
| 1423 | (while elts | 1408 | (let ((from (car elt)) |
| 1424 | (let* ((from (car (car elts))) | 1409 | (to (cdr elt)) |
| 1425 | (from-i 0) ; degree of freedom of FROM | 1410 | to-alt rev-from rev-to) |
| 1426 | (from-rev (nreverse (split-char from))) | 1411 | ;; If we have already translated TO to TO-ALT, FROM should |
| 1427 | (to (cdr (car elts))) | 1412 | ;; also be translated to TO-ALT. |
| 1428 | (to-i 0) ; degree of freedom of TO | 1413 | (if (setq to-alt (aref table to)) |
| 1429 | (to-rev (nreverse (split-char to)))) | 1414 | (setq to to-alt)) |
| 1430 | ;; Check numbers of heading 0s in FROM-REV and TO-REV. | 1415 | (aset table from to) |
| 1431 | (while (eq (car from-rev) 0) | 1416 | ;; If we have already translated some chars to FROM, they |
| 1432 | (setq from-i (1+ from-i) from-rev (cdr from-rev))) | 1417 | ;; should also be translated to TO. |
| 1433 | (while (eq (car to-rev) 0) | 1418 | (when (setq rev-from (assq from revlist)) |
| 1434 | (setq to-i (1+ to-i) to-rev (cdr to-rev))) | 1419 | (dolist (elt (cdr rev-from)) |
| 1435 | (if (and (/= from-i to-i) (/= to-i 0)) | 1420 | (aset table elt to)) |
| 1436 | (error "Invalid character pair (%d . %d)" from to)) | 1421 | (setq revlist (delq rev-from revlist) |
| 1437 | ;; If we have already translated TO to TO-ALT, FROM should | 1422 | rev-from (cdr rev-from))) |
| 1438 | ;; also be translated to TO-ALT. | 1423 | ;; Now update REVLIST. |
| 1439 | (let ((to-alt (aref table to))) | 1424 | (setq rev-to (assq to revlist)) |
| 1440 | (if (and to-alt (> to-i 0)) | 1425 | (if rev-to |
| 1441 | (setq to to-alt))) | 1426 | (setcdr rev-to (cons from (cdr rev-to))) |
| 1442 | ;; Fixme: set-char-table-default is now a no-op. | 1427 | (setq rev-to (list to from) |
| 1443 | (if (> from-i 0) | 1428 | revlist (cons rev-to revlist))) |
| 1444 | (set-char-table-default table from to) | 1429 | (if rev-from |
| 1445 | (aset table from to)) | 1430 | (setcdr rev-to (append rev-from (cdr rev-to))))))) |
| 1446 | ;; If we have already translated some chars to FROM, they | ||
| 1447 | ;; should also be translated to TO. | ||
| 1448 | (let ((l (assq from revlist))) | ||
| 1449 | (if l | ||
| 1450 | (let ((ch (car l))) | ||
| 1451 | (setcar l to) | ||
| 1452 | (setq l (cdr l)) | ||
| 1453 | (while l | ||
| 1454 | (aset table ch to) | ||
| 1455 | (setq l (cdr l)) )))) | ||
| 1456 | ;; Now update REVLIST. | ||
| 1457 | (let ((l (assq to revlist))) | ||
| 1458 | (if l | ||
| 1459 | (setcdr l (cons from (cdr l))) | ||
| 1460 | (setq revlist (cons (list to from) revlist))))) | ||
| 1461 | (setq elts (cdr elts)))) | ||
| 1462 | (setq args (cdr args))) | ||
| 1463 | ;; Return TABLE just created. | 1431 | ;; Return TABLE just created. |
| 1464 | table)) | 1432 | table)) |
| 1465 | 1433 | ||