unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juri Linkov <juri@jurta.org>
Cc: michael_heerdegen@web.de, 11378@debbugs.gnu.org
Subject: bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle `search-invisible'
Date: Tue, 29 May 2012 14:22:27 -0400	[thread overview]
Message-ID: <jwvd35monyp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <874nqzgcuk.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 29 May 2012 19:40:19 +0300")

> This is implemented by the following patch that also simplifies
> the filter usage in other packages and adds two useful filters for
> comments/strings:

Thanks, see comments below.

> -(defvar isearch-filter-predicate 'isearch-filter-visible
> -  "Predicate that filters the search hits that would normally be available.
> -Search hits that dissatisfy the predicate are skipped.  The function
> -has two arguments: the positions of start and end of text matched by
> -the search.  If this function returns nil, continue searching without
> -stopping at this match.")
> +(defvar isearch-filter-predicate '(isearch-filter-visible)
> +  "Predicates that filter the search hits that would normally be available.
> +Search hits that dissatisfy the list of predicates are skipped.
> +Each function in this list has two arguments: the positions of
> +start and end of text matched by the search.
> +If `run-hook-with-args-until-failure' returns nil for all predicates,
> +continue searching without stopping at this match.")

I suggest renaming it to isearch-filter-predicates or
isearch-filter-functions.  Also the docstring should describe its
`isearch-message-prefix' property (BTW, why "prefix"?).

> +Type \\[isearch-toggle-filter-strings] to toggle searching inside strings.
> +Type \\[isearch-toggle-filter-comments] to toggle searching inside comments.

To me, the most useful filter would be "search in comments and strings"
or "search in code only (i.e. exclude comments and strings)", neither of
which is covered by those two toggles.

> +(defsubst isearch-filter-predicate-state (frame)
> +  "Return the filter predicates in FRAME."
> +  (aref frame 12))

Any taker for (defstruct isearch--state ...)?

> +  (nth 3 (parse-partial-sexp (point-min) (point))))
[...]
> +  (nth 4 (parse-partial-sexp (point-min) (point))))

Please use syntax-ppss instead.

> @@ -2489,13 +2560,11 @@ (defun isearch-search ()
>        (setq isearch-case-fold-search
>  	    (isearch-no-upper-case-p isearch-string isearch-regexp)))
>    (condition-case lossage
> -      (let ((inhibit-point-motion-hooks
> -	     (and (eq isearch-filter-predicate 'isearch-filter-visible)
> -		  search-invisible))
> +      (let ((inhibit-point-motion-hooks search-invisible)
>  	    (inhibit-quit nil)
>  	    (case-fold-search isearch-case-fold-search)
>  	    (search-spaces-regexp search-whitespace-regexp)

Why is this correct?


        Stefan





  reply	other threads:[~2012-05-29 18:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-29  6:10 bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle `search-invisible' Michael Heerdegen
2012-04-29 14:46 ` Stefan Monnier
2012-04-29 15:32   ` Drew Adams
2012-04-29 21:04   ` Lennart Borgman
2012-04-30  0:28   ` Juri Linkov
2012-05-01  9:15     ` Juri Linkov
2012-05-01 12:59       ` Stefan Monnier
2012-05-01 15:15         ` Juri Linkov
2012-05-01 13:14       ` Drew Adams
2012-05-29 16:40       ` Juri Linkov
2012-05-29 18:22         ` Stefan Monnier [this message]
2012-05-30  0:40           ` Juri Linkov
2012-05-30  4:32             ` Stefan Monnier
2012-05-31  0:55               ` Juri Linkov
2012-05-31 21:25                 ` Stefan Monnier
2018-04-24 19:50                   ` Juri Linkov
2019-11-01 18:54                     ` Stefan Kangas
2019-11-02 11:01                       ` Michael Heerdegen
2012-06-11 23:44             ` Juri Linkov
2013-02-15  9:22               ` Juri Linkov
2013-05-27 22:45               ` Juri Linkov
2013-05-28 21:47                 ` Juri Linkov
2013-05-28 22:45                   ` Drew Adams
2013-05-29 22:45                     ` Juri Linkov
2013-05-30  3:16                       ` Drew Adams
2013-05-30  8:12                         ` Juri Linkov
2013-05-30 13:34                           ` Drew Adams
2013-05-30 23:47                             ` Juri Linkov
2013-06-02  9:47                               ` Juri Linkov
2019-11-01 18:50                                 ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvd35monyp.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=11378@debbugs.gnu.org \
    --cc=juri@jurta.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).