Mercurial > emacs
comparison lisp/international/mule.el @ 35324:dcbb79777f94
(transform-make-coding-system-args): New function.
(make-coding-system): Accept XEmacs style arguments.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 16 Jan 2001 10:34:30 +0000 |
parents | aa8df54873a9 |
children | df08279e042b |
comparison
equal
deleted
inserted
replaced
35323:8329471c78d4 | 35324:dcbb79777f94 |
---|---|
618 (cons (list (symbol-name (aref subsidiaries i))) | 618 (cons (list (symbol-name (aref subsidiaries i))) |
619 coding-system-alist)) | 619 coding-system-alist)) |
620 (setq i (1+ i))) | 620 (setq i (1+ i))) |
621 subsidiaries)) | 621 subsidiaries)) |
622 | 622 |
623 (defun transform-make-coding-system-args (name type &optional doc-string props) | |
624 "For internal use only. | |
625 Transform XEmacs style args for `make-coding-system' to Emacs style. | |
626 Value is a list of transformed arguments." | |
627 (let ((mnemonic (string-to-char (or (plist-get props 'mnemonic) "?"))) | |
628 (eol-type (plist-get props 'eol-type)) | |
629 properties tmp) | |
630 (cond | |
631 ((eq eol-type 'lf) (setq eol-type 'unix)) | |
632 ((eq eol-type 'crlf) (setq eol-type 'dos)) | |
633 ((eq eol-type 'cr) (setq eol-type 'mac))) | |
634 (if (setq tmp (plist-get props 'post-read-conversion)) | |
635 (setq properties (plist-put properties 'post-read-conversion tmp))) | |
636 (if (setq tmp (plist-get props 'pre-write-conversion)) | |
637 (setq properties (plist-put properties 'pre-write-conversion tmp))) | |
638 (cond | |
639 ((eq type 'ccl) | |
640 `(,name 4 | |
641 ,mnemonic | |
642 ,doc-string | |
643 (,(plist-get props 'decode) . ,(plist-get props 'encode)) | |
644 ,properties | |
645 ,eol-type)) | |
646 (t | |
647 (error "Unsupported XEmacs style arguments for make-coding-style: %S" | |
648 `(,name ,type ,doc-string ,props)))))) | |
649 | |
623 (defun make-coding-system (coding-system type mnemonic doc-string | 650 (defun make-coding-system (coding-system type mnemonic doc-string |
624 &optional | 651 &optional |
625 flags | 652 flags |
626 properties | 653 properties |
627 eol-type) | 654 eol-type) |
712 1. If TYPE is 4 and car or cdr of FLAGS is a vector, the vector is | 739 1. If TYPE is 4 and car or cdr of FLAGS is a vector, the vector is |
713 treated as a compiled CCL code. | 740 treated as a compiled CCL code. |
714 | 741 |
715 2. If PROPERTIES is just a list of character sets, the list is set as | 742 2. If PROPERTIES is just a list of character sets, the list is set as |
716 a value of `safe-charsets' in PLIST." | 743 a value of `safe-charsets' in PLIST." |
744 | |
745 ;; For compatiblity with XEmacs, we check the type of TYPE. If it | |
746 ;; is a symbol, perhaps, this fucntion is called with arguments of | |
747 ;; XEmacs style. Here, try to transform that kind of arguments to | |
748 ;; Emacs style. | |
749 (if (symbolp type) | |
750 (let ((args (transform-make-coding-system-args coding-system type | |
751 mnemonic doc-string))) | |
752 (setq coding-system (car args) | |
753 type (nth 1 nargs) | |
754 mnemonic (nth 2 args) | |
755 doc-string (nth 3 args) | |
756 flags (nth 4 args) | |
757 properties (nth 5 args) | |
758 eol-type (nth 6 args)))) | |
759 | |
717 ;; Set a value of `coding-system' property. | 760 ;; Set a value of `coding-system' property. |
718 (let ((coding-spec (make-vector 5 nil)) | 761 (let ((coding-spec (make-vector 5 nil)) |
719 (no-initial-designation t) | 762 (no-initial-designation t) |
720 (no-alternative-designation t) | 763 (no-alternative-designation t) |
721 (accept-latin-extra-code nil) | 764 (accept-latin-extra-code nil) |