diff options
| author | Richard M. Stallman | 1994-03-06 18:54:21 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-06 18:54:21 +0000 |
| commit | 34628a901f6b7f8ecd7ca08b3b39df153235f14b (patch) | |
| tree | 0d1831796c057ae126954bbe7bbe798578839818 /src/casefiddle.c | |
| parent | d6eac7d4685d3a8c94024dd403995a868b4f6d8a (diff) | |
| download | emacs-34628a901f6b7f8ecd7ca08b3b39df153235f14b.tar.gz emacs-34628a901f6b7f8ecd7ca08b3b39df153235f14b.zip | |
(operate_on_word): Don't move point; store in *NEWPOINT.
(Fupcase_word, Fdowncase_word, Fcapitalize_word):
Set point after changing case. Rename opoint to beg.
Diffstat (limited to 'src/casefiddle.c')
| -rw-r--r-- | src/casefiddle.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c index 44ecab569d8..212780acb21 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c | |||
| @@ -187,19 +187,19 @@ upcase_initials_region (b, e) | |||
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | Lisp_Object | 189 | Lisp_Object |
| 190 | operate_on_word (arg) | 190 | operate_on_word (arg, newpoint) |
| 191 | Lisp_Object arg; | 191 | Lisp_Object arg; |
| 192 | int *newpoint; | ||
| 192 | { | 193 | { |
| 193 | Lisp_Object val; | 194 | Lisp_Object val; |
| 194 | int end, farend; | 195 | int farend; |
| 195 | 196 | ||
| 196 | CHECK_NUMBER (arg, 0); | 197 | CHECK_NUMBER (arg, 0); |
| 197 | farend = scan_words (point, XINT (arg)); | 198 | farend = scan_words (point, XINT (arg)); |
| 198 | if (!farend) | 199 | if (!farend) |
| 199 | farend = XINT (arg) > 0 ? ZV : BEGV; | 200 | farend = XINT (arg) > 0 ? ZV : BEGV; |
| 200 | 201 | ||
| 201 | end = point > farend ? point : farend; | 202 | *newpoint = point > farend ? point : farend; |
| 202 | SET_PT (end); | ||
| 203 | XFASTINT (val) = farend; | 203 | XFASTINT (val) = farend; |
| 204 | 204 | ||
| 205 | return val; | 205 | return val; |
| @@ -212,10 +212,12 @@ See also `capitalize-word'.") | |||
| 212 | (arg) | 212 | (arg) |
| 213 | Lisp_Object arg; | 213 | Lisp_Object arg; |
| 214 | { | 214 | { |
| 215 | Lisp_Object opoint; | 215 | Lisp_Object beg, end; |
| 216 | 216 | int newpoint; | |
| 217 | XFASTINT (opoint) = point; | 217 | XFASTINT (beg) = point; |
| 218 | casify_region (CASE_UP, opoint, operate_on_word (arg)); | 218 | end = operate_on_word (arg, &newpoint); |
| 219 | casify_region (CASE_UP, beg, end); | ||
| 220 | SET_PT (newpoint); | ||
| 219 | return Qnil; | 221 | return Qnil; |
| 220 | } | 222 | } |
| 221 | 223 | ||
| @@ -225,9 +227,12 @@ With negative argument, convert previous words but do not move.") | |||
| 225 | (arg) | 227 | (arg) |
| 226 | Lisp_Object arg; | 228 | Lisp_Object arg; |
| 227 | { | 229 | { |
| 228 | Lisp_Object opoint; | 230 | Lisp_Object beg, end; |
| 229 | XFASTINT (opoint) = point; | 231 | int newpoint; |
| 230 | casify_region (CASE_DOWN, opoint, operate_on_word (arg)); | 232 | XFASTINT (beg) = point; |
| 233 | end = operate_on_word (arg, &newpoint); | ||
| 234 | casify_region (CASE_DOWN, beg, end); | ||
| 235 | SET_PT (newpoint); | ||
| 231 | return Qnil; | 236 | return Qnil; |
| 232 | } | 237 | } |
| 233 | 238 | ||
| @@ -239,9 +244,12 @@ With negative argument, capitalize previous words but do not move.") | |||
| 239 | (arg) | 244 | (arg) |
| 240 | Lisp_Object arg; | 245 | Lisp_Object arg; |
| 241 | { | 246 | { |
| 242 | Lisp_Object opoint; | 247 | Lisp_Object beg, end; |
| 243 | XFASTINT (opoint) = point; | 248 | int newpoint; |
| 244 | casify_region (CASE_CAPITALIZE, opoint, operate_on_word (arg)); | 249 | XFASTINT (beg) = point; |
| 250 | end = operate_on_word (arg, &newpoint); | ||
| 251 | casify_region (CASE_CAPITALIZE, beg, end); | ||
| 252 | SET_PT (newpoint); | ||
| 245 | return Qnil; | 253 | return Qnil; |
| 246 | } | 254 | } |
| 247 | 255 | ||