]> git.eshelyaron.com Git - emacs.git/commitdiff
(replace_range): Delete argument `markers`
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 6 Mar 2025 16:21:42 +0000 (11:21 -0500)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 10:19:47 +0000 (11:19 +0100)
* src/lisp.h (replace_range):
* src/insdel.c (replace_range): Delete argument `markers`, always true.
* src/editfns.c (Ftranslate_region_internal):
* src/cmds.c (internal_self_insert):
* src/search.c (Freplace_match): Adjust callers accordingly.

(cherry picked from commit 1133c081d6787fdc9634388b33e04382182be5b0)

src/cmds.c
src/editfns.c
src/insdel.c
src/lisp.h
src/search.c

index 20893e856477657ebd3c16630f09c0751b82cd9c..9985855a0cef572dc31c088b3a1a24d9e8477d8b 100644 (file)
@@ -458,7 +458,7 @@ internal_self_insert (int c, EMACS_INT n)
       ptrdiff_t to;
       if (ckd_add (&to, PT, chars_to_delete))
        to = PTRDIFF_MAX;
-      replace_range (PT, to, string, true, true, true, false);
+      replace_range (PT, to, string, true, true, false);
       Fforward_char (make_fixnum (n));
     }
   else if (n > 1)
index 12700527ef370e80d1d0972abc2689643bfd92fc..0eeb8d4fb536f7b55bd95afdbf37b446bb59bee8 100644 (file)
@@ -2520,7 +2520,7 @@ It returns the number of characters changed.  */)
                     but it should handle multibyte characters correctly.  */
                  string = make_multibyte_string ((char *) str, 1, str_len);
                  replace_range (pos, pos + 1, string,
-                                true, false, true, false);
+                                true, false, false);
                  len = str_len;
                }
              else
@@ -2564,7 +2564,7 @@ It returns the number of characters changed.  */)
                = (VECTORP (val)
                   ? Fconcat (1, &val)
                   : Fmake_string (make_fixnum (1), val, Qnil));
-             replace_range (pos, pos + len, string, true, false, true, false);
+             replace_range (pos, pos + len, string, true, false, false);
              pos_byte += SBYTES (string);
              pos += SCHARS (string);
              characters_changed += SCHARS (string);
index d3917bf668cd55b81f33ab0729fbf90466e007e1..3617d2f0102632e5e5d9d12dce405b1ccf7451df 100644 (file)
@@ -1425,7 +1425,7 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte,
 
 void
 replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
-               bool run_mod_hooks, bool inherit, bool markers,
+               bool run_mod_hooks, bool inherit,
                bool adjust_match_data)
 {
   ptrdiff_t inschars = SCHARS (new);
@@ -1541,19 +1541,8 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
   eassert (GPT <= GPT_BYTE);
 
   /* Adjust markers for the deletion and the insertion.  */
-  if (markers)
-    adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
-                               inschars, outgoing_insbytes);
-  else
-    {
-      /* The character positions of the markers remain intact, but we
-        still need to update their byte positions, because the
-        deleted and the inserted text might have multibyte sequences
-        which make the original byte positions of the markers
-        invalid.  */
-      adjust_markers_bytepos (from, from_byte, from + inschars,
-                             from_byte + outgoing_insbytes, true);
-    }
+  adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
+                             inschars, outgoing_insbytes);
 
   offset_intervals (current_buffer, from, inschars - nchars_del);
 
index 1d53bf544d53c4e26cc7ed2867a791fe68f4fb9d..e013ee7e419abb0e7cce820a8ce4673049bab950 100644 (file)
@@ -4361,8 +4361,7 @@ extern void adjust_markers_for_insert (ptrdiff_t, ptrdiff_t,
                                       ptrdiff_t, ptrdiff_t, bool);
 extern void adjust_markers_bytepos (ptrdiff_t, ptrdiff_t,
                                    ptrdiff_t, ptrdiff_t, int);
-extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool,
-                          bool, bool);
+extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool, bool);
 extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
                             const char *, ptrdiff_t, ptrdiff_t, bool);
 extern void syms_of_insdel (void);
index c8eb04e388b49b1ca29aa7c8f97dce301f7be5dc..89bc7e916127e809abb62438d0129a2b363fa3ef 100644 (file)
@@ -2761,7 +2761,7 @@ since only regular expressions have distinguished subexpressions.  */)
   newpoint = sub_start + SCHARS (newtext);
 
   /* Replace the old text with the new in the cleanest possible way.  */
-  replace_range (sub_start, sub_end, newtext, true, false, true, true);
+  replace_range (sub_start, sub_end, newtext, true, false, true);
 
   if (case_action == all_caps)
     Fupcase_region (make_fixnum (search_regs.start[sub]),