diff options
| author | Geoff Voelker | 1997-07-20 01:31:41 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1997-07-20 01:31:41 +0000 |
| commit | fe831d33c5f276636f6ea8ba8e1b72bae5eafa51 (patch) | |
| tree | 4d083d4a98cc3893292876ec7486505dba00af80 /lisp | |
| parent | e2ed3ecdcfea46e4a584d573035482636ffbc83e (diff) | |
| download | emacs-fe831d33c5f276636f6ea8ba8e1b72bae5eafa51.tar.gz emacs-fe831d33c5f276636f6ea8ba8e1b72bae5eafa51.zip | |
(modify-coding-system-alist): Moved to mule-util.el.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/international/mule.el | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index c28cf485afb..e1381488ef8 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -630,6 +630,58 @@ Return nil if there's no need of setting new buffer-file-coding-system." | |||
| 630 | (aref (coding-system-eol-type new-coding) new-eol))) | 630 | (aref (coding-system-eol-type new-coding) new-eol))) |
| 631 | new-coding)))) | 631 | new-coding)))) |
| 632 | 632 | ||
| 633 | (defun modify-coding-system-alist (target-type regexp coding-system) | ||
| 634 | "Modify one of look up tables for finding a coding system on I/O operation. | ||
| 635 | There are three of such tables, file-coding-system-alist, | ||
| 636 | process-coding-system-alist, and network-coding-system-alist. | ||
| 637 | |||
| 638 | TARGET-TYPE specifies which of them to modify. | ||
| 639 | If it is `file', it affects file-coding-system-alist (which see). | ||
| 640 | If it is `process', it affects process-coding-system-alist (which see). | ||
| 641 | If it is `network', it affects network-codign-system-alist (which see). | ||
| 642 | |||
| 643 | REGEXP is a regular expression matching a target of I/O operation. | ||
| 644 | The target is a file name if TARGET-TYPE is `file', a program name if | ||
| 645 | TARGET-TYPE is `process', or a network service name or a port number | ||
| 646 | to connect to if TARGET-TYPE is `network'. | ||
| 647 | |||
| 648 | CODING-SYSTEM is a coding system to perform code conversion on the I/O | ||
| 649 | operation, or a cons of coding systems for decoding and encoding | ||
| 650 | respectively, or a function symbol which returns the cons." | ||
| 651 | (or (memq target-type '(file process network)) | ||
| 652 | (error "Invalid target type: %s" target-type)) | ||
| 653 | (or (stringp regexp) | ||
| 654 | (and (eq target-type 'network) (integerp regexp)) | ||
| 655 | (error "Invalid regular expression: %s" regexp)) | ||
| 656 | (if (symbolp coding-system) | ||
| 657 | (if (not (fboundp coding-system)) | ||
| 658 | (progn | ||
| 659 | (check-coding-system coding-system) | ||
| 660 | (setq coding-system (cons coding-system coding-system)))) | ||
| 661 | (check-coding-system (car coding-system)) | ||
| 662 | (check-coding-system (cdr coding-system))) | ||
| 663 | (cond ((eq target-type 'file) | ||
| 664 | (let ((slot (assoc regexp file-coding-system-alist))) | ||
| 665 | (if slot | ||
| 666 | (setcdr slot coding-system) | ||
| 667 | (setq file-coding-system-alist | ||
| 668 | (cons (cons regexp coding-system) | ||
| 669 | file-coding-system-alist))))) | ||
| 670 | ((eq target-type 'process) | ||
| 671 | (let ((slot (assoc regexp process-coding-system-alist))) | ||
| 672 | (if slot | ||
| 673 | (setcdr slot coding-system) | ||
| 674 | (setq process-coding-system-alist | ||
| 675 | (cons (cons regexp coding-system) | ||
| 676 | process-coding-system-alist))))) | ||
| 677 | (t | ||
| 678 | (let ((slot (assoc regexp network-coding-system-alist))) | ||
| 679 | (if slot | ||
| 680 | (setcdr slot coding-system) | ||
| 681 | (setq network-coding-system-alist | ||
| 682 | (cons (cons regexp coding-system) | ||
| 683 | network-coding-system-alist))))))) | ||
| 684 | |||
| 633 | (defun make-unification-table (&rest args) | 685 | (defun make-unification-table (&rest args) |
| 634 | "Make a unification table (char table) from arguments. | 686 | "Make a unification table (char table) from arguments. |
| 635 | Each argument is a list of the form (FROM . TO), | 687 | Each argument is a list of the form (FROM . TO), |