ASET (attrs, coding_attr_base_name, name);
Lisp_Object val = args[coding_arg_mnemonic];
- if (! STRINGP (val))
+ /* decode_mode_spec_coding assumes the mnemonic is a single character. */
+ if (STRINGP (val))
+ val = make_fixnum (STRING_CHAR (SDATA (val)));
+ else
CHECK_CHARACTER (val);
ASET (attrs, coding_attr_mnemonic, val);
attrs = AREF (spec, 0);
if (EQ (prop, QCmnemonic))
{
- if (! STRINGP (val))
+ /* decode_mode_spec_coding assumes the mnemonic is a single character. */
+ if (STRINGP (val))
+ val = make_fixnum (STRING_CHAR (SDATA (val)));
+ else
CHECK_CHARACTER (val);
ASET (attrs, coding_attr_mnemonic, val);
}
spec = decode_mode_spec (it->w, c, field, &string);
eassert (NILP (string) || STRINGP (string));
multibyte = !NILP (string) && STRING_MULTIBYTE (string);
+ /* Non-ASCII characters in SPEC should cause mode-line
+ element be displayed as a multibyte string. */
+ ptrdiff_t nbytes = strlen (spec);
+ if (multibyte_chars_in_text (spec, nbytes) != nbytes)
+ multibyte = true;
switch (mode_line_target)
{
attrs = AREF (val, 0);
eolvalue = AREF (val, 2);
- *buf++ = multibyte
- ? XFIXNAT (CODING_ATTR_MNEMONIC (attrs))
- : ' ';
+ if (multibyte)
+ buf += CHAR_STRING (XFIXNAT (CODING_ATTR_MNEMONIC (attrs)), buf);
+ else
+ *buf++ = ' ';
if (eol_flag)
{