changeset 3351:1795290d0fc8

(Info-get-token): Check that thesecond search succeeded.
author Richard M. Stallman <rms@gnu.org>
date Mon, 31 May 1993 17:56:14 +0000
parents c9689f8d0574
children 03a02339361a
files lisp/info.el
diffstat 1 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/info.el	Mon May 31 17:28:56 1993 +0000
+++ b/lisp/info.el	Mon May 31 17:56:14 1993 +0000
@@ -1052,19 +1052,20 @@
   (save-excursion
     (goto-char pos)
     (re-search-backward start (max (point-min) (- pos 200)) 'yes)
-    (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes)
-		(not (and (<= (match-beginning 0) pos)
-			  (> (match-end 0) pos)))))
-    (if (and (<= (match-beginning 0) pos)
-	     (> (match-end 0) pos))
-	(buffer-substring (match-beginning 1) (match-end 1))
-      (cond ((null errorstring)
-	     nil)
-	    ((eq errorstring t)
-	     (beep)
-	     nil)
-	    (t
-	     (error "No %s around position %d" errorstring pos))))))
+    (let (found)
+      (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes)
+		  (not (setq found (and (<= (match-beginning 0) pos)
+					(> (match-end 0) pos))))))
+      (if (and found (<= (match-beginning 0) pos)
+	       (> (match-end 0) pos))
+	  (buffer-substring (match-beginning 1) (match-end 1))
+	(cond ((null errorstring)
+	       nil)
+	      ((eq errorstring t)
+	       (beep)
+	       nil)
+	      (t
+	       (error "No %s around position %d" errorstring pos)))))))
 
 (defun Info-follow-nearest-node (click)
   "\\<Info-mode-map>Follow a node reference near point.