*** empty log message ***
[bpt/emacs.git] / src / intervals.c
index d3f814d..8bbab5a 100644 (file)
@@ -1,5 +1,6 @@
 /* Code for doing intervals.
-   Copyright (C) 1993, 1994, 1995, 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1997, 1998, 2002, 2003, 2004,
+                 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -15,8 +16,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, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 
 /* NOTES:
@@ -790,14 +791,14 @@ update_interval (i, pos)
          /* Move right. */
          if (pos < INTERVAL_LAST_POS (i) + TOTAL_LENGTH (i->right))
            {
-             i->right->position = INTERVAL_LAST_POS (i) +
-               LEFT_TOTAL_LENGTH (i->right);
+             i->right->position = INTERVAL_LAST_POS (i)
+               LEFT_TOTAL_LENGTH (i->right);
              i = i->right;             /* Move to the right child */
            }
          else if (NULL_PARENT (i))
-           error ("Point after end of properties");
+           error ("Point %d after end of properties", pos);
          else
-             i = INTERVAL_PARENT (i);
+            i = INTERVAL_PARENT (i);
          continue;
        }
       else
@@ -1899,11 +1900,13 @@ lookup_char_property (plist, prop, textprop)
     return fallback;
   /* Check for alternative properties */
   tail = Fassq (prop, Vchar_property_alias_alist);
-  if (NILP (tail))
-    return tail;
-  tail = XCDR (tail);
-  for (; NILP (fallback) && CONSP (tail); tail = XCDR (tail))
-    fallback = Fplist_get (plist, XCAR (tail));
+  if (! NILP (tail))
+    {
+      tail = XCDR (tail);
+      for (; NILP (fallback) && CONSP (tail); tail = XCDR (tail))
+       fallback = Fplist_get (plist, XCAR (tail));
+    }
+
   if (textprop && NILP (fallback) && CONSP (Vdefault_text_properties))
     fallback = Fplist_get (Vdefault_text_properties, prop);
   return fallback;
@@ -2273,6 +2276,10 @@ move_if_not_intangible (position)
          pos = Fnext_char_property_change (pos, Qnil);
 
     }
+  else if (position < BEGV)
+    position = BEGV;
+  else if (position > ZV)
+    position = ZV;
 
   /* If the whole stretch between PT and POSITION isn't intangible,
      try moving to POSITION (which means we actually move farther