From ca53db337fe95e923eb0b030999d313e16b100a9 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 5 Nov 2004 19:06:24 +0000 Subject: [PATCH] (Info-search): Don't search in node header lines and file headers. --- lisp/info.el | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/lisp/info.el b/lisp/info.el index 2e0ddd0fb02..8aaf7755df2 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1476,11 +1476,21 @@ If DIRECTION is `backward', search in the reverse direction." (save-excursion (save-restriction (widen) + (when backward + ;; Hide Info file header for backward search + (narrow-to-region (save-excursion + (goto-char (point-min)) + (search-forward "\n\^_") + (1- (point))) + (point-max))) (while (and (not give-up) (or (null found) (if backward (isearch-range-invisible found beg-found) - (isearch-range-invisible beg-found found)))) + (isearch-range-invisible beg-found found)) + ;; Skip node header line + (save-excursion (forward-line -1) + (looking-at "\^_")))) (if (if backward (re-search-backward regexp bound t) (re-search-forward regexp bound t)) @@ -1531,14 +1541,24 @@ If DIRECTION is `backward', search in the reverse direction." (while list (message "Searching subfile %s..." (cdr (car list))) (Info-read-subfile (car (car list))) - (if backward (goto-char (point-max))) + (when backward + ;; Hide Info file header for backward search + (narrow-to-region (save-excursion + (goto-char (point-min)) + (search-forward "\n\^_") + (1- (point))) + (point-max)) + (goto-char (point-max))) (setq list (cdr list)) (setq give-up nil found nil) (while (and (not give-up) (or (null found) (if backward (isearch-range-invisible found beg-found) - (isearch-range-invisible beg-found found)))) + (isearch-range-invisible beg-found found)) + ;; Skip node header line + (save-excursion (forward-line -1) + (looking-at "\^_")))) (if (if backward (re-search-backward regexp nil t) (re-search-forward regexp nil t)) -- 2.39.5