]> code.delx.au - gnu-emacs/blobdiff - src/textprop.c
Don't install keyboard hook when debugged on MS-Windows
[gnu-emacs] / src / textprop.c
index 6758d4dfee2b0398f2751b85b6ba036359125e69..7af8c6987365e79fb35140f7659afaad5f3a7e1a 100644 (file)
@@ -1,13 +1,13 @@
 /* Interface code for dealing with text properties.
-   Copyright (C) 1993-1995, 1997, 1999-2015 Free Software Foundation,
+   Copyright (C) 1993-1995, 1997, 1999-2016 Free Software Foundation,
    Inc.
 
 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 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,7 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "intervals.h"
-#include "character.h"
 #include "buffer.h"
 #include "window.h"
 
@@ -1494,7 +1493,7 @@ DEFUN ("remove-text-properties", Fremove_text_properties,
        doc: /* Remove some properties from text from START to END.
 The third argument PROPERTIES is a property list
 whose property names specify the properties to remove.
-(The values stored in PROPERTIES are ignored.)
+\(The values stored in PROPERTIES are ignored.)
 If the optional fourth argument OBJECT is a buffer (or nil, which means
 the current buffer), START and END are buffer positions (integers or
 markers).  If OBJECT is a string, START and END are 0-based indices into it.
@@ -2044,18 +2043,19 @@ add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object
    end-points to NEW_END.  */
 
 Lisp_Object
-extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
+extend_property_ranges (Lisp_Object list, Lisp_Object old_end, Lisp_Object new_end)
 {
   Lisp_Object prev = Qnil, head = list;
   ptrdiff_t max = XINT (new_end);
 
   for (; CONSP (list); prev = list, list = XCDR (list))
     {
-      Lisp_Object item, beg, end;
+      Lisp_Object item, beg;
+      ptrdiff_t end;
 
       item = XCAR (list);
       beg = XCAR (item);
-      end = XCAR (XCDR (item));
+      end = XINT (XCAR (XCDR (item)));
 
       if (XINT (beg) >= max)
        {
@@ -2066,9 +2066,16 @@ extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
          else
            XSETCDR (prev, XCDR (list));
        }
-      else if (XINT (end) > max)
-       /* The end-point is past the end of the new string.  */
-       XSETCAR (XCDR (item), new_end);
+      else if ((end == XINT (old_end) && end != max)
+              || end > max)
+       {
+         /* Either the end-point is past the end of the new string,
+            and we need to discard the properties past the new end,
+            or the caller is extending the property range, and we
+            should update all end-points that are on the old end of
+            the range to reflect that.  */
+         XSETCAR (XCDR (item), new_end);
+       }
     }
 
   return head;