From 237e6ab0561e86e787b2ccd129f009aa06d81c27 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Fri, 11 Feb 1994 21:07:59 +0000 Subject: [PATCH] (perform-replace): Check for empty stack. --- lisp/replace.el | 16 ++++++++++------ 1 file 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))