Mercurial > emacs
comparison lisp/info.el @ 51805:7a3de98ae801
(Info-search): If find invisible text, search again.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 07 Jul 2003 21:03:32 +0000 |
parents | abcb358beb61 |
children | 4ab63324776e |
comparison
equal
deleted
inserted
replaced
51804:c1f7c7481134 | 51805:7a3de98ae801 |
---|---|
1325 (when transient-mark-mode | 1325 (when transient-mark-mode |
1326 (deactivate-mark)) | 1326 (deactivate-mark)) |
1327 (when (equal regexp "") | 1327 (when (equal regexp "") |
1328 (setq regexp (car Info-search-history))) | 1328 (setq regexp (car Info-search-history))) |
1329 (when regexp | 1329 (when regexp |
1330 (let ((found ()) | 1330 (let (found beg-found give-up |
1331 (onode Info-current-node) | 1331 (onode Info-current-node) |
1332 (ofile Info-current-file) | 1332 (ofile Info-current-file) |
1333 (opoint (point)) | 1333 (opoint (point)) |
1334 (ostart (window-start)) | 1334 (ostart (window-start)) |
1335 (osubfile Info-current-subfile)) | 1335 (osubfile Info-current-subfile)) |
1336 (save-excursion | 1336 (save-excursion |
1337 (save-restriction | 1337 (save-restriction |
1338 (widen) | 1338 (widen) |
1339 (while (and (not give-up) | |
1340 (or (null found) | |
1341 (isearch-range-invisible beg-found found))) | |
1342 (if (re-search-forward regexp nil t) | |
1343 (setq found (point) beg-found (match-beginning 0)) | |
1344 (setq give-up t))))) | |
1345 ;; If no subfiles, give error now. | |
1346 (if give-up | |
1339 (if (null Info-current-subfile) | 1347 (if (null Info-current-subfile) |
1340 (progn (re-search-forward regexp) (setq found (point))) | 1348 (re-search-forward regexp) |
1341 (condition-case err | 1349 (setq found nil))) |
1342 (progn (re-search-forward regexp) (setq found (point))) | 1350 |
1343 (search-failed nil))))) | 1351 (unless found |
1344 (if (not found) ;can only happen in subfile case -- else would have erred | 1352 (unwind-protect |
1345 (unwind-protect | 1353 ;; Try other subfiles. |
1346 (let ((list ())) | 1354 (let ((list ())) |
1347 (save-excursion | 1355 (save-excursion |
1348 (set-buffer (marker-buffer Info-tag-table-marker)) | 1356 (set-buffer (marker-buffer Info-tag-table-marker)) |
1357 (goto-char (point-min)) | |
1358 (search-forward "\n\^_\nIndirect:") | |
1359 (save-restriction | |
1360 (narrow-to-region (point) | |
1361 (progn (search-forward "\n\^_") | |
1362 (1- (point)))) | |
1349 (goto-char (point-min)) | 1363 (goto-char (point-min)) |
1350 (search-forward "\n\^_\nIndirect:") | 1364 ;; Find the subfile we just searched. |
1351 (save-restriction | 1365 (search-forward (concat "\n" osubfile ": ")) |
1352 (narrow-to-region (point) | 1366 ;; Skip that one. |
1353 (progn (search-forward "\n\^_") | 1367 (forward-line 1) |
1354 (1- (point)))) | 1368 ;; Make a list of all following subfiles. |
1355 (goto-char (point-min)) | 1369 ;; Each elt has the form (VIRT-POSITION . SUBFILENAME). |
1356 ;; Find the subfile we just searched. | 1370 (while (not (eobp)) |
1357 (search-forward (concat "\n" osubfile ": ")) | 1371 (re-search-forward "\\(^.*\\): [0-9]+$") |
1358 ;; Skip that one. | 1372 (goto-char (+ (match-end 1) 2)) |
1359 (forward-line 1) | 1373 (setq list (cons (cons (+ (point-min) |
1360 ;; Make a list of all following subfiles. | 1374 (read (current-buffer))) |
1361 ;; Each elt has the form (VIRT-POSITION . SUBFILENAME). | 1375 (match-string-no-properties 1)) |
1362 (while (not (eobp)) | 1376 list)) |
1363 (re-search-forward "\\(^.*\\): [0-9]+$") | 1377 (goto-char (1+ (match-end 0)))) |
1364 (goto-char (+ (match-end 1) 2)) | 1378 ;; Put in forward order |
1365 (setq list (cons (cons (+ (point-min) | 1379 (setq list (nreverse list)))) |
1366 (read (current-buffer))) | 1380 (while list |
1367 (match-string-no-properties 1)) | 1381 (message "Searching subfile %s..." (cdr (car list))) |
1368 list)) | 1382 (Info-read-subfile (car (car list))) |
1369 (goto-char (1+ (match-end 0)))) | 1383 (setq list (cdr list)) |
1370 ;; Put in forward order | 1384 (setq give-up nil found nil) |
1371 (setq list (nreverse list)))) | 1385 (while (and (not give-up) |
1372 (while list | 1386 (or (null found) |
1373 (message "Searching subfile %s..." (cdr (car list))) | 1387 (isearch-range-invisible beg-found found))) |
1374 (Info-read-subfile (car (car list))) | |
1375 (setq list (cdr list)) | |
1376 (if (re-search-forward regexp nil t) | 1388 (if (re-search-forward regexp nil t) |
1377 (setq found (point) list ()))) | 1389 (setq found (point) beg-found (match-beginning 0)) |
1390 (setq give-up t))) | |
1391 (if give-up | |
1392 (setq found nil)) | |
1378 (if found | 1393 (if found |
1379 (message "") | 1394 (setq list nil))) |
1380 (signal 'search-failed (list regexp)))) | 1395 (if found |
1381 (if (not found) | 1396 (message "") |
1382 (progn (Info-read-subfile osubfile) | 1397 (signal 'search-failed (list regexp)))) |
1383 (goto-char opoint) | 1398 (if (not found) |
1384 (Info-select-node) | 1399 (progn (Info-read-subfile osubfile) |
1385 (set-window-start (selected-window) ostart))))) | 1400 (goto-char opoint) |
1401 (Info-select-node) | |
1402 (set-window-start (selected-window) ostart))))) | |
1386 (widen) | 1403 (widen) |
1387 (goto-char found) | 1404 (goto-char found) |
1388 (Info-select-node) | 1405 (Info-select-node) |
1389 ;; Use string-equal, not equal, to ignore text props. | 1406 ;; Use string-equal, not equal, to ignore text props. |
1390 (or (and (string-equal onode Info-current-node) | 1407 (or (and (string-equal onode Info-current-node) |