| CHAR_SHIFT | CHAR_CTL | CHAR_META);
int flags = XINT (obj) & flagbits;
+ /* If the character has higher bits set
+ above the flags, return it unchanged.
+ It is not a real character. */
+ if ((unsigned) XFASTINT (obj) > (unsigned) flagbits)
+ return obj;
+
c = DOWNCASE (XFASTINT (obj) & ~flagbits);
if (inword)
XSETFASTINT (obj, c | flags);
int multibyte = STRING_MULTIBYTE (obj);
obj = Fcopy_sequence (obj);
- len = STRING_BYTES (XSTRING (obj));
+ len = SBYTES (obj);
/* Scan all single-byte characters from start of string. */
for (i = 0; i < len;)
{
- c = XSTRING (obj)->data[i];
+ c = SREF (obj, i);
if (multibyte && c >= 0x80)
/* A multibyte character can't be handled in this
: ! SINGLE_BYTE_CHAR_P (c))
break;
- XSTRING (obj)->data[i] = c;
+ SSET (obj, i, c);
if ((int) flag >= (int) CASE_CAPITALIZE)
inword = SYNTAX (c) == Sword;
i++;
= (char *) alloca ((len - i) * MAX_MULTIBYTE_LENGTH + i);
/* Copy data already handled. */
- bcopy (XSTRING (obj)->data, buf, i);
+ bcopy (SDATA (obj), buf, i);
/* From now on, I counts bytes. */
while (i < len)
{
- c = STRING_CHAR_AND_LENGTH (XSTRING (obj)->data + i,
+ c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i,
len - i, fromlen);
if (inword && flag != CASE_CAPITALIZE_UP)
c = DOWNCASE (c);
if ((int) flag >= (int) CASE_CAPITALIZE)
inword = SYNTAX (c) == Sword;
}
- obj = make_multibyte_string (buf, XSTRING (obj)->size,
+ obj = make_multibyte_string (buf, SCHARS (obj),
j_byte);
}
return obj;
if (c != c2)
changed = 1;
if ((int) flag >= (int) CASE_CAPITALIZE)
- inword = SYNTAX (c) == Sword;
+ inword = SYNTAX (c) == Sword && (inword || !SYNTAX_PREFIX (c));
}
if (i < end_byte)
{
initial_define_key (meta_map, 'l', "downcase-word");
initial_define_key (meta_map, 'c', "capitalize-word");
}
+
+/* arch-tag: 60a73c66-5489-47e7-a81f-cead4057c526
+ (do not change this comment) */