summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-02-11 21:07:59 +0000
committerKarl Heuer <kwzh@gnu.org>1994-02-11 21:07:59 +0000
commit237e6ab0561e86e787b2ccd129f009aa06d81c27 (patch)
treef9ef8b2ae9a7e082e31f02dca03c7e5218c2e317 /lisp/replace.el
parentdd24e6a699b823ed3609a9cb98350ae98f54ed42 (diff)
downloademacs-237e6ab0561e86e787b2ccd129f009aa06d81c27.tar.gz
(perform-replace): Check for empty stack.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index bf87d12c194..ab7f2b13ced 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -514,12 +514,16 @@ which will run faster and probably do exactly what you want."
(setq keep-going nil)
(setq done t))
((eq def 'backup)
- (let ((elt (car stack)))
- (goto-char (car elt))
- (setq replaced (eq t (cdr elt)))
- (or replaced
- (store-match-data (cdr elt)))
- (setq stack (cdr stack))))
+ (if stack
+ (let ((elt (car stack)))
+ (goto-char (car elt))
+ (setq replaced (eq t (cdr elt)))
+ (or replaced
+ (store-match-data (cdr elt)))
+ (setq stack (cdr stack)))
+ (message "No previous match")
+ (ding 'no-terminate)
+ (sit-for 1)))
((eq def 'act)
(or replaced
(replace-match next-replacement nocasify literal))