diff lisp/info.el @ 24963:a78f0c2654d6

(Info-search): Don't lose with empty regexp.
author Dave Love <fx@gnu.org>
date Mon, 19 Jul 1999 22:21:44 +0000
parents a6ad37f4f6cb
children 784d7bc2a991
line wrap: on
line diff
--- a/lisp/info.el	Mon Jul 19 22:17:17 1999 +0000
+++ b/lisp/info.el	Mon Jul 19 22:21:44 1999 +0000
@@ -958,60 +958,61 @@
   (if (equal regexp "")
       (setq regexp Info-last-search)
     (setq Info-last-search regexp))
-  (let ((found ()) current
-	(onode Info-current-node)
-	(ofile Info-current-file)
-	(opoint (point))
-	(ostart (window-start))
-	(osubfile Info-current-subfile))
-    (save-excursion
-      (save-restriction
-	(widen)
-	(if (null Info-current-subfile)
-	    (progn (re-search-forward regexp) (setq found (point)))
-	  (condition-case err
+  (when regexp
+    (let ((found ()) current
+	  (onode Info-current-node)
+	  (ofile Info-current-file)
+	  (opoint (point))
+	  (ostart (window-start))
+	  (osubfile Info-current-subfile))
+      (save-excursion
+	(save-restriction
+	  (widen)
+	  (if (null Info-current-subfile)
 	      (progn (re-search-forward regexp) (setq found (point)))
-	    (search-failed nil)))))
-    (if (not found) ;can only happen in subfile case -- else would have erred
-	(unwind-protect
-	    (let ((list ()))
-	      (save-excursion
-		(set-buffer (marker-buffer Info-tag-table-marker))
-		(goto-char (point-min))
-		(search-forward "\n\^_\nIndirect:")
-		(save-restriction
-		  (narrow-to-region (point)
-				    (progn (search-forward "\n\^_")
-					   (1- (point))))
+	    (condition-case err
+		(progn (re-search-forward regexp) (setq found (point)))
+	      (search-failed nil)))))
+      (if (not found) ;can only happen in subfile case -- else would have erred
+	  (unwind-protect
+	      (let ((list ()))
+		(save-excursion
+		  (set-buffer (marker-buffer Info-tag-table-marker))
 		  (goto-char (point-min))
-		  (search-forward (concat "\n" osubfile ": "))
-		  (beginning-of-line)
-		  (while (not (eobp))
-		    (re-search-forward "\\(^.*\\): [0-9]+$")
-		    (goto-char (+ (match-end 1) 2))
-		    (setq list (cons (cons (read (current-buffer))
-					   (buffer-substring
-					    (match-beginning 1) (match-end 1)))
-				     list))
-		    (goto-char (1+ (match-end 0))))
-		  (setq list (nreverse list)
-			current (car (car list))
-			list (cdr list))))
-	      (while list
-		(message "Searching subfile %s..." (cdr (car list)))
-		(Info-read-subfile (car (car list)))
-		(setq list (cdr list))
-;;		(goto-char (point-min))
-		(if (re-search-forward regexp nil t)
-		    (setq found (point) list ())))
-	      (if found
-		  (message "")
-		(signal 'search-failed (list regexp))))
-	  (if (not found)
-	      (progn (Info-read-subfile osubfile)
-		     (goto-char opoint)
-		     (Info-select-node)
-		     (set-window-start (selected-window) ostart)))))
+		  (search-forward "\n\^_\nIndirect:")
+		  (save-restriction
+		    (narrow-to-region (point)
+				      (progn (search-forward "\n\^_")
+					     (1- (point))))
+		    (goto-char (point-min))
+		    (search-forward (concat "\n" osubfile ": "))
+		    (beginning-of-line)
+		    (while (not (eobp))
+		      (re-search-forward "\\(^.*\\): [0-9]+$")
+		      (goto-char (+ (match-end 1) 2))
+		      (setq list (cons (cons (read (current-buffer))
+					     (buffer-substring
+					      (match-beginning 1) (match-end 1)))
+				       list))
+		      (goto-char (1+ (match-end 0))))
+		    (setq list (nreverse list)
+			  current (car (car list))
+			  list (cdr list))))
+		(while list
+		  (message "Searching subfile %s..." (cdr (car list)))
+		  (Info-read-subfile (car (car list)))
+		  (setq list (cdr list))
+;;;		(goto-char (point-min))
+		  (if (re-search-forward regexp nil t)
+		      (setq found (point) list ())))
+		(if found
+		    (message "")
+		  (signal 'search-failed (list regexp))))
+	    (if (not found)
+		(progn (Info-read-subfile osubfile)
+		       (goto-char opoint)
+		       (Info-select-node)
+		       (set-window-start (selected-window) ostart)))))
     (widen)
     (goto-char found)
     (Info-select-node)
@@ -1019,7 +1020,7 @@
     (or (and (string-equal onode Info-current-node)
 	     (equal ofile Info-current-file))
 	(setq Info-history (cons (list ofile onode opoint)
-				 Info-history)))))
+				 Info-history))))))
 
 ;; Extract the value of the node-pointer named NAME.
 ;; If there is none, use ERRORNAME in the error message;