Fix 'replace-regexp' in WDired
authorEli Zaretskii <eliz@gnu.org>
Sat, 21 Sep 2024 09:26:24 +0000 (12:26 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 21 Sep 2024 09:26:24 +0000 (12:26 +0300)
* src/search.c (Freplace_match): Revert the search.c part of the
change from Apr 7, 2024, which aims to fix bug#65451, but causes
bug#73018.  Do not merge to master.

* test/src/editfns-tests.el
(editfns-tests--before/after-change-functions): Expect this test
to fail.

src/search.c
test/src/editfns-tests.el

index 2ff8b0599c4baa625e8e1b11edd9371cca10c93d..9265425d6cd6362166f0ee4375c961f68ed2f9de 100644 (file)
@@ -2762,7 +2762,6 @@ since only regular expressions have distinguished subexpressions.  */)
 
   /* Replace the old text with the new in the cleanest possible way.  */
   replace_range (sub_start, sub_end, newtext, 1, 0, 1, true, true);
-  signal_after_change (sub_start, sub_end - sub_start, SCHARS (newtext));
 
   if (case_action == all_caps)
     Fupcase_region (make_fixnum (search_regs.start[sub]),
@@ -2787,6 +2786,7 @@ since only regular expressions have distinguished subexpressions.  */)
   /* Now move point "officially" to the end of the inserted replacement.  */
   move_if_not_intangible (newpoint);
 
+  signal_after_change (sub_start, sub_end - sub_start, SCHARS (newtext));
   update_compositions (sub_start, newpoint, CHECK_BORDER);
 
   return Qnil;
index a02bab73c09c0158e4f4dc3ec58b09486e33ff60..b0a67d0f6ac72bbe8c6205b5b7ebb394c8187f82 100644 (file)
             sanity-check-change-functions-errors)))
 
 (ert-deftest editfns-tests--before/after-change-functions ()
+  :expected-result :failed
   (with-temp-buffer
     (add-hook 'before-change-functions
               #'sanity-check-change-functions-before nil t)