Add arch tagline
[bpt/emacs.git] / src / composite.c
index d44acf2..52fae55 100644 (file)
@@ -1,7 +1,7 @@
 /* Composite sequence support.
    Copyright (C) 2001, 2002, 2003, 2004, 2005,
-                 2006, 2007 Free Software Foundation, Inc.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+                 2006, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
    Copyright (C) 2003, 2006
@@ -12,7 +12,7 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -537,7 +537,8 @@ update_compositions (from, to, check_mask)
         avoid it, in such a case, we change the property of the
         latter to the copy of it.  */
       if (from > BEGV
-         && find_composition (from - 1, -1, &start, &end, &prop, Qnil))
+         && find_composition (from - 1, -1, &start, &end, &prop, Qnil)
+         && COMPOSITION_VALID_P (start, end, prop))
        {
          min_pos = start;
          if (end > to)
@@ -550,7 +551,8 @@ update_compositions (from, to, check_mask)
          from = end;
        }
       else if (from < ZV
-              && find_composition (from, -1, &start, &from, &prop, Qnil))
+              && find_composition (from, -1, &start, &from, &prop, Qnil)
+              && COMPOSITION_VALID_P (start, from, prop))
        {
          if (from > to)
            max_pos = from;
@@ -565,6 +567,7 @@ update_compositions (from, to, check_mask)
          (to - 1).  */
       while (from < to - 1
             && find_composition (from, to, &start, &from, &prop, Qnil)
+            && COMPOSITION_VALID_P (start, from, prop)
             && from < to - 1)
        run_composition_function (start, from, prop);
     }
@@ -572,7 +575,8 @@ update_compositions (from, to, check_mask)
   if (check_mask & CHECK_TAIL)
     {
       if (from < to
-         && find_composition (to - 1, -1, &start, &end, &prop, Qnil))
+         && find_composition (to - 1, -1, &start, &end, &prop, Qnil)
+         && COMPOSITION_VALID_P (start, end, prop))
        {
          /* TO should be also at composition boundary.  But,
             insertion or deletion will make two compositions adjacent
@@ -589,7 +593,8 @@ update_compositions (from, to, check_mask)
          run_composition_function (start, end, prop);
        }
       else if (to < ZV
-              && find_composition (to, -1, &start, &end, &prop, Qnil))
+              && find_composition (to, -1, &start, &end, &prop, Qnil)
+              && COMPOSITION_VALID_P (start, end, prop))
        {
          run_composition_function (start, end, prop);
          max_pos = end;
@@ -647,6 +652,12 @@ compose_text (start, end, components, modification_func, string)
 {
   Lisp_Object prop;
 
+#if 0
+  if (VECTORP (components) && ASIZE (components) > 1
+      && VECTORP (AREF (components, 0)))
+    prop = components;
+  else
+#endif /* USE_FONT_BACKEND */
   prop = Fcons (Fcons (make_number (end - start), components),
                modification_func);
   Fput_text_property  (make_number (start), make_number (end),
@@ -790,7 +801,7 @@ syms_of_composite ()
     args[1] = Qequal;
     args[2] = QCweakness;
     /* We used to make the hash table weak so that unreferenced
-       compostions can be garbage-collected.  But, usually once
+       compositions can be garbage-collected.  But, usually once
        created compositions are repeatedly used in an Emacs session,
        and thus it's not worth to save memory in such a way.  So, we
        make the table not weak.  */
@@ -827,15 +838,15 @@ The default value is the function `compose-chars-after'.  */);
 
   DEFVAR_LISP ("auto-composition-function", &Vauto_composition_function,
               doc: /* Function to call to compose characters automatically.
-The function is called from the display routine with two arguments,
-POS and STRING.
+The function is called from the display routine with four arguments,
+FROM, TO, WINDOW, and STRING.
 
-If STRING is nil, the function must compose characters following POS
-in the current buffer.
+If STRING is nil, the function must compose characters in the region
+between FROM and TO in the current buffer.
 
-Otherwise, STRING is a string, and POS is an index to the string.  In
-this case, the function must compose characters following POS in
-the string.  */);
+Otherwise, STRING is a string, and FROM and TO are indices into the
+string.  In this case, the function must compose characters in the
+string.  */);
   Vauto_composition_function = Qnil;
 
   defsubr (&Scompose_region_internal);