diff options
| author | Karl Heuer | 1995-06-06 01:43:42 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-06-06 01:43:42 +0000 |
| commit | 2371fad4d8f4e56af9517b9f3be32b3f8b53514c (patch) | |
| tree | c19e93c56d372bf1abb58ead5cf90d1eb18ac464 /src/casefiddle.c | |
| parent | 53480e99d358bb1167a38cd13167ea55122cd754 (diff) | |
| download | emacs-2371fad4d8f4e56af9517b9f3be32b3f8b53514c.tar.gz emacs-2371fad4d8f4e56af9517b9f3be32b3f8b53514c.zip | |
(casify_region): Use explicit local vars for start
and end, so that the type will be correct.
(operate_on_word): Likewise for iarg in this function.
(upcase_initials, upcase_initials_region): Deleted; these were
redundant copies of Fupcase_initials and Fupcase_initials_region.
Diffstat (limited to 'src/casefiddle.c')
| -rw-r--r-- | src/casefiddle.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c index f4f2e2a9b52..7340a5093eb 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c | |||
| @@ -103,6 +103,8 @@ The argument object is not altered--the value is a copy.") | |||
| 103 | return casify_object (CASE_CAPITALIZE, obj); | 103 | return casify_object (CASE_CAPITALIZE, obj); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | /* Like Fcapitalize but change only the initials. */ | ||
| 107 | |||
| 106 | DEFUN ("upcase-initials", Fupcase_initials, Supcase_initials, 1, 1, 0, | 108 | DEFUN ("upcase-initials", Fupcase_initials, Supcase_initials, 1, 1, 0, |
| 107 | "Convert the initial of each word in the argument to upper case.\n\ | 109 | "Convert the initial of each word in the argument to upper case.\n\ |
| 108 | Do not change the other letters of each word.\n\ | 110 | Do not change the other letters of each word.\n\ |
| @@ -113,15 +115,6 @@ The argument object is not altered--the value is a copy.") | |||
| 113 | { | 115 | { |
| 114 | return casify_object (CASE_CAPITALIZE_UP, obj); | 116 | return casify_object (CASE_CAPITALIZE_UP, obj); |
| 115 | } | 117 | } |
| 116 | |||
| 117 | /* Like Fcapitalize but change only the initials. */ | ||
| 118 | |||
| 119 | Lisp_Object | ||
| 120 | upcase_initials (obj) | ||
| 121 | Lisp_Object obj; | ||
| 122 | { | ||
| 123 | return casify_object (CASE_CAPITALIZE_UP, obj); | ||
| 124 | } | ||
| 125 | 118 | ||
| 126 | /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. | 119 | /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. |
| 127 | b and e specify range of buffer to operate on. */ | 120 | b and e specify range of buffer to operate on. */ |
| @@ -133,16 +126,19 @@ casify_region (flag, b, e) | |||
| 133 | register int i; | 126 | register int i; |
| 134 | register int c; | 127 | register int c; |
| 135 | register int inword = flag == CASE_DOWN; | 128 | register int inword = flag == CASE_DOWN; |
| 129 | int start, end; | ||
| 136 | 130 | ||
| 137 | if (EQ (b, e)) | 131 | if (EQ (b, e)) |
| 138 | /* Not modifying because nothing marked */ | 132 | /* Not modifying because nothing marked */ |
| 139 | return; | 133 | return; |
| 140 | 134 | ||
| 141 | validate_region (&b, &e); | 135 | validate_region (&b, &e); |
| 142 | modify_region (current_buffer, XFASTINT (b), XFASTINT (e)); | 136 | start = XFASTINT (b); |
| 143 | record_change (XFASTINT (b), XFASTINT (e) - XFASTINT (b)); | 137 | end = XFASTINT (e); |
| 138 | modify_region (current_buffer, start, end); | ||
| 139 | record_change (start, end - start); | ||
| 144 | 140 | ||
| 145 | for (i = XFASTINT (b); i < XFASTINT (e); i++) | 141 | for (i = start; i < end; i++) |
| 146 | { | 142 | { |
| 147 | c = FETCH_CHAR (i); | 143 | c = FETCH_CHAR (i); |
| 148 | if (inword && flag != CASE_CAPITALIZE_UP) | 144 | if (inword && flag != CASE_CAPITALIZE_UP) |
| @@ -155,9 +151,7 @@ casify_region (flag, b, e) | |||
| 155 | inword = SYNTAX (c) == Sword; | 151 | inword = SYNTAX (c) == Sword; |
| 156 | } | 152 | } |
| 157 | 153 | ||
| 158 | signal_after_change (XFASTINT (b), | 154 | signal_after_change (start, end - start, end - start); |
| 159 | XFASTINT (e) - XFASTINT (b), | ||
| 160 | XFASTINT (e) - XFASTINT (b)); | ||
| 161 | } | 155 | } |
| 162 | 156 | ||
| 163 | DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 2, "r", | 157 | DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 2, "r", |
| @@ -198,6 +192,8 @@ character positions to operate on.") | |||
| 198 | return Qnil; | 192 | return Qnil; |
| 199 | } | 193 | } |
| 200 | 194 | ||
| 195 | /* Like Fcapitalize_region but change only the initials. */ | ||
| 196 | |||
| 201 | DEFUN ("upcase-initials-region", Fupcase_initials_region, | 197 | DEFUN ("upcase-initials-region", Fupcase_initials_region, |
| 202 | Supcase_initials_region, 2, 2, "r", | 198 | Supcase_initials_region, 2, 2, "r", |
| 203 | "Upcase the initial of each word in the region.\n\ | 199 | "Upcase the initial of each word in the region.\n\ |
| @@ -210,16 +206,6 @@ character positions to operate on.") | |||
| 210 | casify_region (CASE_CAPITALIZE_UP, b, e); | 206 | casify_region (CASE_CAPITALIZE_UP, b, e); |
| 211 | return Qnil; | 207 | return Qnil; |
| 212 | } | 208 | } |
| 213 | |||
| 214 | /* Like Fcapitalize_region but change only the initials. */ | ||
| 215 | |||
| 216 | Lisp_Object | ||
| 217 | upcase_initials_region (b, e) | ||
| 218 | Lisp_Object b, e; | ||
| 219 | { | ||
| 220 | casify_region (CASE_CAPITALIZE_UP, b, e); | ||
| 221 | return Qnil; | ||
| 222 | } | ||
| 223 | 209 | ||
| 224 | Lisp_Object | 210 | Lisp_Object |
| 225 | operate_on_word (arg, newpoint) | 211 | operate_on_word (arg, newpoint) |
| @@ -228,11 +214,13 @@ operate_on_word (arg, newpoint) | |||
| 228 | { | 214 | { |
| 229 | Lisp_Object val; | 215 | Lisp_Object val; |
| 230 | int farend; | 216 | int farend; |
| 217 | int iarg; | ||
| 231 | 218 | ||
| 232 | CHECK_NUMBER (arg, 0); | 219 | CHECK_NUMBER (arg, 0); |
| 233 | farend = scan_words (point, XINT (arg)); | 220 | iarg = XINT (arg); |
| 221 | farend = scan_words (point, iarg); | ||
| 234 | if (!farend) | 222 | if (!farend) |
| 235 | farend = XINT (arg) > 0 ? ZV : BEGV; | 223 | farend = iarg > 0 ? ZV : BEGV; |
| 236 | 224 | ||
| 237 | *newpoint = point > farend ? point : farend; | 225 | *newpoint = point > farend ? point : farend; |
| 238 | XSETFASTINT (val, farend); | 226 | XSETFASTINT (val, farend); |