changeset 94259:2741bbf61004

(Info-search): In two similar places that skip undesired search matches move code to Info-search-success-function, and call `isearch-success-function' instead. (Info-search-success-function): New function copied from code in Info-search. Replace isearch-range-invisible with text-property-not-all that checks for 'invisible and 'display properties to skip partially invisible matches (whose display properties were set by Info-fontify-node). (Info-mode): Set buffer-local isearch-success-function to Info-search-success-function.
author Juri Linkov <juri@jurta.org>
date Tue, 22 Apr 2008 19:57:58 +0000
parents 080f9df8b170
children 5be46d0e04dd
files lisp/info.el
diffstat 1 files changed, 28 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/info.el	Tue Apr 22 19:56:17 2008 +0000
+++ b/lisp/info.el	Tue Apr 22 19:57:58 2008 +0000
@@ -1625,20 +1625,8 @@
 				(1- (point)))
 			      (point-max)))
 	  (while (and (not give-up)
-		      (save-match-data
-			(or (null found)
-			    (if backward
-				(isearch-range-invisible found beg-found)
-			      (isearch-range-invisible beg-found found))
-			    ;; Skip node header line
-			    (and (save-excursion (forward-line -1)
-						 (looking-at "\^_"))
-				 (forward-line (if backward -1 1)))
-			    ;; Skip Tag Table node
-			    (save-excursion
-			      (and (search-backward "\^_" nil t)
-				   (looking-at
-				    "\^_\n\\(Tag Table\\|Local Variables\\)"))))))
+		      (or (null found)
+			  (not (funcall isearch-success-function beg-found found))))
 	    (let ((search-spaces-regexp
 		   (if (or (not isearch-mode) isearch-regexp)
 		       Info-search-whitespace-regexp)))
@@ -1717,20 +1705,8 @@
 		(setq list (cdr list))
 		(setq give-up nil found nil)
 		(while (and (not give-up)
-			    (save-match-data
-			      (or (null found)
-				  (if backward
-				      (isearch-range-invisible found beg-found)
-				    (isearch-range-invisible beg-found found))
-				  ;; Skip node header line
-				  (and (save-excursion (forward-line -1)
-						       (looking-at "\^_"))
-				       (forward-line (if backward -1 1)))
-				  ;; Skip Tag Table node
-				  (save-excursion
-				    (and (search-backward "\^_" nil t)
-					 (looking-at
-					  "\^_\n\\(Tag Table\\|Local Variables\\)"))))))
+			    (or (null found)
+				(not (funcall isearch-success-function beg-found found))))
 		  (let ((search-spaces-regexp
 			 (if (or (not isearch-mode) isearch-regexp)
 			     Info-search-whitespace-regexp)))
@@ -1836,6 +1812,28 @@
 
 (defun Info-isearch-start ()
   (setq Info-isearch-initial-node nil))
+
+(defun Info-search-success-function (beg-found found)
+  "Skip invisible text, node header line and Tag Table node."
+  (save-match-data
+    (let ((backward (< found beg-found)))
+      (not
+       (or
+	(if backward
+	    (or (text-property-not-all found beg-found 'invisible nil)
+		(text-property-not-all found beg-found 'display nil))
+	  (or (text-property-not-all beg-found found 'invisible nil)
+	      (text-property-not-all beg-found found 'display nil)))
+	;; Skip node header line
+	(and (save-excursion (forward-line -1)
+			     (looking-at "\^_"))
+	     (forward-line (if backward -1 1)))
+	;; Skip Tag Table node
+	(save-excursion
+	  (and (search-backward "\^_" nil t)
+	       (looking-at
+		"\^_\n\\(Tag Table\\|Local Variables\\)"))))))))
+
 
 (defun Info-extract-pointer (name &optional errorname)
   "Extract the value of the node-pointer named NAME.
@@ -3458,6 +3456,8 @@
        'Info-isearch-wrap)
   (set (make-local-variable 'isearch-push-state-function)
        'Info-isearch-push-state)
+  (set (make-local-variable 'isearch-success-function)
+       'Info-search-success-function)
   (set (make-local-variable 'search-whitespace-regexp)
        Info-search-whitespace-regexp)
   (set (make-local-variable 'revert-buffer-function)