GNU bug report logs - #1352
23.0.60; isearch-success-function

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Sat, 15 Nov 2008 23:45:03 UTC

Severity: normal

Merged with 1566

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <emacs-pretest-bug <at> gnu.org>
Subject: bug#1352: 23.0.60; isearch-success-function
Date: Sat, 15 Nov 2008 15:39:35 -0800
The name of `isearch-success-function' seems wrong, if we believe the
doc string. The doc string suggests that it is a predicate that
filters the search hits that would otherwise be available. That's very
general. If that's true, then the name should reflect this meaning -
perhaps `isearch-predicate'.
 
Similarly, the name of `isearch-success-function-default' should be
something that suggests its very limited meaning: it filters search
hits to those that are visible, unless invisible text too can be
searched. It is a particular kind of search filter, and its name
should reflect that particularity.
 
Also, in `isearch-search', there is this:
 
;; Clear RETRY unless we matched some invisible text
;; and we aren't supposed to do that.
(if (or (not isearch-success)
        (bobp) (eobp)
        (= (match-beginning 0) (match-end 0))
        (funcall isearch-success-function
                 (match-beginning 0) (match-end 0)))
    (setq retry nil)))
 
The code here is general; it is not related to text visibility. So the
comment is not general enough. It is a vestige that is appropriate now
only when the value of `isearch-success-function' is
`isearch-success-function-default'. The comment should instead say
that we clear RETRY unless the search predicate says to skip this
search hit.
 
It seems like this is a partly finished enhancement to behavior that
was originally only for searching invisible text. Seems like this was
generalized to an arbitrary predicate that filters possible search
hits - but the job seems only half done. The code presumably works in
a general way, but the comments and symbol names are inappropriate.
 
The comments and the variable and function names need to reflect the
new behavior, and this behavior should be documented for users. Users
should know how to take advantage of this feature, defining their own
search predicates that filter the search hits that would normally be
available, so that hits that dissatisfy the predicate are skipped.
 

In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2008-11-08 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/g/include
-fno-crossjumping'
 





This bug report was last modified 15 years and 193 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.