]> code.delx.au - gnu-emacs/blobdiff - src/casefiddle.c
(map_char_table): New arg SUBTABLE. Callers changed.
[gnu-emacs] / src / casefiddle.c
index a208809ae2a179fa914ab6cb4b2a099b32d4ea4f..b0cc0b94991e1a3212ea9f757e2a0c0532ba3263 100644 (file)
@@ -15,7 +15,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 
 #include <config.h>
@@ -34,6 +35,10 @@ casify_object (flag, obj)
   register int i, c, len;
   register int inword = flag == CASE_DOWN;
 
+  /* If the case table is flagged as modified, rescan it.  */
+  if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1]))
+    Fset_case_table (current_buffer->downcase_table);
+
   while (1)
     {
       if (INTEGERP (obj))
@@ -132,6 +137,10 @@ casify_region (flag, b, e)
     /* Not modifying because nothing marked */
     return;
 
+  /* If the case table is flagged as modified, rescan it.  */
+  if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1]))
+    Fset_case_table (current_buffer->downcase_table);
+
   validate_region (&b, &e);
   start = XFASTINT (b);
   end = XFASTINT (e);
@@ -140,13 +149,13 @@ casify_region (flag, b, e)
 
   for (i = start; i < end; i++)
     {
-      c = FETCH_CHAR (i);
+      c = FETCH_BYTE (i);
       if (inword && flag != CASE_CAPITALIZE_UP)
        c = DOWNCASE (c);
       else if (!UPPERCASEP (c)
               && (!inword || flag != CASE_CAPITALIZE_UP))
        c = UPCASE1 (c);
-      FETCH_CHAR (i) = c;
+      FETCH_BYTE (i) = c;
       if ((int) flag >= (int) CASE_CAPITALIZE)
        inword = SYNTAX (c) == Sword;
     }
@@ -160,10 +169,10 @@ These arguments specify the starting and ending character numbers of\n\
 the region to operate on.  When used as a command, the text between\n\
 point and the mark is operated on.\n\
 See also `capitalize-region'.")
-  (b, e)
-     Lisp_Object b, e;
+  (beg, end)
+     Lisp_Object beg, end;
 {
-  casify_region (CASE_UP, b, e);
+  casify_region (CASE_UP, beg, end);
   return Qnil;
 }
 
@@ -172,10 +181,10 @@ DEFUN ("downcase-region", Fdowncase_region, Sdowncase_region, 2, 2, "r",
 These arguments specify the starting and ending character numbers of\n\
 the region to operate on.  When used as a command, the text between\n\
 point and the mark is operated on.")
-  (b, e)
-     Lisp_Object b, e;
+  (beg, end)
+     Lisp_Object beg, end;
 {
-  casify_region (CASE_DOWN, b, e);
+  casify_region (CASE_DOWN, beg, end);
   return Qnil;
 }
 
@@ -185,10 +194,10 @@ Capitalized form means each word's first character is upper case\n\
 and the rest of it is lower case.\n\
 In programs, give two arguments, the starting and ending\n\
 character positions to operate on.")
-  (b, e)
-     Lisp_Object b, e;
+  (beg, end)
+     Lisp_Object beg, end;
 {
-  casify_region (CASE_CAPITALIZE, b, e);
+  casify_region (CASE_CAPITALIZE, beg, end);
   return Qnil;
 }
 
@@ -200,10 +209,10 @@ DEFUN ("upcase-initials-region", Fupcase_initials_region,
 Subsequent letters of each word are not changed.\n\
 In programs, give two arguments, the starting and ending\n\
 character positions to operate on.")
-  (b, e)
-     Lisp_Object b, e;
+  (beg, end)
+     Lisp_Object beg, end;
 {
-  casify_region (CASE_CAPITALIZE_UP, b, e);
+  casify_region (CASE_CAPITALIZE_UP, beg, end);
   return Qnil;
 }
 \f
@@ -218,11 +227,11 @@ operate_on_word (arg, newpoint)
 
   CHECK_NUMBER (arg, 0);
   iarg = XINT (arg);
-  farend = scan_words (point, iarg);
+  farend = scan_words (PT, iarg);
   if (!farend)
     farend = iarg > 0 ? ZV : BEGV;
 
-  *newpoint = point > farend ? point : farend;
+  *newpoint = PT > farend ? PT : farend;
   XSETFASTINT (val, farend);
 
   return val;
@@ -237,7 +246,7 @@ See also `capitalize-word'.")
 {
   Lisp_Object beg, end;
   int newpoint;
-  XSETFASTINT (beg, point);
+  XSETFASTINT (beg, PT);
   end = operate_on_word (arg, &newpoint);
   casify_region (CASE_UP, beg, end);
   SET_PT (newpoint);
@@ -252,7 +261,7 @@ With negative argument, convert previous words but do not move.")
 {
   Lisp_Object beg, end;
   int newpoint;
-  XSETFASTINT (beg, point);
+  XSETFASTINT (beg, PT);
   end = operate_on_word (arg, &newpoint);
   casify_region (CASE_DOWN, beg, end);
   SET_PT (newpoint);
@@ -269,7 +278,7 @@ With negative argument, capitalize previous words but do not move.")
 {
   Lisp_Object beg, end;
   int newpoint;
-  XSETFASTINT (beg, point);
+  XSETFASTINT (beg, PT);
   end = operate_on_word (arg, &newpoint);
   casify_region (CASE_CAPITALIZE, beg, end);
   SET_PT (newpoint);