changeset 5905:a068f8b61f2a

(perform-replace): Check for empty stack.
author Karl Heuer <kwzh@gnu.org>
date Fri, 11 Feb 1994 21:07:59 +0000
parents 7f95b8e1ec44
children 5b5d6e2f65d1
files lisp/replace.el
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/replace.el	Fri Feb 11 19:06:00 1994 +0000
+++ b/lisp/replace.el	Fri Feb 11 21:07:59 1994 +0000
@@ -514,12 +514,16 @@
 		       (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))