summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-12-08 07:37:55 +0000
committerRichard M. Stallman <rms@gnu.org>1996-12-08 07:37:55 +0000
commit2f3a1b4a54441b312b5f7d952ab769c5e9906ef0 (patch)
tree800824202eb56d605ece7fd1a4dd2612e90da55e
parentf051bd7f50da59f05e8b0b5a28cadd5742e1d86d (diff)
downloademacs-2f3a1b4a54441b312b5f7d952ab769c5e9906ef0.tar.gz
(Info-get-token): Find tokens where START matches
-rw-r--r--lisp/info.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/info.el b/lisp/info.el
index c3df1a843be..ba24cec25d3 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1471,7 +1471,16 @@ SIG optional fourth argument, controls action on no match
a string: signal an error, using that string."
(save-excursion
(goto-char pos)
- (re-search-backward start (max (point-min) (- pos 200)) 'yes)
+ ;; First look for a match for START that goes across POS.
+ (while (and (not (bobp)) (> (point) (- pos (length start)))
+ (not (looking-at start)))
+ (forward-char -1))
+ ;; If we did not find one, search back for START
+ ;; (this finds only matches that end at or before POS).
+ (or (looking-at start)
+ (progn
+ (goto-char pos)
+ (re-search-backward start (max (point-min) (- pos 200)) 'yes)))
(let (found)
(while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes)
(not (setq found (and (<= (match-beginning 0) pos)