diff options
| author | Eli Zaretskii | 2020-08-23 21:23:45 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-08-23 21:23:45 +0300 |
| commit | 3a99f966dc2dc9fb3922340caa0016b305789977 (patch) | |
| tree | 0f93adad99600f77decc79bb83dcfb30a6a3ef01 /src/coding.c | |
| parent | a5394884627db6f6091c4b85b635af81c20f0f31 (diff) | |
| download | emacs-3a99f966dc2dc9fb3922340caa0016b305789977.tar.gz emacs-3a99f966dc2dc9fb3922340caa0016b305789977.zip | |
Improve handling of coding-system mnemonic indicators
This fixes assertion violations when the mnemonic is
given as a string, and allows non-ASCII characters be
used as mode-line mnemonic of a coding-system.
* src/xdisp.c (decode_mode_spec_coding): Handle multibyte
characters as coding-system's mnemonic.
(display_mode_element): If decode_mode_spec returns a multibyte
string, display it as multibyte.
* src/coding.c (Fdefine_coding_system_internal)
(Fcoding_system_put): If :mnemonic is a string, use its first
character. This avoids assertion violations if someone uses a
string as the mnemonic of a coding-system.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/coding.c b/src/coding.c index 51bd441de9d..221a9cad898 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -10895,7 +10895,10 @@ usage: (define-coding-system-internal ...) */) | |||
| 10895 | ASET (attrs, coding_attr_base_name, name); | 10895 | ASET (attrs, coding_attr_base_name, name); |
| 10896 | 10896 | ||
| 10897 | Lisp_Object val = args[coding_arg_mnemonic]; | 10897 | Lisp_Object val = args[coding_arg_mnemonic]; |
| 10898 | if (! STRINGP (val)) | 10898 | /* decode_mode_spec_coding assumes the mnemonic is a single character. */ |
| 10899 | if (STRINGP (val)) | ||
| 10900 | val = make_fixnum (STRING_CHAR (SDATA (val))); | ||
| 10901 | else | ||
| 10899 | CHECK_CHARACTER (val); | 10902 | CHECK_CHARACTER (val); |
| 10900 | ASET (attrs, coding_attr_mnemonic, val); | 10903 | ASET (attrs, coding_attr_mnemonic, val); |
| 10901 | 10904 | ||
| @@ -11408,7 +11411,10 @@ DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, | |||
| 11408 | attrs = AREF (spec, 0); | 11411 | attrs = AREF (spec, 0); |
| 11409 | if (EQ (prop, QCmnemonic)) | 11412 | if (EQ (prop, QCmnemonic)) |
| 11410 | { | 11413 | { |
| 11411 | if (! STRINGP (val)) | 11414 | /* decode_mode_spec_coding assumes the mnemonic is a single character. */ |
| 11415 | if (STRINGP (val)) | ||
| 11416 | val = make_fixnum (STRING_CHAR (SDATA (val))); | ||
| 11417 | else | ||
| 11412 | CHECK_CHARACTER (val); | 11418 | CHECK_CHARACTER (val); |
| 11413 | ASET (attrs, coding_attr_mnemonic, val); | 11419 | ASET (attrs, coding_attr_mnemonic, val); |
| 11414 | } | 11420 | } |