diff -u emacs-src/lisp/emacs-lisp/re-builder.el emacs-src/lisp/emacs-lisp/re-builder-new.el --- /lisp/emacs-lisp/re-builder.el 2021-08-02 20:47:39.226669281 -0700 +++ /lisp/emacs-lisp/re-builder-new.el 2021-08-02 20:37:27.442020958 -0700 @@ -642,16 +642,19 @@ (submatches 0) firstmatch here + start end firstmatch-after-here) (with-current-buffer reb-target-buffer (setq here (if reb-target-window (with-selected-window reb-target-window (window-point)) - (point))) + (point)) + start (if (region-active-p) (region-beginning) (point-min)) + end (if (region-active-p) (region-end) (point-max))) (reb-delete-overlays) - (goto-char (point-min)) + (goto-char start) (while (and (not (eobp)) - (re-search-forward re (point-max) t) + (re-search-forward re end t) (or (not reb-auto-match-limit) (< matches reb-auto-match-limit))) (when (and (= 0 (length (match-string 0))) Diff finished. Mon Aug 2 20:48:01 2021