aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/international/mule.el44
1 files changed, 28 insertions, 16 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 4291ef9fb4b..3ffb5d982a5 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -438,12 +438,13 @@ coding system whose eol-type is N."
438 438
439(defun make-coding-system (coding-system type mnemonic doc-string 439(defun make-coding-system (coding-system type mnemonic doc-string
440 &optional flags properties) 440 &optional flags properties)
441 "Define a new CODING-SYSTEM (symbol). 441 "Define a new coding system CODING-SYSTEM (symbol).
442Remaining arguments are TYPE, MNEMONIC, DOC-STRING, FLAGS (optional), 442Remaining arguments are TYPE, MNEMONIC, DOC-STRING, FLAGS (optional),
443and PROPERTIES (optional) which construct a coding-spec of CODING-SYSTEM 443and PROPERTIES (optional) which construct a coding-spec of CODING-SYSTEM
444in the following format: 444in the following format:
445 [TYPE MNEMONIC DOC-STRING PLIST FLAGS] 445 [TYPE MNEMONIC DOC-STRING PLIST FLAGS]
446TYPE is an integer value indicating the type of coding-system as follows: 446
447TYPE is an integer value indicating the type of the coding system as follows:
447 0: Emacs internal format, 448 0: Emacs internal format,
448 1: Shift-JIS (or MS-Kanji) used mainly on Japanese PC, 449 1: Shift-JIS (or MS-Kanji) used mainly on Japanese PC,
449 2: ISO-2022 including many variants, 450 2: ISO-2022 including many variants,
@@ -451,13 +452,13 @@ TYPE is an integer value indicating the type of coding-system as follows:
451 4: private, CCL programs provide encoding/decoding algorithm, 452 4: private, CCL programs provide encoding/decoding algorithm,
452 5: Raw-text, which means that text contains random 8-bit codes. 453 5: Raw-text, which means that text contains random 8-bit codes.
453 454
454MNEMONIC is a character to be displayed on mode line for the coding-system. 455MNEMONIC is a character to be displayed on mode line for the coding system.
455 456
456DOC-STRING is a documentation string for the coding-system. 457DOC-STRING is a documentation string for the coding system.
457 458
458FLAGS specifies more precise information of each TYPE. 459FLAGS specifies more detailed information of the coding system as follows:
459 460
460 If TYPE is 2 (ISO-2022), FLAGS should be a list of: 461 If TYPE is 2 (ISO-2022), FLAGS is a list of these elements:
461 CHARSET0, CHARSET1, CHARSET2, CHARSET3, SHORT-FORM, 462 CHARSET0, CHARSET1, CHARSET2, CHARSET3, SHORT-FORM,
462 ASCII-EOL, ASCII-CNTL, SEVEN, LOCKING-SHIFT, SINGLE-SHIFT, 463 ASCII-EOL, ASCII-CNTL, SEVEN, LOCKING-SHIFT, SINGLE-SHIFT,
463 USE-ROMAN, USE-OLDJIS, NO-ISO6429, INIT-BOL, DESIGNATION-BOL, 464 USE-ROMAN, USE-OLDJIS, NO-ISO6429, INIT-BOL, DESIGNATION-BOL,
@@ -487,17 +488,22 @@ FLAGS specifies more precise information of each TYPE.
487 a code specified in `latin-extra-code-table' (which see) as a valid 488 a code specified in `latin-extra-code-table' (which see) as a valid
488 code of the coding system. 489 code of the coding system.
489 490
490 If TYPE is 4 (private), FLAGS should be a cons of CCL programs, 491 If TYPE is 4 (private), FLAGS should be a cons of CCL programs, for
491 for decoding and encoding. See the documentation of CCL for more detail. 492 decoding and encoding. CCL programs should be specified by their
493 symbols.
492 494
493PROPERTIES is an alist of properties vs the corresponding values. 495PROPERTIES is an alist of properties vs the corresponding values.
494These properties are set in PLIST, a property list. This function 496These properties are set in PLIST, a property list. This function
495also sets properties `coding-category' and `alias-coding-systems' 497also sets properties `coding-category' and `alias-coding-systems'
496automatically. 498automatically.
497 499
498Kludgy feature: For backward compatibility, if PROPERTIES is a list of 500Kludgy features for backward compatibility:
499character sets, the list is set as a value of `safe-charsets' in 501
500PLIST." 5021. If TYPE is 4 and car or cdr of FLAGS is a vector, the vector is
503treated as a compiled CCL code.
504
5052. If PROPERTIES is just a list of character sets, the list is set as
506a value of `safe-charsets' in PLIST."
501 (if (memq coding-system coding-system-list) 507 (if (memq coding-system coding-system-list)
502 (error "Coding system %s already exists" coding-system)) 508 (error "Coding system %s already exists" coding-system))
503 509
@@ -573,11 +579,17 @@ PLIST."
573 (setq coding-category 'coding-category-big5)) 579 (setq coding-category 'coding-category-big5))
574 ((= type 4) ; private 580 ((= type 4) ; private
575 (setq coding-category 'coding-category-binary) 581 (setq coding-category 'coding-category-binary)
576 (if (and (consp flags) 582 (if (not (consp flags))
577 (vectorp (car flags)) 583 (error "Invalid FLAGS argument for TYPE 4 (CCL)")
578 (vectorp (cdr flags))) 584 (let ((decoder (check-ccl-program
579 (aset coding-spec 4 flags) 585 (car flags)
580 (error "Invalid FLAGS argument for TYPE 4 (CCL)"))) 586 (intern (format "%s-decoder" coding-system))))
587 (encoder (check-ccl-program
588 (cdr flags)
589 (intern (format "%s-encoder" coding-system)))))
590 (if (and decoder encoder)
591 (aset coding-spec 4 (cons decoder encoder))
592 (error "Invalid FLAGS argument for TYPE 4 (CCL)")))))
581 (t ; i.e. (= type 5) 593 (t ; i.e. (= type 5)
582 (setq coding-category 'coding-category-raw-text))) 594 (setq coding-category 'coding-category-raw-text)))
583 595