Mercurial > hg > xemacs-beta
comparison lisp/mule/mule-cmds.el @ 4489:b75b075a9041
Support displaying invalid UTF-8 in language-environment-specific ways.
2008-08-05 Aidan Kehoe <kehoea@parhasard.net>
* specifier.el (current-display-table): Initialise this here, not
in x-init.el, since we want it even on non-X builds to use the
support for displaying Unicode error sequences according to the
current locale.
* mule/mule-cmds.el (set-language-info):
Document error-sequence-coding-system, used to describe how to
display characters that are not valid Unicode on disk.
* mule/mule-cmds.el (finish-set-language-environment):
Implement error-sequence-coding-system.
* unicode.el (unicode-error-sequence-warning-face):
New face, to make it possible to distinguish invalid Unicode
sequences from the characters given by the valid Unicode
sequences.
* mule/cyrillic.el ("Russian"):
("Ukrainian"):
("Bulgarian"):
("Belarusian"):
("Cyrillic-ALT"): Add support for error-sequence-coding-system for
all these languages.
* mule/latin.el:
Add support for error-sequence-coding-system for the
Latin-alphabet language environments.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 05 Aug 2008 09:06:41 +0200 |
parents | a78d697ccd2c |
children | 67fbcaf3dbdc |
comparison
equal
deleted
inserted
replaced
4488:6b0000935adc | 4489:b75b075a9041 |
---|---|
223 LANG if there's no SUBLANG. The return value will be | 223 LANG if there's no SUBLANG. The return value will be |
224 the canonicalized locale, in proper CLIB form.) | 224 the canonicalized locale, in proper CLIB form.) |
225 | 225 |
226 If there is no value for this property, the MS Windows | 226 If there is no value for this property, the MS Windows |
227 locale is assumed to have the same name as the | 227 locale is assumed to have the same name as the |
228 language environment." | 228 language environment. |
229 | |
230 error-sequence-coding-system | |
231 VALUE is a fixed-width 8-bit coding system used to | |
232 display Unicode error sequences (using a face to make | |
233 it clear that the data is invalid). In Western Europe | |
234 this is normally windows-1252; in the Russia and the | |
235 former Soviet Union koi8-ru or windows-1251 makes more | |
236 sense." | |
229 (if (symbolp lang-env) | 237 (if (symbolp lang-env) |
230 (setq lang-env (symbol-name lang-env))) | 238 (setq lang-env (symbol-name lang-env))) |
231 (let (lang-slot prop-slot) | 239 (let (lang-slot prop-slot) |
232 (setq lang-slot (assoc lang-env language-info-alist)) | 240 (setq lang-slot (assoc lang-env language-info-alist)) |
233 (if (null lang-slot) ; If no slot for the language, add it. | 241 (if (null lang-slot) ; If no slot for the language, add it. |
757 (require (car required-features)) | 765 (require (car required-features)) |
758 (setq required-features (cdr required-features)))) | 766 (setq required-features (cdr required-features)))) |
759 (let ((func (get-language-info language-name 'setup-function))) | 767 (let ((func (get-language-info language-name 'setup-function))) |
760 (if (functionp func) | 768 (if (functionp func) |
761 (funcall func))) | 769 (funcall func))) |
770 | |
771 (let ((error-sequence-coding-system | |
772 (get-language-info language-name 'error-sequence-coding-system)) | |
773 (disp-table (specifier-instance current-display-table)) | |
774 glyph) | |
775 (when (consp error-sequence-coding-system) | |
776 (setq error-sequence-coding-system (car error-sequence-coding-system))) | |
777 (map-char-table | |
778 #'(lambda (key entry) | |
779 (setq glyph (make-glyph | |
780 (vector | |
781 'string :data | |
782 (decode-coding-string (string entry) | |
783 error-sequence-coding-system)))) | |
784 (set-glyph-face glyph 'unicode-error-sequence-warning-face) | |
785 (put-char-table key glyph disp-table) | |
786 nil) | |
787 unicode-error-default-translation-table)) | |
762 | 788 |
763 ;; Fit the charsets preferences in unicode conversions for the | 789 ;; Fit the charsets preferences in unicode conversions for the |
764 ;; language environment. | 790 ;; language environment. |
765 (set-language-unicode-precedence-list | 791 (set-language-unicode-precedence-list |
766 (get-language-info language-name 'charset)) | 792 (get-language-info language-name 'charset)) |