[Top][All Lists]

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

Re: Info-search-isearch

From: Juri Linkov
Subject: Re: Info-search-isearch
Date: Fri, 25 Feb 2005 21:59:57 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/22.0.50 (gnu/linux)

Currently multi-node isearch in Info ignores word search.  It searches
for a sequence of words only in the current node.  But it is useful to
search for words through multiple Info nodes.  I think search in Info
should support nonincremental and "half-incremental" word search.

Word search what I call "half-incremental" is an undocumented
feature that allows almost incremental search by typing
`C-s M-e C-w WORDS C-s', i.e. it starts as nonincremental search,
and after typing the second C-s in the minibuffer it continues
as incremental search.  I discovered this feature accidentally.
Perhaps, it should be documented in the Emacs manual?

Below is an implementation of word search for Info isearch which
duplicated in Lisp the C function `wordify' used by word search.

Index: lisp/info.el
RCS file: /cvsroot/emacs/emacs/lisp/info.el,v
retrieving revision 1.417
diff -u -r1.417 info.el
--- lisp/info.el        23 Feb 2005 17:03:17 -0000      1.417
+++ lisp/info.el        25 Feb 2005 19:55:18 -0000
@@ -1646,10 +1646,16 @@
   (Info-search regexp bound noerror count 'backward))
 (defun Info-isearch-search ()
-  (if (and Info-isearch-search (not isearch-word))
+  (if Info-isearch-search
       (lambda (string &optional bound noerror count)
        (condition-case nil
-           (progn
+           (if isearch-word
+               (Info-search (concat "\\b" (replace-regexp-in-string
+                                           "\\W+" "\\\\W+"
+                                           (replace-regexp-in-string
+                                            "^\\W+\\|\\W+$" "" string)) "\\b")
+                            bound noerror count
+                            (unless isearch-forward 'backward))
              (Info-search (if isearch-regexp string (regexp-quote string))
                           bound noerror count
                           (unless isearch-forward 'backward))
@@ -1659,7 +1665,7 @@
 (defun Info-isearch-wrap ()
-  (when (and Info-isearch-search (not isearch-word))
+  (when Info-isearch-search
     (if isearch-forward (Info-top-node) (Info-final-node))
     (goto-char (if isearch-forward (point-min) (point-max)))))

Juri Linkov

reply via email to

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