Mercurial > hg > xemacs-beta
comparison lisp/unicode.el @ 4490:67fbcaf3dbdc
error-sequence -> invalid-sequence
2008-08-08 Aidan Kehoe <kehoea@parhasard.net>
* unicode.el:
* mule/mule-cmds.el:
* mule/latin.el:
* mule/cyrillic.el:
Rework the various identifiers using error-sequence to use
invalid-sequence instead.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Fri, 08 Aug 2008 21:17:08 +0200 |
parents | b75b075a9041 |
children | 121aadac896e |
comparison
equal
deleted
inserted
replaced
4489:b75b075a9041 | 4490:67fbcaf3dbdc |
---|---|
524 "Translation table mapping Unicode error sequences to Latin-1 chars. | 524 "Translation table mapping Unicode error sequences to Latin-1 chars. |
525 | 525 |
526 To transform XEmacs Unicode error sequences to the Latin-1 characters that | 526 To transform XEmacs Unicode error sequences to the Latin-1 characters that |
527 correspond to the octets on disk, you can use this variable. ") | 527 correspond to the octets on disk, you can use this variable. ") |
528 | 528 |
529 (defvar unicode-error-sequence-regexp-range | 529 (defvar unicode-invalid-sequence-regexp-range |
530 (and (featurep 'mule) | 530 (and (featurep 'mule) |
531 (format "%c%c-%c" | 531 (format "%c%c-%c" |
532 (aref (decode-coding-string "\xd8\x00\x00\x00" 'utf-16-be) 0) | 532 (aref (decode-coding-string "\xd8\x00\x00\x00" 'utf-16-be) 0) |
533 (aref (decode-coding-string "\xd8\x00\x00\x00" 'utf-16-be) 3) | 533 (aref (decode-coding-string "\xd8\x00\x00\x00" 'utf-16-be) 3) |
534 (aref (decode-coding-string "\xd8\x00\x00\xFF" 'utf-16-be) 3))) | 534 (aref (decode-coding-string "\xd8\x00\x00\xFF" 'utf-16-be) 3))) |
562 | 562 |
563 (goto-char (point-min)) | 563 (goto-char (point-min)) |
564 ;; Comment out until the issue in | 564 ;; Comment out until the issue in |
565 ;; 18179.49815.622843.336527@parhasard.net is fixed. | 565 ;; 18179.49815.622843.336527@parhasard.net is fixed. |
566 (assert t ; (re-search-forward (concat "[" | 566 (assert t ; (re-search-forward (concat "[" |
567 ; unicode-error-sequence-regexp-range | 567 ; unicode-invalid-sequence-regexp-range |
568 ; "]")) | 568 ; "]")) |
569 nil | 569 nil |
570 (format "Could not find char ?\\x%x in buffer" i)))) | 570 (format "Could not find char ?\\x%x in buffer" i)))) |
571 | 571 |
572 (defun frob-unicode-errors-region (frob-function begin end &optional buffer) | 572 (defun frob-unicode-errors-region (frob-function begin end &optional buffer) |
584 (goto-char (point-min)) | 584 (goto-char (point-min)) |
585 (while end | 585 (while end |
586 (setq begin | 586 (setq begin |
587 (progn | 587 (progn |
588 (skip-chars-forward | 588 (skip-chars-forward |
589 (concat "^" unicode-error-sequence-regexp-range)) | 589 (concat "^" unicode-invalid-sequence-regexp-range)) |
590 (point)) | 590 (point)) |
591 end (and (not (= (point) (point-max))) | 591 end (and (not (= (point) (point-max))) |
592 (progn | 592 (progn |
593 (skip-chars-forward | 593 (skip-chars-forward |
594 unicode-error-sequence-regexp-range) | 594 unicode-invalid-sequence-regexp-range) |
595 (point)))) | 595 (point)))) |
596 (if end | 596 (if end |
597 (funcall frob-function begin end)))))) | 597 (funcall frob-function begin end)))))) |
598 | 598 |
599 (defun unicode-error-translate-region (begin end &optional buffer table) | 599 (defun unicode-error-translate-region (begin end &optional buffer table) |
610 (lambda (start finish) | 610 (lambda (start finish) |
611 (translate-region start finish table)) | 611 (translate-region start finish table)) |
612 begin end buffer)) | 612 begin end buffer)) |
613 | 613 |
614 ;; Sure would be nice to be able to use defface here. | 614 ;; Sure would be nice to be able to use defface here. |
615 (copy-face 'highlight 'unicode-error-sequence-warning-face) | 615 (copy-face 'highlight 'unicode-invalid-sequence-warning-face) |
616 | 616 |
617 (unless (featurep 'mule) | 617 (unless (featurep 'mule) |
618 ;; We do this in such a roundabout way--instead of having the above defun | 618 ;; We do this in such a roundabout way--instead of having the above defun |
619 ;; and defvar calls inside a (when (featurep 'mule) ...) form--to have | 619 ;; and defvar calls inside a (when (featurep 'mule) ...) form--to have |
620 ;; make-docfile.c pick up symbol and function documentation correctly. An | 620 ;; make-docfile.c pick up symbol and function documentation correctly. An |
621 ;; alternative approach would be to fix make-docfile.c to be able to read | 621 ;; alternative approach would be to fix make-docfile.c to be able to read |
622 ;; Lisp. | 622 ;; Lisp. |
623 (mapcar #'unintern | 623 (mapcar #'unintern |
624 '(ccl-encode-to-ucs-2 unicode-error-default-translation-table | 624 '(ccl-encode-to-ucs-2 unicode-error-default-translation-table |
625 unicode-error-sequence-regexp-range | 625 unicode-invalid-regexp-range frob-unicode-errors-region |
626 frob-unicode-errors-region unicode-error-translate-region))) | 626 unicode-error-translate-region))) |
627 | 627 |
628 ;; #### UTF-7 is not yet implemented, and it's tricky to do. There's | 628 ;; #### UTF-7 is not yet implemented, and it's tricky to do. There's |
629 ;; an implementation in appendix A.1 of the Unicode Standard, Version | 629 ;; an implementation in appendix A.1 of the Unicode Standard, Version |
630 ;; 2.0, but I don't know its licensing characteristics. | 630 ;; 2.0, but I don't know its licensing characteristics. |
631 | 631 |