mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-26 23:31:55 -08:00
casing: don’t assume letters are *either* upper- or lower-case (bug#24603)
A compatibility digraph characters, such as Dž, are neither upper- nor lower-case. At the moment however, those are reported as upper-case¹ despite the fact that they change when upper-cased. Stop checking if a character is upper-case before trying to up-case it so that title-case characters are handled correctly. This fixes one of the issues mentioned in bug#24603. ¹ Because they change when converted to lower-case. Notice an asymmetry in that for a character to be considered lower-case it must not be upper-case (plus the usual condition of changing when upper-cased). * src/buffer.h (upcase1): Delete. (upcase): Change to upcase character unconditionally just like downcase does it. This is what upcase1 was. * src/casefiddle.c (casify_object, casify_region): Use upcase instead of upcase1 and don’t check !uppercasep(x) before calling upcase. * src/keyboard.c (read_key_sequence): Don’t check if uppercase(x), just downcase(x) and see if it changed. * test/src/casefiddle-tests.el (casefiddle-tests--characters, casefiddle-tests-casing): Update test cases which are now passing.
This commit is contained in:
parent
5ec3a58462
commit
6220faeb4e
5 changed files with 42 additions and 37 deletions
18
src/buffer.h
18
src/buffer.h
|
|
@ -1365,28 +1365,28 @@ downcase (int c)
|
|||
return NATNUMP (down) ? XFASTINT (down) : c;
|
||||
}
|
||||
|
||||
/* True if C is upper case. */
|
||||
INLINE bool uppercasep (int c) { return downcase (c) != c; }
|
||||
|
||||
/* Upcase a character C known to be not upper case. */
|
||||
/* Upcase a character C, or make no change if that cannot be done. */
|
||||
INLINE int
|
||||
upcase1 (int c)
|
||||
upcase (int c)
|
||||
{
|
||||
Lisp_Object upcase_table = BVAR (current_buffer, upcase_table);
|
||||
Lisp_Object up = CHAR_TABLE_REF (upcase_table, c);
|
||||
return NATNUMP (up) ? XFASTINT (up) : c;
|
||||
}
|
||||
|
||||
/* True if C is upper case. */
|
||||
INLINE bool uppercasep (int c)
|
||||
{
|
||||
return downcase (c) != c;
|
||||
}
|
||||
|
||||
/* True if C is lower case. */
|
||||
INLINE bool
|
||||
lowercasep (int c)
|
||||
{
|
||||
return !uppercasep (c) && upcase1 (c) != c;
|
||||
return !uppercasep (c) && upcase (c) != c;
|
||||
}
|
||||
|
||||
/* Upcase a character C, or make no change if that cannot be done. */
|
||||
INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); }
|
||||
|
||||
INLINE_HEADER_END
|
||||
|
||||
#endif /* EMACS_BUFFER_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue