summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index abb59a674e3..d92fb6809ef 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -810,9 +810,12 @@ a previously found match."
(keep-lines-read-args "How many matches for regexp"))
(save-excursion
(if rstart
- (progn
- (goto-char (min rstart rend))
- (setq rend (max rstart rend)))
+ (if rend
+ (progn
+ (goto-char (min rstart rend))
+ (setq rend (max rstart rend)))
+ (goto-char rstart)
+ (setq rend (point-max)))
(if (and interactive transient-mark-mode mark-active)
(setq rstart (region-beginning)
rend (region-end))