aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1998-10-14 12:41:02 +0000
committerKenichi Handa1998-10-14 12:41:02 +0000
commit0513425723f80d58b8e12ae1f6b859772b8f2ed2 (patch)
treec4670bf51a05120071339f6c62dec6c7e34e9d45
parent3019692c38e386da5411bb251e7642c7c8a87d3d (diff)
downloademacs-0513425723f80d58b8e12ae1f6b859772b8f2ed2.tar.gz
emacs-0513425723f80d58b8e12ae1f6b859772b8f2ed2.zip
(make-coding-system): Create -with-esc variant coding system.
-rw-r--r--lisp/international/mule.el35
1 files changed, 26 insertions, 9 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 383807b5bb1..5235d6721c0 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -548,9 +548,10 @@ a value of `safe-charsets' in PLIST."
548 ((= type 2) ; ISO2022 548 ((= type 2) ; ISO2022
549 (let ((i 0) 549 (let ((i 0)
550 (vec (make-vector 32 nil)) 550 (vec (make-vector 32 nil))
551 (g1-designation nil)) 551 (g1-designation nil)
552 (fl flags))
552 (while (< i 4) 553 (while (< i 4)
553 (let ((charset (car flags))) 554 (let ((charset (car fl)))
554 (if (and no-initial-designation 555 (if (and no-initial-designation
555 (> i 0) 556 (> i 0)
556 (or (charsetp charset) 557 (or (charsetp charset)
@@ -575,10 +576,10 @@ a value of `safe-charsets' in PLIST."
575 (setq no-alternative-designation nil) 576 (setq no-alternative-designation nil)
576 (error "Invalid charset: %s" charset))))) 577 (error "Invalid charset: %s" charset)))))
577 (aset vec i charset)) 578 (aset vec i charset))
578 (setq flags (cdr flags) i (1+ i))) 579 (setq fl (cdr fl) i (1+ i)))
579 (while (and (< i 32) flags) 580 (while (and (< i 32) fl)
580 (aset vec i (car flags)) 581 (aset vec i (car fl))
581 (setq flags (cdr flags) i (1+ i))) 582 (setq fl (cdr fl) i (1+ i)))
582 (aset coding-spec 4 vec) 583 (aset coding-spec 4 vec)
583 (setq coding-category 584 (setq coding-category
584 (if (aref vec 8) ; Use locking-shift. 585 (if (aref vec 8) ; Use locking-shift.
@@ -625,9 +626,10 @@ a value of `safe-charsets' in PLIST."
625 ;; In the old version, the arg PROPERTIES is a list to be 626 ;; In the old version, the arg PROPERTIES is a list to be
626 ;; set in PLIST as a value of property `safe-charsets'. 627 ;; set in PLIST as a value of property `safe-charsets'.
627 (plist-put plist 'safe-charsets properties) 628 (plist-put plist 'safe-charsets properties)
628 (while properties 629 (let ((l properties))
629 (plist-put plist (car (car properties)) (cdr (car properties))) 630 (while l
630 (setq properties (cdr properties)))) 631 (plist-put plist (car (car l)) (cdr (car l)))
632 (setq l (cdr l)))))
631 (aset coding-spec coding-spec-plist-idx plist)) 633 (aset coding-spec coding-spec-plist-idx plist))
632 (put coding-system 'coding-system coding-spec) 634 (put coding-system 'coding-system coding-spec)
633 (put coding-category 'coding-systems 635 (put coding-category 'coding-systems
@@ -646,6 +648,21 @@ a value of `safe-charsets' in PLIST."
646 (setq coding-system-list (cons coding-system coding-system-list)) 648 (setq coding-system-list (cons coding-system coding-system-list))
647 (setq coding-system-alist (cons (list (symbol-name coding-system)) 649 (setq coding-system-alist (cons (list (symbol-name coding-system))
648 coding-system-alist)) 650 coding-system-alist))
651
652 ;; For a coding system of cateogory iso-8-1 and iso-8-2, create
653 ;; XXX-with-esc variants.
654 (let ((coding-category (coding-system-category coding-system)))
655 (if (or (eq coding-category 'coding-category-iso-8-1)
656 (eq coding-category 'coding-category-iso-8-2))
657 (let ((esc (intern (concat (symbol-name coding-system) "-with-esc")))
658 (doc (format "Same as %s but can handle any charsets by ISO's escape sequences." coding-system)))
659 (make-coding-system esc type mnemonic doc
660 (if (listp (car flags))
661 (cons (append (car flags) '(t)) (cdr flags))
662 (cons (list (car flags) t) (cdr flags)))
663 properties)
664 (coding-system-put esc 'safe-charsets t))))
665
649 coding-system) 666 coding-system)
650 667
651(defun define-coding-system-alias (alias coding-system) 668(defun define-coding-system-alias (alias coding-system)