diff options
| author | Richard M. Stallman | 2003-07-07 21:03:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-07-07 21:03:32 +0000 |
| commit | 774f8aee6f6b50aba51319e329b7d57c94e5da14 (patch) | |
| tree | c58cb4647c7b4417b677ea896a69b0a194b64a2c | |
| parent | 7f8e0f51fd59f09da7aaab71e86b9d83db2777fa (diff) | |
| download | emacs-774f8aee6f6b50aba51319e329b7d57c94e5da14.tar.gz emacs-774f8aee6f6b50aba51319e329b7d57c94e5da14.zip | |
(Info-search): If find invisible text, search again.
| -rw-r--r-- | lisp/info.el | 105 |
1 files changed, 61 insertions, 44 deletions
diff --git a/lisp/info.el b/lisp/info.el index 64fe0687f95..76f28e9af88 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -1327,7 +1327,7 @@ If FORK is a string, it is the name to use for the new buffer." | |||
| 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)) |
| @@ -1336,53 +1336,70 @@ If FORK is a string, it is the name to use for the new buffer." | |||
| 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) |