Fequal_including_properties fix
[bpt/emacs.git] / src / casefiddle.c
index 81e8425..8b3b552 100644 (file)
@@ -1,6 +1,7 @@
 /* GNU Emacs case conversion functions.
 
-Copyright (C) 1985, 1994, 1997-1999, 2001-2012 Free Software Foundation, Inc.
+Copyright (C) 1985, 1994, 1997-1999, 2001-2014 Free Software Foundation,
+Inc.
 
 This file is part of GNU Emacs.
 
@@ -19,7 +20,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #include <config.h>
-#include <setjmp.h>
+
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"
@@ -35,8 +36,8 @@ Lisp_Object Qidentity;
 static Lisp_Object
 casify_object (enum case_action flag, Lisp_Object obj)
 {
-  register int c, c1;
-  register int inword = flag == CASE_DOWN;
+  int c, c1;
+  bool inword = flag == CASE_DOWN;
 
   /* If the case table is flagged as modified, rescan it.  */
   if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1]))
@@ -47,7 +48,8 @@ casify_object (enum case_action flag, Lisp_Object obj)
       int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
                      | CHAR_SHIFT | CHAR_CTL | CHAR_META);
       int flags = XINT (obj) & flagbits;
-      int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+      bool multibyte = ! NILP (BVAR (current_buffer,
+                                    enable_multibyte_characters));
 
       /* If the character has higher bits set
         above the flags, return it unchanged.
@@ -100,7 +102,7 @@ casify_object (enum case_action flag, Lisp_Object obj)
            inword = (SYNTAX (c) == Sword);
          if (c != c1)
            {
-                 MAKE_CHAR_UNIBYTE (c);
+             MAKE_CHAR_UNIBYTE (c);
              /* If the char can't be converted to a valid byte, just don't
                 change it.  */
              if (c >= 0 && c < 256)
@@ -189,9 +191,9 @@ The argument object is not altered--the value is a copy.  */)
 static void
 casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
 {
-  register int c;
-  register int inword = flag == CASE_DOWN;
-  register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+  int c;
+  bool inword = flag == CASE_DOWN;
+  bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   ptrdiff_t start, end;
   ptrdiff_t start_byte;
 
@@ -212,7 +214,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
   validate_region (&b, &e);
   start = XFASTINT (b);
   end = XFASTINT (e);
-  modify_region (current_buffer, start, end, 0);
+  modify_text (start, end);
   record_change (start, end - start);
   start_byte = CHAR_TO_BYTE (start);
 
@@ -363,7 +365,11 @@ operate_on_word (Lisp_Object arg, ptrdiff_t *newpoint)
 }
 
 DEFUN ("upcase-word", Fupcase_word, Supcase_word, 1, 1, "p",
-       doc: /* Convert following word (or ARG words) to upper case, moving over.
+       doc: /* Convert to upper case from point to end of word, moving over.
+
+If point is in the middle of a word, the part of that word before point
+is ignored when moving forward.
+
 With negative argument, convert previous words but do not move.
 See also `capitalize-word'.  */)
   (Lisp_Object arg)
@@ -378,7 +384,11 @@ See also `capitalize-word'.  */)
 }
 
 DEFUN ("downcase-word", Fdowncase_word, Sdowncase_word, 1, 1, "p",
-       doc: /* Convert following word (or ARG words) to lower case, moving over.
+       doc: /* Convert to lower case from point to end of word, moving over.
+
+If point is in the middle of a word, the part of that word before point
+is ignored when moving forward.
+
 With negative argument, convert previous words but do not move.  */)
   (Lisp_Object arg)
 {
@@ -392,9 +402,14 @@ With negative argument, convert previous words but do not move.  */)
 }
 
 DEFUN ("capitalize-word", Fcapitalize_word, Scapitalize_word, 1, 1, "p",
-       doc: /* Capitalize the following word (or ARG words), moving over.
+       doc: /* Capitalize from point to the end of word, moving over.
+With numerical argument ARG, capitalize the next ARG-1 words as well.
 This gives the word(s) a first character in upper case
 and the rest lower case.
+
+If point is in the middle of a word, the part of that word before point
+is ignored when moving forward.
+
 With negative argument, capitalize previous words but do not move.  */)
   (Lisp_Object arg)
 {
@@ -410,18 +425,9 @@ With negative argument, capitalize previous words but do not move.  */)
 void
 syms_of_casefiddle (void)
 {
+#include "casefiddle.x"
+
   DEFSYM (Qidentity, "identity");
-  defsubr (&Supcase);
-  defsubr (&Sdowncase);
-  defsubr (&Scapitalize);
-  defsubr (&Supcase_initials);
-  defsubr (&Supcase_region);
-  defsubr (&Sdowncase_region);
-  defsubr (&Scapitalize_region);
-  defsubr (&Supcase_initials_region);
-  defsubr (&Supcase_word);
-  defsubr (&Sdowncase_word);
-  defsubr (&Scapitalize_word);
 }
 
 void