From 2c87785b7b9948b761621170ebea67084af82d55 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Sep 2024 12:30:49 +0300 Subject: [PATCH] Fix 'regexp-replace' in WDired * src/search.c (Freplace_match): Remove the test that search_regs.num_regs != num_regs. It is deemed unnecessary now, and could produce false positives. (Bug#73018) (cherry picked from commit a513f2a4dd5a7f52abf48f06cf32fcfab765c373) --- src/search.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/search.c b/src/search.c index 087b99d87f3..24b1ee6bd3f 100644 --- a/src/search.c +++ b/src/search.c @@ -2772,16 +2772,6 @@ since only regular expressions have distinguished subexpressions. */) Fupcase_initials_region (make_fixnum (search_regs.start[sub]), make_fixnum (newpoint), Qnil); - /* The replace_range etc. functions can trigger modification hooks - (see signal_before_change and signal_after_change). Try to error - out if these hooks clobber the match data since clobbering can - result in confusing bugs. We used to check for changes in - search_regs start and end, but that fails if modification hooks - remove or add text earlier in the buffer, so just check num_regs - now. */ - if (search_regs.num_regs != num_regs) - error ("Match data clobbered by buffer modification hooks"); - /* Put point back where it was in the text, if possible. */ TEMP_SET_PT (clip_to_bounds (BEGV, opoint + (opoint <= 0 ? ZV : 0), ZV)); /* Now move point "officially" to the end of the inserted replacement. */ -- 2.39.5