diff options
| author | Richard M. Stallman | 1994-09-24 01:57:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-09-24 01:57:54 +0000 |
| commit | 96927ba4c55927ea77f9892bd274c65226c63af8 (patch) | |
| tree | a5128ebb84b258a55aabd0810a06818672ba019d | |
| parent | 0cf61204e745334c58f19e7d43d9c31794fe4023 (diff) | |
| download | emacs-96927ba4c55927ea77f9892bd274c65226c63af8.tar.gz emacs-96927ba4c55927ea77f9892bd274c65226c63af8.zip | |
(upcase_initials): New function.
(casify_object): Handle CASE_CAPITALIZE_UP.
| -rw-r--r-- | src/casefiddle.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c index 5d00a2b54c1..5597ba62ea3 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c | |||
| @@ -55,12 +55,13 @@ casify_object (flag, obj) | |||
| 55 | for (i = 0; i < len; i++) | 55 | for (i = 0; i < len; i++) |
| 56 | { | 56 | { |
| 57 | c = XSTRING (obj)->data[i]; | 57 | c = XSTRING (obj)->data[i]; |
| 58 | if (inword) | 58 | if (inword && flag != CASE_CAPITALIZE_UP) |
| 59 | c = DOWNCASE (c); | 59 | c = DOWNCASE (c); |
| 60 | else if (!UPPERCASEP (c)) | 60 | else if (!UPPERCASEP (c) |
| 61 | && (!inword || flag != CASE_CAPITALIZE_UP)) | ||
| 61 | c = UPCASE1 (c); | 62 | c = UPCASE1 (c); |
| 62 | XSTRING (obj)->data[i] = c; | 63 | XSTRING (obj)->data[i] = c; |
| 63 | if (flag == CASE_CAPITALIZE) | 64 | if ((int) flag >= (int) CASE_CAPITALIZE) |
| 64 | inword = SYNTAX (c) == Sword; | 65 | inword = SYNTAX (c) == Sword; |
| 65 | } | 66 | } |
| 66 | return obj; | 67 | return obj; |
| @@ -100,6 +101,15 @@ The argument object is not altered.") | |||
| 100 | { | 101 | { |
| 101 | return casify_object (CASE_CAPITALIZE, obj); | 102 | return casify_object (CASE_CAPITALIZE, obj); |
| 102 | } | 103 | } |
| 104 | |||
| 105 | /* Like Fcapitalize but change only the initials. */ | ||
| 106 | |||
| 107 | Lisp_Object | ||
| 108 | upcase_initials (obj) | ||
| 109 | Lisp_Object obj; | ||
| 110 | { | ||
| 111 | return casify_object (CASE_CAPITALIZE_UP, obj); | ||
| 112 | } | ||
| 103 | 113 | ||
| 104 | /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. | 114 | /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. |
| 105 | b and e specify range of buffer to operate on. */ | 115 | b and e specify range of buffer to operate on. */ |
| @@ -176,7 +186,7 @@ character positions to operate on.") | |||
| 176 | return Qnil; | 186 | return Qnil; |
| 177 | } | 187 | } |
| 178 | 188 | ||
| 179 | /* Like Fcapitalize but change only the initials. */ | 189 | /* Like Fcapitalize_region but change only the initials. */ |
| 180 | 190 | ||
| 181 | Lisp_Object | 191 | Lisp_Object |
| 182 | upcase_initials_region (b, e) | 192 | upcase_initials_region (b, e) |