changeset 6221:c2d29681d218

(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.
author Richard M. Stallman <rms@gnu.org>
date Sun, 06 Mar 1994 18:54:21 +0000
parents 42589aecdd59
children 957444150c1a
files src/casefiddle.c
diffstat 1 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/casefiddle.c	Sun Mar 06 03:27:00 1994 +0000
+++ b/src/casefiddle.c	Sun Mar 06 18:54:21 1994 +0000
@@ -187,19 +187,19 @@
 }
 
 Lisp_Object
-operate_on_word (arg)
+operate_on_word (arg, newpoint)
      Lisp_Object arg;
+     int *newpoint;
 {
   Lisp_Object val;
-  int end, farend;
+  int farend;
 
   CHECK_NUMBER (arg, 0);
   farend = scan_words (point, XINT (arg));
   if (!farend)
     farend = XINT (arg) > 0 ? ZV : BEGV;
 
-  end = point > farend ? point : farend;
-  SET_PT (end);
+  *newpoint = point > farend ? point : farend;
   XFASTINT (val) = farend;
 
   return val;
@@ -212,10 +212,12 @@
   (arg)
      Lisp_Object arg;
 {
-  Lisp_Object opoint;
-
-  XFASTINT (opoint) = point;
-  casify_region (CASE_UP, opoint, operate_on_word (arg));
+  Lisp_Object beg, end;
+  int newpoint;
+  XFASTINT (beg) = point;
+  end = operate_on_word (arg, &newpoint);
+  casify_region (CASE_UP, beg, end);
+  SET_PT (newpoint);
   return Qnil;
 }
 
@@ -225,9 +227,12 @@
   (arg)
      Lisp_Object arg;
 {
-  Lisp_Object opoint;
-  XFASTINT (opoint) = point;
-  casify_region (CASE_DOWN, opoint, operate_on_word (arg));
+  Lisp_Object beg, end;
+  int newpoint;
+  XFASTINT (beg) = point;
+  end = operate_on_word (arg, &newpoint);
+  casify_region (CASE_DOWN, beg, end);
+  SET_PT (newpoint);
   return Qnil;
 }
 
@@ -239,9 +244,12 @@
   (arg)
      Lisp_Object arg;
 {
-  Lisp_Object opoint;
-  XFASTINT (opoint) = point;
-  casify_region (CASE_CAPITALIZE, opoint, operate_on_word (arg));
+  Lisp_Object beg, end;
+  int newpoint;
+  XFASTINT (beg) = point;
+  end = operate_on_word (arg, &newpoint);
+  casify_region (CASE_CAPITALIZE, beg, end);
+  SET_PT (newpoint);
   return Qnil;
 }