]> git.eshelyaron.com Git - emacs.git/commitdiff
(replace_range): Delete last arg, always the negation of the first bool
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 18 Feb 2025 15:05:34 +0000 (10:05 -0500)
committerEshel Yaron <me@eshelyaron.com>
Tue, 18 Feb 2025 21:33:27 +0000 (22:33 +0100)
* src/insdel.c (replace_range): Merge last arg, with `prepare`.
Rename `prepare` to `run-mode-hooks`.
* src/lisp.h (replace_range): Adjust accordingly.
* src/editfns.c (Ftranslate_region_internal):
* src/cmds.c (internal_self_insert):
* src/search.c (Freplace_match): Adjust callers.

(cherry picked from commit 41624d94cec98c1239c4fc9bb624e55ce0606068)

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

index 7179822c21ce93353582734a353b0c47ab38a346..20893e856477657ebd3c16630f09c0751b82cd9c 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, 1, 1, 1, 0, false);
+      replace_range (PT, to, string, true, true, true, false);
       Fforward_char (make_fixnum (n));
     }
   else if (n > 1)
index 5a5db32cc68ef67377e563c5c74866d6ce150f07..8fe2ecf1a0387ea3a22bd8d924d170efcd38d24f 100644 (file)
@@ -2518,7 +2518,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, false);
+                                true, false, true, false);
                  len = str_len;
                }
              else
@@ -2562,8 +2562,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,
-                            false);
+             replace_range (pos, pos + len, string, true, false, true, false);
              pos_byte += SBYTES (string);
              pos += SCHARS (string);
              characters_changed += SCHARS (string);
index 57e980188728a3d7040a9b042e731b1d87558e65..d3917bf668cd55b81f33ab0729fbf90466e007e1 100644 (file)
@@ -1425,8 +1425,8 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte,
 
 void
 replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
-               bool prepare, bool inherit, bool markers,
-               bool adjust_match_data, bool inhibit_mod_hooks)
+               bool run_mod_hooks, bool inherit, bool markers,
+               bool adjust_match_data)
 {
   ptrdiff_t inschars = SCHARS (new);
   ptrdiff_t insbytes = SBYTES (new);
@@ -1440,7 +1440,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
 
   deletion = Qnil;
 
-  if (prepare)
+  if (run_mod_hooks)
     {
       ptrdiff_t range_length = to - from;
       prepare_to_modify_buffer (from, to, &from);
@@ -1584,7 +1584,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
   if (adjust_match_data)
     update_search_regs (from, to, from + SCHARS (new));
 
-  if (!inhibit_mod_hooks)
+  if (run_mod_hooks)
     {
       signal_after_change (from, nchars_del, GPT - from);
       update_compositions (from, GPT, CHECK_BORDER);
index 5704c7fa7f1d714b9ebb0834c2793924146c1cec..ff999c7731d83144c094716eab543dafc0482074 100644 (file)
@@ -4361,7 +4361,7 @@ extern void adjust_markers_for_insert (ptrdiff_t, ptrdiff_t,
 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, 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 81466be323aefbabc86eda2a0712efa95c1fc279..c8eb04e388b49b1ca29aa7c8f97dce301f7be5dc 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, 1, 0, 1, true, false);
+  replace_range (sub_start, sub_end, newtext, true, false, true, true);
 
   if (case_action == all_caps)
     Fupcase_region (make_fixnum (search_regs.start[sub]),