Mercurial > emacs
comparison lisp/international/mule.el @ 19606:0fbb8f15450e
(make-coding-system): Make TYPE 5 means
raw-text.
(after-insert-file-set-buffer-file-coding-system): Set
enable-multibyte-characters to nil if we read a file with
no-conversion or raw-text-XXXX.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 28 Aug 1997 10:49:48 +0000 |
parents | 5a08bc0f02d3 |
children | e9031152e052 |
comparison
equal
deleted
inserted
replaced
19605:3b700b203cfd | 19606:0fbb8f15450e |
---|---|
350 TYPE is an integer value indicating the type of coding-system as follows: | 350 TYPE is an integer value indicating the type of coding-system as follows: |
351 0: Emacs internal format, | 351 0: Emacs internal format, |
352 1: Shift-JIS (or MS-Kanji) used mainly on Japanese PC, | 352 1: Shift-JIS (or MS-Kanji) used mainly on Japanese PC, |
353 2: ISO-2022 including many variants, | 353 2: ISO-2022 including many variants, |
354 3: Big5 used mainly on Chinese PC, | 354 3: Big5 used mainly on Chinese PC, |
355 4: private, CCL programs provide encoding/decoding algorithm. | 355 4: private, CCL programs provide encoding/decoding algorithm, |
356 5: Raw-text, which means that text contains random 8-bit codes. | |
356 MNEMONIC is a character to be displayed on mode line for the coding-system. | 357 MNEMONIC is a character to be displayed on mode line for the coding-system. |
357 DOC-STRING is a documentation string for the coding-system. | 358 DOC-STRING is a documentation string for the coding-system. |
358 FLAGS specifies more precise information of each TYPE. | 359 FLAGS specifies more precise information of each TYPE. |
359 | 360 |
360 If TYPE is 2 (ISO-2022), FLAGS should be a list of: | 361 If TYPE is 2 (ISO-2022), FLAGS should be a list of: |
391 for decoding and encoding. See the documentation of CCL for more detail." | 392 for decoding and encoding. See the documentation of CCL for more detail." |
392 | 393 |
393 ;; At first, set a value of `coding-system' property. | 394 ;; At first, set a value of `coding-system' property. |
394 (let ((coding-spec (make-vector 5 nil)) | 395 (let ((coding-spec (make-vector 5 nil)) |
395 coding-category) | 396 coding-category) |
396 (if (or (not (integerp type)) (< type 0) (> type 4)) | 397 (if (or (not (integerp type)) (< type 0) (> type 5)) |
397 (error "TYPE argument must be 0..4")) | 398 (error "TYPE argument must be 0..4")) |
398 (if (or (not (integerp mnemonic)) (<= mnemonic ? ) (> mnemonic 127)) | 399 (if (or (not (integerp mnemonic)) (<= mnemonic ? ) (> mnemonic 127)) |
399 (error "MNEMONIC arguemnt must be a printable character.")) | 400 (error "MNEMONIC arguemnt must be a printable character.")) |
400 (aset coding-spec 0 type) | 401 (aset coding-spec 0 type) |
401 (aset coding-spec 1 mnemonic) | 402 (aset coding-spec 1 mnemonic) |
459 (setq coding-category 'coding-category-binary) | 460 (setq coding-category 'coding-category-binary) |
460 (if (and (consp flags) | 461 (if (and (consp flags) |
461 (vectorp (car flags)) | 462 (vectorp (car flags)) |
462 (vectorp (cdr flags))) | 463 (vectorp (cdr flags))) |
463 (aset coding-spec 4 flags) | 464 (aset coding-spec 4 flags) |
464 (error "Invalid FLAGS argument for TYPE 4 (CCL)")))) | 465 (error "Invalid FLAGS argument for TYPE 4 (CCL)"))) |
466 (t ; i.e. (= type 5) | |
467 (setq coding-category 'coding-category-raw-text))) | |
465 (put coding-system 'coding-system coding-spec) | 468 (put coding-system 'coding-system coding-spec) |
466 (put coding-system 'coding-category coding-category) | 469 (put coding-system 'coding-category coding-category) |
467 (put coding-category 'coding-systems | 470 (put coding-category 'coding-systems |
468 (cons coding-system (get coding-category 'coding-systems)))) | 471 (cons coding-system (get coding-category 'coding-systems)))) |
469 | 472 |
470 ;; Next, set a value of `eol-type' property. The value is a vector | 473 ;; Next, set a value of `eol-type' property. The value is a vector |
471 ;; of subsidiary coding systems, each corresponds to a coding system | 474 ;; of subsidiary coding systems, each corresponds to a coding system |
472 ;; for the detected end-of-line format. | 475 ;; for the detected end-of-line format. |
473 (put coding-system 'eol-type | 476 (put coding-system 'eol-type |
474 (if (<= type 3) | 477 (if (or (<= type 3) (= type 5)) |
475 (make-subsidiary-coding-system coding-system) | 478 (make-subsidiary-coding-system coding-system) |
476 0))) | 479 0))) |
477 | 480 |
478 (defun define-coding-system-alias (alias coding-system) | 481 (defun define-coding-system-alias (alias coding-system) |
479 "Define ALIAS as an alias for coding system CODING-SYSTEM." | 482 "Define ALIAS as an alias for coding system CODING-SYSTEM." |
646 (let ((coding-system | 649 (let ((coding-system |
647 (find-new-buffer-file-coding-system last-coding-system-used)) | 650 (find-new-buffer-file-coding-system last-coding-system-used)) |
648 (modified-p (buffer-modified-p))) | 651 (modified-p (buffer-modified-p))) |
649 (if coding-system | 652 (if coding-system |
650 (set-buffer-file-coding-system coding-system)) | 653 (set-buffer-file-coding-system coding-system)) |
654 (if (or (eq coding-system 'no-conversion) | |
655 (eq (coding-system-type coding-system) 5)) | |
656 ;; It seems that random 8-bit codes are read. We had | |
657 ;; better edit this buffer without multibyte character | |
658 ;; facility. | |
659 (setq enable-multibyte-characters nil)) | |
651 (set-buffer-modified-p modified-p))) | 660 (set-buffer-modified-p modified-p))) |
652 nil) | 661 nil) |
653 | 662 |
654 (setq after-insert-file-functions | 663 (setq after-insert-file-functions |
655 (cons 'after-insert-file-set-buffer-file-coding-system | 664 (cons 'after-insert-file-set-buffer-file-coding-system |