emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Info-search-isearch


From: Juri Linkov
Subject: Info-search-isearch
Date: Tue, 28 Dec 2004 04:21:11 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Currently only regexp isearch invoked with M-C-s can use `Info-search'
and search through multiple Info nodes.  But it would be better if
normal C-s isearch searched through multiple nodes as well.

Maybe some users will not like this.  So a new user option could be
added to info.el with the default t:

Index: lisp/info.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/info.el,v
retrieving revision 1.413
diff -u -r1.413 info.el
--- lisp/info.el        13 Dec 2004 19:31:32 -0000      1.413
+++ lisp/info.el        28 Dec 2004 02:17:19 -0000
@@ -197,6 +201,15 @@
   :type 'regexp
   :group 'info)
 
+(defcustom Info-search-isearch t
+  "*If non-nil, isearch invoked in Info mode uses `Info-search' function.
+This allows isearch to search through multiple nodes.
+When isearch fails, it wraps and restarts the search from the
+top/final node depending on search direction."
+  :version "21.4"
+  :type 'boolean
+  :group 'info)
+
 (defcustom Info-mode-hook
   ;; Try to obey obsolete Info-fontify settings.
   (unless (and (boundp 'Info-fontify) (null Info-fontify))
@@ -1632,23 +1646,24 @@
   (Info-search regexp bound noerror count 'backward))
 
 (defun Info-isearch-search ()
-  (cond
-   (isearch-word
-    (if isearch-forward 'word-search-forward 'word-search-backward))
-   (isearch-regexp
-    (lambda (regexp bound noerror)
-      (condition-case nil
-          (progn
-            (Info-search regexp bound noerror nil
-                         (unless isearch-forward 'backward))
-            (point))
-        (error nil))))
-   (t
-    (if isearch-forward 'search-forward 'search-backward))))
+  (if (and Info-search-isearch (not isearch-word))
+      (lambda (string &optional bound noerror count)
+       (condition-case nil
+           (progn
+             (Info-search (if isearch-regexp string (regexp-quote string))
+                          bound noerror count
+                          (unless isearch-forward 'backward))
+             (point))
+         (error nil)))
+    (let ((isearch-search-fun-function nil))
+      (isearch-search-fun))))
 
 (defun Info-isearch-wrap ()
-  (if isearch-regexp
-      (if isearch-forward (Info-top-node) (Info-final-node))
+  (when (and Info-search-isearch (not isearch-word))
+    (if isearch-forward (Info-top-node) (Info-final-node))
     (goto-char (if isearch-forward (point-min) (point-max)))))
 
 (defun Info-isearch-push-state ()

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]