comparison lisp/info.el @ 15055:60ff6e57ddbd

(Info-next-reference, Info-prev-reference): Add optional argument RECUR to avoid infinite recursion on malformed nodes.
author Richard M. Stallman <rms@gnu.org>
date Sun, 21 Apr 1996 01:47:02 +0000
parents f77b58df548c
children f9d06e4e877c
comparison
equal deleted inserted replaced
15054:df34d8bec5fc 15055:60ff6e57ddbd
1240 (search-forward "\n* Menu:" nil t)))) 1240 (search-forward "\n* Menu:" nil t))))
1241 (if (or virtual-end (pos-visible-in-window-p (point-min))) 1241 (if (or virtual-end (pos-visible-in-window-p (point-min)))
1242 (Info-last-preorder) 1242 (Info-last-preorder)
1243 (scroll-down)))) 1243 (scroll-down))))
1244 1244
1245 (defun Info-next-reference () 1245 (defun Info-next-reference (&optional recur)
1246 "Move cursor to the next cross-reference or menu item in the node." 1246 "Move cursor to the next cross-reference or menu item in the node."
1247 (interactive) 1247 (interactive)
1248 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:") 1248 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:")
1249 (old-pt (point))) 1249 (old-pt (point)))
1250 (or (eobp) (forward-char 1)) 1250 (or (eobp) (forward-char 1))
1255 (progn 1255 (progn
1256 (goto-char old-pt) 1256 (goto-char old-pt)
1257 (error "No cross references in this node"))))) 1257 (error "No cross references in this node")))))
1258 (goto-char (match-beginning 0)) 1258 (goto-char (match-beginning 0))
1259 (if (looking-at "\\* Menu:") 1259 (if (looking-at "\\* Menu:")
1260 (Info-next-reference)))) 1260 (if recur
1261 1261 (error "No cross references in this node")
1262 (defun Info-prev-reference () 1262 (Info-next-reference t)))))
1263
1264 (defun Info-prev-reference (&optional recur)
1263 "Move cursor to the previous cross-reference or menu item in the node." 1265 "Move cursor to the previous cross-reference or menu item in the node."
1264 (interactive) 1266 (interactive)
1265 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:") 1267 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:")
1266 (old-pt (point))) 1268 (old-pt (point)))
1267 (or (re-search-backward pat nil t) 1269 (or (re-search-backward pat nil t)
1271 (progn 1273 (progn
1272 (goto-char old-pt) 1274 (goto-char old-pt)
1273 (error "No cross references in this node"))))) 1275 (error "No cross references in this node")))))
1274 (goto-char (match-beginning 0)) 1276 (goto-char (match-beginning 0))
1275 (if (looking-at "\\* Menu:") 1277 (if (looking-at "\\* Menu:")
1276 (Info-prev-reference)))) 1278 (if recur
1279 (error "No cross references in this node")
1280 (Info-prev-reference t)))))
1277 1281
1278 (defun Info-index (topic) 1282 (defun Info-index (topic)
1279 "Look up a string in the index for this file. 1283 "Look up a string in the index for this file.
1280 The index is defined as the first node in the top-level menu whose 1284 The index is defined as the first node in the top-level menu whose
1281 name contains the word \"Index\", plus any immediately following 1285 name contains the word \"Index\", plus any immediately following