diff options
author | Richard M. Stallman <[email protected]> | 1993-05-31 17:56:14 +0000 |
---|---|---|
committer | Richard M. Stallman <[email protected]> | 1993-05-31 17:56:14 +0000 |
commit | 373377edfdc00ed27c8d09362fb3e69d2487a7be (patch) | |
tree | fa2e62df486e6fef516690c8c002d0b62a842232 | |
parent | e8544af27e95c7d051d13075bfbc66b4e3f8fa9c (diff) |
(Info-get-token): Check that thesecond search succeeded.
-rw-r--r-- | lisp/info.el | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/info.el b/lisp/info.el index 2a929c95d4..8176ce6934 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1052,19 +1052,20 @@ SIG optional fourth argument, controls action on no match (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. |