]> code.delx.au - gnu-emacs/blobdiff - src/textprop.c
Update copyright year to 2015
[gnu-emacs] / src / textprop.c
index 2eea2d208397127e60cb37d0f578e7b11acb6ba3..27ab08f628c01e07ed3ea9b77d888681c857f16a 100644 (file)
@@ -1,5 +1,5 @@
 /* Interface code for dealing with text properties.
-   Copyright (C) 1993-1995, 1997, 1999-2014 Free Software Foundation,
+   Copyright (C) 1993-1995, 1997, 1999-2015 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -1317,9 +1317,11 @@ specify the property to add.
 If the optional fifth 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.  */)
-  (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
+  (Lisp_Object start, Lisp_Object end, Lisp_Object property,
+   Lisp_Object value, Lisp_Object object)
 {
-  Fadd_text_properties (start, end, list2 (property, value), object);
+  AUTO_LIST2 (properties, property, value);
+  Fadd_text_properties (start, end, properties, object);
   return Qnil;
 }
 
@@ -1360,7 +1362,8 @@ into it.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object face,
    Lisp_Object append, Lisp_Object object)
 {
-  add_text_properties_1 (start, end, list2 (Qface, face), object,
+  AUTO_LIST2 (properties, Qface, face);
+  add_text_properties_1 (start, end, properties, object,
                         (NILP (append)
                          ? TEXT_PROPERTY_PREPEND
                          : TEXT_PROPERTY_APPEND));
@@ -1909,7 +1912,8 @@ text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer)
 /* Note this can GC when DEST is a buffer.  */
 
 Lisp_Object
-copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_Object pos, Lisp_Object dest, Lisp_Object prop)
+copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src,
+                     Lisp_Object pos, Lisp_Object dest, Lisp_Object prop)
 {
   INTERVAL i;
   Lisp_Object res;
@@ -1962,12 +1966,10 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_
            plist = Fcdr (Fcdr (plist));
          }
       if (! NILP (plist))
-       {
-         /* Must defer modifications to the interval tree in case src
-            and dest refer to the same string or buffer.  */
-         stuff = Fcons (list3 (make_number (p), make_number (p + len), plist),
-                        stuff);
-       }
+       /* Must defer modifications to the interval tree in case
+          src and dest refer to the same string or buffer.  */
+       stuff = Fcons (list3 (make_number (p), make_number (p + len), plist),
+                      stuff);
 
       i = next_interval (i);
       if (!i)
@@ -2296,6 +2298,11 @@ verify_interval_modification (struct buffer *buf,
                }
            }
 
+         if (i->position + LENGTH (i) < end
+             && (!NILP (BVAR (current_buffer, read_only))
+                 && NILP (Vinhibit_read_only)))
+           xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
+
          i = next_interval (i);
        }
       /* Keep going thru the interval containing the char before END.  */