emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111074: * lisp.h (modify_region): Re


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111074: * lisp.h (modify_region): Rename to...
Date: Mon, 03 Dec 2012 18:13:06 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111074
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Mon 2012-12-03 18:13:06 +0400
message:
  * lisp.h (modify_region): Rename to...
  (modify_region_1): ...new prototype.
  * textprop.c (modify_region): Now static.  Adjust users.
  * insdel.c (modify_region): Rename to...
  (modify_region_1): ...new function to work with current buffer.
  Adjust comment and users.  Use true and false for boolean arg.
modified:
  src/ChangeLog
  src/casefiddle.c
  src/editfns.c
  src/insdel.c
  src/lisp.h
  src/textprop.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-03 08:06:02 +0000
+++ b/src/ChangeLog     2012-12-03 14:13:06 +0000
@@ -1,5 +1,14 @@
 2012-12-03  Dmitry Antipov  <address@hidden>
 
+       * lisp.h (modify_region): Rename to...
+       (modify_region_1): ...new prototype.
+       * textprop.c (modify_region): Now static.  Adjust users.
+       * insdel.c (modify_region): Rename to...
+       (modify_region_1): ...new function to work with current buffer.
+       Adjust comment and users.  Use true and false for booleans.
+
+2012-12-03  Dmitry Antipov  <address@hidden>
+
        * alloc.c (free_save_value): New function.
        (safe_alloca_unwind): Use it.
        * lisp.h (free_save_value): New prototype.

=== modified file 'src/casefiddle.c'
--- a/src/casefiddle.c  2012-09-15 07:06:56 +0000
+++ b/src/casefiddle.c  2012-12-03 14:13:06 +0000
@@ -213,7 +213,7 @@
   validate_region (&b, &e);
   start = XFASTINT (b);
   end = XFASTINT (e);
-  modify_region (current_buffer, start, end, 0);
+  modify_region_1 (start, end, false);
   record_change (start, end - start);
   start_byte = CHAR_TO_BYTE (start);
 

=== modified file 'src/editfns.c'
--- a/src/editfns.c     2012-12-03 08:06:02 +0000
+++ b/src/editfns.c     2012-12-03 14:13:06 +0000
@@ -2922,7 +2922,7 @@
          else if (!changed)
            {
              changed = -1;
-             modify_region (current_buffer, pos, XINT (end), 0);
+             modify_region_1 (pos, XINT (end), false);
 
              if (! NILP (noundo))
                {
@@ -3098,7 +3098,7 @@
   pos = XINT (start);
   pos_byte = CHAR_TO_BYTE (pos);
   end_pos = XINT (end);
-  modify_region (current_buffer, pos, end_pos, 0);
+  modify_region_1 (pos, end_pos, false);
 
   cnt = 0;
   for (; pos < end_pos; )
@@ -4622,7 +4622,7 @@
 
   if (end1 == start2)          /* adjacent regions */
     {
-      modify_region (current_buffer, start1, end2, 0);
+      modify_region_1 (start1, end2, false);
       record_change (start1, len1 + len2);
 
       tmp_interval1 = copy_intervals (cur_intv, start1, len1);
@@ -4681,8 +4681,8 @@
         {
          USE_SAFE_ALLOCA;
 
-          modify_region (current_buffer, start1, end1, 0);
-          modify_region (current_buffer, start2, end2, 0);
+          modify_region_1 (start1, end1, false);
+          modify_region_1 (start2, end2, false);
           record_change (start1, len1);
           record_change (start2, len2);
           tmp_interval1 = copy_intervals (cur_intv, start1, len1);
@@ -4715,7 +4715,7 @@
         {
          USE_SAFE_ALLOCA;
 
-          modify_region (current_buffer, start1, end2, 0);
+          modify_region_1 (start1, end2, false);
           record_change (start1, (end2 - start1));
           tmp_interval1 = copy_intervals (cur_intv, start1, len1);
           tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
@@ -4748,7 +4748,7 @@
          USE_SAFE_ALLOCA;
 
           record_change (start1, (end2 - start1));
-          modify_region (current_buffer, start1, end2, 0);
+          modify_region_1 (start1, end2, false);
 
           tmp_interval1 = copy_intervals (cur_intv, start1, len1);
           tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);

=== modified file 'src/insdel.c'
--- a/src/insdel.c      2012-09-15 07:06:56 +0000
+++ b/src/insdel.c      2012-12-03 14:13:06 +0000
@@ -1755,9 +1755,9 @@
 
   return deletion;
 }
-
-/* Call this if you're about to change the region of BUFFER from
-   character positions START to END.  This checks the read-only
+
+/* Call this if you're about to change the region of current buffer
+   from character positions START to END.  This checks the read-only
    properties of the region, calls the necessary modification hooks,
    and warns the next redisplay that it should pay attention to that
    area.
@@ -1766,16 +1766,11 @@
    Otherwise set CHARS_MODIFF to the new value of MODIFF.  */
 
 void
-modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
-              bool preserve_chars_modiff)
+modify_region_1 (ptrdiff_t start, ptrdiff_t end, bool preserve_chars_modiff)
 {
-  struct buffer *old_buffer = current_buffer;
-
-  set_buffer_internal (buffer);
-
   prepare_to_modify_buffer (start, end, NULL);
 
-  BUF_COMPUTE_UNCHANGED (buffer, start - 1, end);
+  BUF_COMPUTE_UNCHANGED (current_buffer, start - 1, end);
 
   if (MODIFF <= SAVE_MODIFF)
     record_first_change ();
@@ -1783,11 +1778,9 @@
   if (! preserve_chars_modiff)
     CHARS_MODIFF = MODIFF;
 
-  bset_point_before_scroll (buffer, Qnil);
-
-  set_buffer_internal (old_buffer);
+  bset_point_before_scroll (current_buffer, Qnil);
 }
-
+
 /* Check that it is okay to modify the buffer between START and END,
    which are char positions.
 

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-12-03 08:06:02 +0000
+++ b/src/lisp.h        2012-12-03 14:13:06 +0000
@@ -2796,7 +2796,7 @@
 extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool);
 extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t,
                                ptrdiff_t, ptrdiff_t, bool);
-extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, bool);
+extern void modify_region_1 (ptrdiff_t, ptrdiff_t, bool);
 extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
 extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t);
 extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t,

=== modified file 'src/textprop.c'
--- a/src/textprop.c    2012-10-01 06:36:54 +0000
+++ b/src/textprop.c    2012-12-03 14:13:06 +0000
@@ -85,8 +85,18 @@
   xsignal0 (Qtext_read_only);
 }
 
-
-
+/* Prepare to modify the region of BUFFER from START to END.  */
+
+static void
+modify_region (Lisp_Object buffer, Lisp_Object start, Lisp_Object end)
+{
+  struct buffer *buf = XBUFFER (buffer), *old = current_buffer;
+
+  set_buffer_internal (buf);
+  modify_region_1 (XINT (start), XINT (end), true);
+  set_buffer_internal (old);
+}
+
 /* Extract the interval at the position pointed to by BEGIN from
    OBJECT, a string or buffer.  Additionally, check that the positions
    pointed to by BEGIN and END are within the bounds of OBJECT, and
@@ -1164,7 +1174,7 @@
     }
 
   if (BUFFERP (object))
-    modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+    modify_region (object, start, end);
 
   /* We are at the beginning of interval I, with LEN chars to scan.  */
   for (;;)
@@ -1302,7 +1312,7 @@
     }
 
   if (BUFFERP (object) && !NILP (coherent_change_p))
-    modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+    modify_region (object, start, end);
 
   set_text_properties_1 (start, end, properties, object, i);
 
@@ -1451,7 +1461,7 @@
     }
 
   if (BUFFERP (object))
-    modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+    modify_region (object, start, end);
 
   /* We are at the beginning of an interval, with len to scan */
   for (;;)
@@ -1565,7 +1575,7 @@
          else if (LENGTH (i) == len)
            {
              if (!modified && BUFFERP (object))
-               modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+               modify_region (object, start, end);
              remove_properties (Qnil, properties, i, object);
              if (BUFFERP (object))
                signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1578,7 +1588,7 @@
              i = split_interval_left (i, len);
              copy_properties (unchanged, i);
              if (!modified && BUFFERP (object))
-               modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+               modify_region (object, start, end);
              remove_properties (Qnil, properties, i, object);
              if (BUFFERP (object))
                signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1589,7 +1599,7 @@
       if (interval_has_some_properties_list (properties, i))
        {
          if (!modified && BUFFERP (object))
-           modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+           modify_region (object, start, end);
          remove_properties (Qnil, properties, i, object);
          modified = 1;
        }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]