GNU bug report logs - #11378
24.1.50; Suggestion: Let M-i in isearch cycle `search-invisible'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: michael_heerdegen@HIDDEN; merged with #18017; dated Sun, 29 Apr 2012 06:11:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Forcibly Merged 11378 18017. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 2 Nov 2019 11:01:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 02 07:01:36 2019
Received: from localhost ([127.0.0.1]:58255 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iQrA0-0001eq-Hz
	for submit <at> debbugs.gnu.org; Sat, 02 Nov 2019 07:01:36 -0400
Received: from mout.web.de ([212.227.17.11]:38183)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1iQr9y-0001eZ-Af
 for 11378 <at> debbugs.gnu.org; Sat, 02 Nov 2019 07:01:35 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1572692475;
 bh=lUi/05L/F+902XGTZDklmBJgqzMBgYy/EHrKsZS/M2c=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=revlxTmwQ1N0sisWXNtgSZybsbZCw42WHf7vOlRBHYGkTk2Z3flAcLctetGyq+kK/
 bAFIuAGtH1jFAKv6qQuoowFgXTQTOt2s/joKbSeBMb/DYmuDzyDBM57DpEpgGlZmnS
 x86MjH/aVLe0ylU1+QwCdxkeMXLwXXPbjArlIFo8=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from drachen.dragon ([94.218.222.9]) by smtp.web.de (mrweb102
 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LbrUu-1hhrkl0PDQ-00jJB7; Sat, 02
 Nov 2019 12:01:15 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Stefan Kangas <stefan@HIDDEN>
Subject: Re: bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle
 `search-invisible'
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
 <87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
 <874nqzgcuk.fsf@HIDDEN>
 <jwvd35monyp.fsf-monnier+emacs@HIDDEN>
 <87vcjesccy.fsf@HIDDEN>
 <jwvk3zumgw8.fsf-monnier+emacs@HIDDEN>
 <87y5o9nobl.fsf@HIDDEN>
 <jwv62bct55b.fsf-monnier+emacs@HIDDEN>
 <87vacg4c5n.fsf@HIDDEN> <871rurig0z.fsf@HIDDEN>
Date: Sat, 02 Nov 2019 12:01:23 +0100
In-Reply-To: <871rurig0z.fsf@HIDDEN> (Stefan Kangas's message of "Fri, 01
 Nov 2019 19:54:20 +0100")
Message-ID: <871ruqk0e4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:I+lngQ6Ccwpyd6rp+VvgNt6MkYegXyAD1GMa7md+f1r/MXw9Ukp
 zKOCo3lzRFAZtM66Cbiv/Wdi1775twd/C9D422aPuKejB6nAgmOdz8wc7nfad8/7LZ1FGnO
 74s8upICQGhKXMsLFBMnqmcICWYbg4aXQv8ihsye+4R8JMVQ8Cmg9T1Ba1wSFUhXc1T8gs6
 ePANwbJict0k2PAxmmd0g==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:Wy7AwaFwuK0=:X6LH6XNSXUg/TP1e8s79uk
 ondJ3oMZDq+l0wWwbz4CYtcLKsqIySk4aeAGi5hu4q4Sqy4lHVgYmlceaTsUGxO/CGDEDAiW8
 vT/0Vm+xcUKXOXhQdq3GEXzKXwfOSzAPtAYJffydfxFMJUqhkjHMV/ccnz5TUa9bsJ3krrUa0
 iA/JLIKbtvDlZfFQLnI1191kNoPbtRB6SNsw+L8xHG5dZlx4L0hO1VPrTtVNdCq1B3zFPBwU1
 iVXVg/eaUJl38ACxnloQLA8v9JrWGGy0j1dFBCQIvcRRMMw2YKkxXD3bPz9VqwLB1DmyOS5ce
 eN3FJtgmU2UFIWwbMZW6O/iMSCQydo9tQi3rcp+RK0mejZ76mWphHAtVCDtnUU1Wp5jUtZt5z
 76aLb48U+QK0p5Lo65fGxzaeA4G9/uipSLpreaHXv9/9s8BJEVC2+pJzkIodcrMFkI0k42PQn
 MpiEVw6jl/8QxGihRwFW84ycfnq38SmCFzrjfDsKmuN3cG6DLal6cEsJZolv9AWNQcTN50Y7S
 zFt83R5J/44+BQxs4H5ZuBOWWOGVEkPXIZvTno9sAJubG3PmkgRXoVqwlTCT3F11torJ8N7Re
 s/f6Jb9wH2LnTq5zj8ubM+wJiMgH3G1ph3lHTjQ58r9Q9EjOUUocJQtVrDCGOtIxWHfWqJ85U
 Ms6D7Dq2RJEssmtVtq/o9y5yZ/afwfH7bCyCIDMd2pInR+0vYG6IV9Ag/vqf74vXh2W7yCvTu
 GUnlWFg7t2iyTpbF5BKJMHUCN/mEy431ckG3SBQyRP0cjOP4wadvs7b4pqVGUSJbjnO2e/DWj
 p+9g8tGBNXOfvBwVsveoZKFcZBxz6O9woOf64ze3rE0WGqBfWqskgtTkVNPTFGWdMGrMr9aEI
 Wa81vqr+/59Gkbm+CQyAJrdCMywJA8pnhCQS9NTwecDIuk4GEHnPN/btBuv4zVoYYasycBWKq
 nlnORcNxTrc+xfOXIx8Bgv30SbkFuc6fgYl/ethhS8bC8/jCPUPEVY/8QhbKmijeSMxXNy5Qx
 y+f7a0Qv+n0nWsqc+iHUAdXsKjaBtk6cyOlG+NMCudTRZuxjbQLLcGu+KkRJ470WHE3ppQo4z
 hS95e75PVW5Pq2Z586wLPWM6XedlwFcMjO3nQs/BSxb5V8clH4bKlYPQf2pJvN9kuj3eNtbCW
 YA6V1iEbqrPIaasp4VrIK+m2fxuZkmV3Rc+yPHJw292/vWdkIQcL+aueIUoHbdbdAWHQN938+
 y3P1hEugqQP6M3/aWp5f5ihI3PlD1CQcvEK4HPuRj7qyuZ+AG7G6Q6K7DZHY=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 11378
Cc: Juri Linkov <juri@HIDDEN>, Stefan Monnier <monnier@HIDDEN>,
 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Stefan Kangas <stefan@HIDDEN> writes:

> Was the below patch ever applied?  Is it still relevant?

I don't know.

At least my original suggestion seems to have been implemented now: M-s
i toggles searching inside invisible text (see the line

  (isearch-define-mode-toggle invisible "i" nil

and following in "isearch.el").


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 1 Nov 2019 18:54:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 01 14:54:30 2019
Received: from localhost ([127.0.0.1]:57142 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iQc46-00036b-A1
	for submit <at> debbugs.gnu.org; Fri, 01 Nov 2019 14:54:30 -0400
Received: from host.gofardesign.uk ([208.79.239.190]:48925)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefan@HIDDEN>) id 1iQc44-00036M-Bb
 for 11378 <at> debbugs.gnu.org; Fri, 01 Nov 2019 14:54:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; 
 s=default;
 h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:
 Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=2yRdiThwtxHf+mxaxZ8+7Kd3qgU6rI3EeCX/yDOmbGI=; b=j3O4bgEZIA6ibF1DBaOEi/Aocy
 SGrvQfAl8SHE95TbduHh6Q258QVgfajxJLz+zAAwQz9IzRiKywJJj7Y5lBCv6nWjm+It70XeJoukb
 6+x5rwbjAi9nqNASoZ/76hNVbjk9rjMxlPbQdeVJLzURFR3DRso6S+BN8FccTNTAOBl4=;
Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:34584
 helo=localhost)
 by host.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
 (Exim 4.92) (envelope-from <stefan@HIDDEN>)
 id 1iQc3x-0007hh-Rc; Fri, 01 Nov 2019 13:54:22 -0500
From: Stefan Kangas <stefan@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle
 `search-invisible'
In-Reply-To: <87vacg4c5n.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 24 Apr 2018 22:50:12 +0300")
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
 <87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
 <874nqzgcuk.fsf@HIDDEN>
 <jwvd35monyp.fsf-monnier+emacs@HIDDEN>
 <87vcjesccy.fsf@HIDDEN>
 <jwvk3zumgw8.fsf-monnier+emacs@HIDDEN>
 <87y5o9nobl.fsf@HIDDEN>
 <jwv62bct55b.fsf-monnier+emacs@HIDDEN>
 <87vacg4c5n.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Date: Fri, 01 Nov 2019 19:54:20 +0100
Message-ID: <871rurig0z.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-OutGoing-Spam-Status: No, score=-1.0
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - host.gofardesign.uk
X-AntiAbuse: Original Domain - debbugs.gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - marxist.se
X-Get-Message-Sender-Via: host.gofardesign.uk: authenticated_id:
 stefan@HIDDEN
X-Authenticated-Sender: host.gofardesign.uk: stefan@HIDDEN
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, Stefan Monnier <monnier@HIDDEN>,
 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Juri Linkov <juri@HIDDEN> writes:

>>>> I was thinking that maybe a cycling behavior would be better than
>>>> toggling for these: off / foo-only / foo-excluded.
>>>
>>> Maybe something like this:
>>
>> Sounds about right, thank you,
>
> Now that text proprieties on the search string can be saved in the deskto=
p file,
> I tried to save the isearch-filter-predicate with advice-functions, and
> set it back to the search string, but this fails.
>
> An example of the search string saved in the search ring in the desktop f=
ile:
>
> #("string" 0 6 (isearch-filter-predicate #1=3D#[128 #2=3D"\300\301\2\"\20=
5\13\0\300\302\2\"\207"
>               [apply isearch-filter-textual #[128 #3=3D"\301\302\300!\2\"=
\207"
>               [isearch-filter-predicate apply default-value] 4 #4=3D"\n\n=
(fn &rest ARGS)"]
>               #5=3D((isearch-message-prefix . "textual "))] 4 nil]))
>
> After it's restored by desktop.el using `load' and set from the restored =
string
> with (setq isearch-filter-predicate ...) it goes into an infinite loop:
>
> Debugger entered--Lisp error: (error "Lisp nesting exceeds =E2=80=98max-l=
isp-eval-depth=E2=80=99")
>   ...
>   apply(#f(compiled-function (&rest args) #<bytecode 0x2958aa5>) (12237 1=
2244))
>   #f(advice-wrapper :before-while #f(compiled-function (&rest args) #<byt=
ecode 0x2958aa5>) isearch-filter-nontextual ((isearch-message-prefix . "non=
textual ")))(12237 12244)
>   apply(#f(advice-wrapper :before-while #f(compiled-function
>   #f(compiled-function (&rest args) #<bytecode 0x2958aa5>)(12237 12244)
>   apply(#f(compiled-function (&rest args) #<bytecode 0x2958aa5>) (12237 1=
2244))
>   #f(advice-wrapper :before-while #f(compiled-function (&rest args) #<byt=
ecode 0x2958aa5>) isearch-filter-nontextual ((isearch-message-prefix . "non=
textual ")))(12237 12244)
>   apply(#f(advice-wrapper :before-while #f(compiled-function
>   #f(compiled-function (&rest args) #<bytecode 0x2958aa5>)(12237 12244)
>   apply(#f(compiled-function (&rest args) #<bytecode 0x2958aa5>) (12237 1=
2244))
>   #f(advice-wrapper :before-while #f(compiled-function (&rest args) #<byt=
ecode 0x2958aa5>) isearch-filter-nontextual ((isearch-message-prefix . "non=
textual ")))(12237 12244)
>   funcall(#f(advice-wrapper :before-while #f(compiled-function
>   (not (funcall isearch-filter-predicate (nth 0 real-match-data) (nth 1 r=
eal-match-data)))
>
> If it's impossible to restore its value, then maybe better to save only
> function names, and on restoring explicitly call add-function with restor=
ed
> function names as symbols?

Was the below patch ever applied?  Is it still relevant?

Best regards,
Stefan Kangas


> A complete patch is here:
>
> diff --git a/lisp/isearch.el b/lisp/isearch.el
> index 5cbb4c9..70e3e44 100644
> --- a/lisp/isearch.el
> +++ b/lisp/isearch.el
> @@ -1136,7 +1141,8 @@ isearch-update-ring
>  (defun isearch-string-propertize (string &optional properties)
>    "Add isearch properties to the isearch string."
>    (unless properties
> -    (setq properties `(isearch-case-fold-search ,isearch-case-fold-searc=
h))
> +    (setq properties `(isearch-case-fold-search ,isearch-case-fold-search
> +                       isearch-filter-predicate ,isearch-filter-predicat=
e))
>      (unless isearch-regexp
>        (setq properties (append properties `(isearch-regexp-function ,ise=
arch-regexp-function)))))
>    (apply 'propertize string properties))
> @@ -1146,6 +1152,9 @@ isearch-update-from-string-properties
>    (when (plist-member (text-properties-at 0 string) 'isearch-case-fold-s=
earch)
>      (setq isearch-case-fold-search
>  	  (get-text-property 0 'isearch-case-fold-search string)))
> +  (when (plist-member (text-properties-at 0 string) 'isearch-filter-pred=
icate)
> +    (setq isearch-filter-predicate
> +	  (get-text-property 0 'isearch-filter-predicate string)))
>    (when (plist-member (text-properties-at 0 string) 'isearch-regexp-func=
tion)
>      (setq isearch-regexp-function
>  	  (get-text-property 0 'isearch-regexp-function string))))
> @@ -1640,6 +1648,38 @@ isearch--momentary-message
>         "match invisible text"
>       "match visible text")))
>=20=20
> +(isearch-define-mode-toggle textual "ft" nil
> +  "This determines whether to search inside or outside textual parts.
> +Toggles the variable `isearch-filter-predicate' between three states:
> +searching inside strings or comments, searching outside of strings or
> +comments, the third state removes the filtering altogether."
> +  (cond
> +   ((advice-function-member-p #'isearch-filter-textual
> +                              isearch-filter-predicate)
> +    (remove-function (local 'isearch-filter-predicate)
> +                     #'isearch-filter-textual)
> +    (add-function :before-while (local 'isearch-filter-predicate)
> +                  #'isearch-filter-nontextual
> +                  '((isearch-message-prefix . "nontextual "))))
> +   ((advice-function-member-p #'isearch-filter-nontextual
> +                              isearch-filter-predicate)
> +    (remove-function (local 'isearch-filter-predicate)
> +                     #'isearch-filter-nontextual))
> +   (t
> +    (add-function :before-while (local 'isearch-filter-predicate)
> +                  #'isearch-filter-textual
> +                  '((isearch-message-prefix . "textual "))))))
> +
> +(defun isearch-filter-textual (_beg _end)
> +  "Test whether the current search hit inside a string or comment."
> +  (save-match-data
> +    (or (nth 3 (syntax-ppss))
> +        (nth 4 (syntax-ppss)))))
> +
> +(defun isearch-filter-nontextual (beg end)
> +  "Test whether the current search hit outside a string or comment."
> +  (not (isearch-filter-textual beg end)))
> +
>  
>  ;; Word search
>=20=20
> @@ -3179,6 +3219,7 @@ isearch-lazy-highlight-window-group
>  (defvar isearch-lazy-highlight-window-start nil)
>  (defvar isearch-lazy-highlight-window-end nil)
>  (defvar isearch-lazy-highlight-case-fold-search nil)
> +(defvar isearch-lazy-highlight-filter-predicate nil)
>  (defvar isearch-lazy-highlight-regexp nil)
>  (defvar isearch-lazy-highlight-lax-whitespace nil)
>  (defvar isearch-lazy-highlight-regexp-lax-whitespace nil)
> @@ -3218,6 +3259,8 @@ isearch-lazy-highlight-new-loop
>                              isearch-lazy-highlight-window-group))
>  		 (not (eq isearch-lazy-highlight-case-fold-search
>  			  isearch-case-fold-search))
> +		 (not (equal isearch-lazy-highlight-filter-predicate
> +			     isearch-filter-predicate))
>  		 (not (eq isearch-lazy-highlight-regexp
>  			  isearch-regexp))
>  		 (not (eq isearch-lazy-highlight-regexp-function
> @@ -3259,6 +3302,7 @@ isearch-lazy-highlight-new-loop
>  	  isearch-lazy-highlight-wrapped      nil
>  	  isearch-lazy-highlight-last-string  isearch-string
>  	  isearch-lazy-highlight-case-fold-search isearch-case-fold-search
> +	  isearch-lazy-highlight-filter-predicate isearch-filter-predicate
>  	  isearch-lazy-highlight-regexp       isearch-regexp
>  	  isearch-lazy-highlight-lax-whitespace   isearch-lax-whitespace
>  	  isearch-lazy-highlight-regexp-lax-whitespace isearch-regexp-lax-white=
space
> diff --git a/lisp/replace.el b/lisp/replace.el
> index 3503b65..2f297b1 100644
> --- a/lisp/replace.el
> +++ b/lisp/replace.el
> @@ -2383,7 +2383,10 @@ perform-replace
>           ;; If non-nil, it is marker saying where in the buffer to stop.
>           (limit nil)
>           ;; Use local binding in add-function below.
> -         (isearch-filter-predicate isearch-filter-predicate)
> +         (isearch-filter-predicate
> +          (or (and (plist-member (text-properties-at 0 from-string) 'ise=
arch-filter-predicate)
> +                   (get-text-property 0 'isearch-filter-predicate from-s=
tring))
> +              isearch-filter-predicate))
>           (region-bounds nil)
>=20=20
>           ;; Data for the next match.  If a cons, it has the same format =
as
> @@ -2395,6 +2398,15 @@ perform-replace
>                (apply 'propertize
>                       (concat "Query replacing "
>                               (if backward "backward " "")
> +                             (if (not case-fold-search)
> +                                 "case-sensitive ")
> +                             (let ((prefix ""))
> +                               (advice-function-mapc
> +                                (lambda (_ props)
> +                                  (let ((np (cdr (assq 'isearch-message-=
prefix props))))
> +                                    (if np (setq prefix (concat np prefi=
x)))))
> +                                isearch-filter-predicate)
> +                               prefix)
>                               (if delimited-flag
>                                   (or (and (symbolp delimited-flag)
>                                            (get delimited-flag




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 1 Nov 2019 18:50:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 01 14:50:55 2019
Received: from localhost ([127.0.0.1]:57138 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iQc0c-00030f-Dg
	for submit <at> debbugs.gnu.org; Fri, 01 Nov 2019 14:50:54 -0400
Received: from host.gofardesign.uk ([208.79.239.190]:56965)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefan@HIDDEN>) id 1iQc0a-00030L-BF
 for 11378 <at> debbugs.gnu.org; Fri, 01 Nov 2019 14:50:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; 
 s=default;
 h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=8wlJMJDQggqakjvsB/VMW4ViZOE32jSb/crdMbNVuws=; b=pToG9L2N03rdwXzAaV2331boZA
 v7sFoZJpQXEJfE+Vie+GPFPmKBCRN6W9IdakQXbPXEyclSXEv1LiTdMVpW0lY8WFVZ5H762bZTuBa
 FvLFzBCMGmvDVe+01oja7bY1KrOfy+8LU+FvdJApndxK/AazInB1GS9d5FRn2mrGOuXk=;
Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:58218
 helo=localhost)
 by host.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
 (Exim 4.92) (envelope-from <stefan@HIDDEN>)
 id 1iQc0T-0006Wu-JP; Fri, 01 Nov 2019 13:50:46 -0500
From: Stefan Kangas <stefan@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle
 `search-invisible'
In-Reply-To: <87txlglu8v.fsf@HIDDEN> (Juri Linkov's message of "Sun,
 02 Jun 2013 12:47:12 +0300")
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
 <87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
 <874nqzgcuk.fsf@HIDDEN>
 <jwvd35monyp.fsf-monnier+emacs@HIDDEN>
 <87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
 <87sj1811tq.fsf@HIDDEN> <87vc6222vi.fsf@HIDDEN>
 <084871f7-9554-450a-863f-52a5b251d7d0@default>
 <871u8pmmla.fsf@HIDDEN>
 <6dcc689e-53a8-4982-953c-1b21c11cec78@default>
 <87k3mgevq2.fsf@HIDDEN>
 <cb520411-b38b-4a63-8b11-bb7c7021cce2@default>
 <87wqqghvy1.fsf@HIDDEN> <87txlglu8v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Date: Fri, 01 Nov 2019 19:50:43 +0100
Message-ID: <874kznig70.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-OutGoing-Spam-Status: No, score=-1.0
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - host.gofardesign.uk
X-AntiAbuse: Original Domain - debbugs.gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - marxist.se
X-Get-Message-Sender-Via: host.gofardesign.uk: authenticated_id:
 stefan@HIDDEN
X-Authenticated-Sender: host.gofardesign.uk: stefan@HIDDEN
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 11378
Cc: Drew Adams <drew.adams@HIDDEN>, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Juri Linkov <juri@HIDDEN> writes:

>> I'm preparing a patch that adds it to customize the behavior of
>> case-fold and invisible.
>
> This patch adds a new user option `isearch-keep-mode-variables'
> in parallel to another new option `isearch-keep-stack-variables'
> added in bug#12986.  It supports `isearch-case-fold-search' and
> `isearch-invisible' variables, but `isearch-filter-predicates',
> `isearch-lax-whitespace' could be added in the same way later.

The below patch from 6 years ago was sent but never applied at the
time.  Is it still relevant?

Best regards,
Stefan Kangas


> === modified file 'lisp/isearch.el'
> --- lisp/isearch.el	2013-05-30 23:50:36 +0000
> +++ lisp/isearch.el	2013-06-02 09:45:01 +0000
> @@ -153,6 +153,20 @@ (defcustom isearch-hide-immediately t
>    :type 'boolean
>    :group 'isearch)
>  
> +(defcustom isearch-keep-mode-variables nil
> +  "A set of search variables to keep between different searches.
> +When a search variable is customized to exist in this set, then
> +starting a new search doesn't reset the corresponding isearch variable
> +to its default value, thus keeping the value from the previous search
> +\(changed using toggling commands)."
> +  :type '(set (const :tag "Case folding" isearch-case-fold-search)
> +	      (const :tag "Invisible text" isearch-invisible)
> +	      (const :tag "Filters" isearch-filter-predicates)
> +	      (const :tag "Lax whitespace" isearch-lax-whitespace)
> +	      (const :tag "Regexp lax whitespace" isearch-regexp-lax-whitespace))
> +  :version "24.4"
> +  :group 'isearch)
> +
>  (defcustom isearch-resume-in-command-history nil
>    "If non-nil, `isearch-resume' commands are added to the command history.
>  This allows you to resume earlier Isearch sessions through the
> @@ -866,8 +895,6 @@ (defun isearch-mode (forward &optional r
>  	isearch-word word
>  	isearch-op-fun op-fun
>  	isearch-last-case-fold-search isearch-case-fold-search
> -	isearch-case-fold-search case-fold-search
> -	isearch-invisible search-invisible
>  	isearch-string ""
>  	isearch-message ""
>  	isearch-cmds nil
> @@ -898,6 +927,11 @@ (defun isearch-mode (forward &optional r
>  	isearch-original-minibuffer-message-timeout minibuffer-message-timeout
>  	minibuffer-message-timeout nil)
>  
> +  (unless (memq 'isearch-case-fold-search isearch-keep-mode-variables)
> +    (setq isearch-case-fold-search case-fold-search))
> +  (unless (memq 'isearch-invisible isearch-keep-mode-variables)
> +    (setq isearch-invisible search-invisible))
> +
>    ;; We must bypass input method while reading key.  When a user type
>    ;; printable character, appropriate input method is turned on in
>    ;; minibuffer to read multibyte characters.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 24 Apr 2018 19:59:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 24 15:59:08 2018
Received: from localhost ([127.0.0.1]:38479 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fB45j-0000o0-RJ
	for submit <at> debbugs.gnu.org; Tue, 24 Apr 2018 15:59:08 -0400
Received: from sub3.mail.dreamhost.com ([69.163.253.7]:37845
 helo=homiemail-a101.g.dreamhost.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1fB45i-0000ns-47
 for 11378 <at> debbugs.gnu.org; Tue, 24 Apr 2018 15:59:06 -0400
Received: from homiemail-a101.g.dreamhost.com (localhost [127.0.0.1])
 by homiemail-a101.g.dreamhost.com (Postfix) with ESMTP id 80EC5117E081;
 Tue, 24 Apr 2018 12:59:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jurta.org; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type:content-transfer-encoding; s=jurta.org; bh=C7Jf9K3
 oXz/Ynbl8K/LJc7XkdYI=; b=dTf70tqYltsNIuvf7kr3LaoG2YdlX9yViqyvYwt
 Q8ejm74q517g/V35+VlvG8B2ac4h/0+hMRPMprFPXEfu3DnY09OWNkUoYF7dwCxN
 /ilF6EYW90LYpoYmUBKnJKboEMJRHc/ZBO9GXvpK+mBuSVEboqUhw2nB0uvy/QS2
 gFC0=
Received: from localhost.linkov.net (m91-129-103-238.cust.tele2.ee
 [91.129.103.238])
 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by homiemail-a101.g.dreamhost.com (Postfix) with ESMTPSA id 3490D117E06C;
 Tue, 24 Apr 2018 12:59:04 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
 Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: LINKOV.NET
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
 <87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
 <874nqzgcuk.fsf@HIDDEN>
 <jwvd35monyp.fsf-monnier+emacs@HIDDEN>
 <87vcjesccy.fsf@HIDDEN>
 <jwvk3zumgw8.fsf-monnier+emacs@HIDDEN>
 <87y5o9nobl.fsf@HIDDEN>
 <jwv62bct55b.fsf-monnier+emacs@HIDDEN>
Date: Tue, 24 Apr 2018 22:50:12 +0300
In-Reply-To: <jwv62bct55b.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Thu, 31 May 2012 17:25:28 -0400")
Message-ID: <87vacg4c5n.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

>>> I was thinking that maybe a cycling behavior would be better than
>>> toggling for these: off / foo-only / foo-excluded.
>>
>> Maybe something like this:
>
> Sounds about right, thank you,

Now that text proprieties on the search string can be saved in the deskto=
p file,
I tried to save the isearch-filter-predicate with advice-functions, and
set it back to the search string, but this fails.

An example of the search string saved in the search ring in the desktop f=
ile:

#("string" 0 6 (isearch-filter-predicate #1=3D#[128 #2=3D"\300\301\2\"\20=
5\13\0\300\302\2\"\207"
              [apply isearch-filter-textual #[128 #3=3D"\301\302\300!\2\"=
\207"
              [isearch-filter-predicate apply default-value] 4 #4=3D"\n\n=
(fn &rest ARGS)"]
              #5=3D((isearch-message-prefix . "textual "))] 4 nil]))

After it's restored by desktop.el using `load' and set from the restored =
string
with (setq isearch-filter-predicate ...) it goes into an infinite loop:

Debugger entered--Lisp error: (error "Lisp nesting exceeds =E2=80=98max-l=
isp-eval-depth=E2=80=99")
  ...
  apply(#f(compiled-function (&rest args) #<bytecode 0x2958aa5>) (12237 1=
2244))
  #f(advice-wrapper :before-while #f(compiled-function (&rest args) #<byt=
ecode 0x2958aa5>) isearch-filter-nontextual ((isearch-message-prefix . "n=
ontextual ")))(12237 12244)
  apply(#f(advice-wrapper :before-while #f(compiled-function
  #f(compiled-function (&rest args) #<bytecode 0x2958aa5>)(12237 12244)
  apply(#f(compiled-function (&rest args) #<bytecode 0x2958aa5>) (12237 1=
2244))
  #f(advice-wrapper :before-while #f(compiled-function (&rest args) #<byt=
ecode 0x2958aa5>) isearch-filter-nontextual ((isearch-message-prefix . "n=
ontextual ")))(12237 12244)
  apply(#f(advice-wrapper :before-while #f(compiled-function
  #f(compiled-function (&rest args) #<bytecode 0x2958aa5>)(12237 12244)
  apply(#f(compiled-function (&rest args) #<bytecode 0x2958aa5>) (12237 1=
2244))
  #f(advice-wrapper :before-while #f(compiled-function (&rest args) #<byt=
ecode 0x2958aa5>) isearch-filter-nontextual ((isearch-message-prefix . "n=
ontextual ")))(12237 12244)
  funcall(#f(advice-wrapper :before-while #f(compiled-function
  (not (funcall isearch-filter-predicate (nth 0 real-match-data) (nth 1 r=
eal-match-data)))

If it's impossible to restore its value, then maybe better to save only
function names, and on restoring explicitly call add-function with restor=
ed
function names as symbols?

A complete patch is here:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5cbb4c9..70e3e44 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1136,7 +1141,8 @@ isearch-update-ring
 (defun isearch-string-propertize (string &optional properties)
   "Add isearch properties to the isearch string."
   (unless properties
-    (setq properties `(isearch-case-fold-search ,isearch-case-fold-searc=
h))
+    (setq properties `(isearch-case-fold-search ,isearch-case-fold-searc=
h
+                       isearch-filter-predicate ,isearch-filter-predicat=
e))
     (unless isearch-regexp
       (setq properties (append properties `(isearch-regexp-function ,ise=
arch-regexp-function)))))
   (apply 'propertize string properties))
@@ -1146,6 +1152,9 @@ isearch-update-from-string-properties
   (when (plist-member (text-properties-at 0 string) 'isearch-case-fold-s=
earch)
     (setq isearch-case-fold-search
 	  (get-text-property 0 'isearch-case-fold-search string)))
+  (when (plist-member (text-properties-at 0 string) 'isearch-filter-pred=
icate)
+    (setq isearch-filter-predicate
+	  (get-text-property 0 'isearch-filter-predicate string)))
   (when (plist-member (text-properties-at 0 string) 'isearch-regexp-func=
tion)
     (setq isearch-regexp-function
 	  (get-text-property 0 'isearch-regexp-function string))))
@@ -1640,6 +1648,38 @@ isearch--momentary-message
        "match invisible text"
      "match visible text")))
=20
+(isearch-define-mode-toggle textual "ft" nil
+  "This determines whether to search inside or outside textual parts.
+Toggles the variable `isearch-filter-predicate' between three states:
+searching inside strings or comments, searching outside of strings or
+comments, the third state removes the filtering altogether."
+  (cond
+   ((advice-function-member-p #'isearch-filter-textual
+                              isearch-filter-predicate)
+    (remove-function (local 'isearch-filter-predicate)
+                     #'isearch-filter-textual)
+    (add-function :before-while (local 'isearch-filter-predicate)
+                  #'isearch-filter-nontextual
+                  '((isearch-message-prefix . "nontextual "))))
+   ((advice-function-member-p #'isearch-filter-nontextual
+                              isearch-filter-predicate)
+    (remove-function (local 'isearch-filter-predicate)
+                     #'isearch-filter-nontextual))
+   (t
+    (add-function :before-while (local 'isearch-filter-predicate)
+                  #'isearch-filter-textual
+                  '((isearch-message-prefix . "textual "))))))
+
+(defun isearch-filter-textual (_beg _end)
+  "Test whether the current search hit inside a string or comment."
+  (save-match-data
+    (or (nth 3 (syntax-ppss))
+        (nth 4 (syntax-ppss)))))
+
+(defun isearch-filter-nontextual (beg end)
+  "Test whether the current search hit outside a string or comment."
+  (not (isearch-filter-textual beg end)))
+
 =0C
 ;; Word search
=20
@@ -3179,6 +3219,7 @@ isearch-lazy-highlight-window-group
 (defvar isearch-lazy-highlight-window-start nil)
 (defvar isearch-lazy-highlight-window-end nil)
 (defvar isearch-lazy-highlight-case-fold-search nil)
+(defvar isearch-lazy-highlight-filter-predicate nil)
 (defvar isearch-lazy-highlight-regexp nil)
 (defvar isearch-lazy-highlight-lax-whitespace nil)
 (defvar isearch-lazy-highlight-regexp-lax-whitespace nil)
@@ -3218,6 +3259,8 @@ isearch-lazy-highlight-new-loop
                             isearch-lazy-highlight-window-group))
 		 (not (eq isearch-lazy-highlight-case-fold-search
 			  isearch-case-fold-search))
+		 (not (equal isearch-lazy-highlight-filter-predicate
+			     isearch-filter-predicate))
 		 (not (eq isearch-lazy-highlight-regexp
 			  isearch-regexp))
 		 (not (eq isearch-lazy-highlight-regexp-function
@@ -3259,6 +3302,7 @@ isearch-lazy-highlight-new-loop
 	  isearch-lazy-highlight-wrapped      nil
 	  isearch-lazy-highlight-last-string  isearch-string
 	  isearch-lazy-highlight-case-fold-search isearch-case-fold-search
+	  isearch-lazy-highlight-filter-predicate isearch-filter-predicate
 	  isearch-lazy-highlight-regexp       isearch-regexp
 	  isearch-lazy-highlight-lax-whitespace   isearch-lax-whitespace
 	  isearch-lazy-highlight-regexp-lax-whitespace isearch-regexp-lax-white=
space
diff --git a/lisp/replace.el b/lisp/replace.el
index 3503b65..2f297b1 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2383,7 +2383,10 @@ perform-replace
          ;; If non-nil, it is marker saying where in the buffer to stop.
          (limit nil)
          ;; Use local binding in add-function below.
-         (isearch-filter-predicate isearch-filter-predicate)
+         (isearch-filter-predicate
+          (or (and (plist-member (text-properties-at 0 from-string) 'ise=
arch-filter-predicate)
+                   (get-text-property 0 'isearch-filter-predicate from-s=
tring))
+              isearch-filter-predicate))
          (region-bounds nil)
=20
          ;; Data for the next match.  If a cons, it has the same format =
as
@@ -2395,6 +2398,15 @@ perform-replace
               (apply 'propertize
                      (concat "Query replacing "
                              (if backward "backward " "")
+                             (if (not case-fold-search)
+                                 "case-sensitive ")
+                             (let ((prefix ""))
+                               (advice-function-mapc
+                                (lambda (_ props)
+                                  (let ((np (cdr (assq 'isearch-message-=
prefix props))))
+                                    (if np (setq prefix (concat np prefi=
x)))))
+                                isearch-filter-predicate)
+                               prefix)
                              (if delimited-flag
                                  (or (and (symbolp delimited-flag)
                                           (get delimited-flag




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 2 Jun 2013 09:55:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 02 05:55:51 2013
Received: from localhost ([127.0.0.1]:47344 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Uj50w-0002AG-6b
	for submit <at> debbugs.gnu.org; Sun, 02 Jun 2013 05:55:51 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:36914
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1Uj50s-00029l-Ie
	for 11378 <at> debbugs.gnu.org; Sun, 02 Jun 2013 05:55:48 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 0050F258B9E91C;
	Sun,  2 Jun 2013 02:53:58 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
	<87sj1811tq.fsf@HIDDEN> <87vc6222vi.fsf@HIDDEN>
	<084871f7-9554-450a-863f-52a5b251d7d0@default>
	<871u8pmmla.fsf@HIDDEN>
	<6dcc689e-53a8-4982-953c-1b21c11cec78@default>
	<87k3mgevq2.fsf@HIDDEN>
	<cb520411-b38b-4a63-8b11-bb7c7021cce2@default>
	<87wqqghvy1.fsf@HIDDEN>
Date: Sun, 02 Jun 2013 12:47:12 +0300
In-Reply-To: <87wqqghvy1.fsf@HIDDEN> (Juri Linkov's message of "Fri,
	31 May 2013 02:47:18 +0300")
Message-ID: <87txlglu8v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 11378
Cc: 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> I'm preparing a patch that adds it to customize the behavior of
> case-fold and invisible.

This patch adds a new user option `isearch-keep-mode-variables'
in parallel to another new option `isearch-keep-stack-variables'
added in bug#12986.  It supports `isearch-case-fold-search' and
`isearch-invisible' variables, but `isearch-filter-predicates',
`isearch-lax-whitespace' could be added in the same way later.

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-05-30 23:50:36 +0000
+++ lisp/isearch.el	2013-06-02 09:45:01 +0000
@@ -153,6 +153,20 @@ (defcustom isearch-hide-immediately t
   :type 'boolean
   :group 'isearch)
 
+(defcustom isearch-keep-mode-variables nil
+  "A set of search variables to keep between different searches.
+When a search variable is customized to exist in this set, then
+starting a new search doesn't reset the corresponding isearch variable
+to its default value, thus keeping the value from the previous search
+\(changed using toggling commands)."
+  :type '(set (const :tag "Case folding" isearch-case-fold-search)
+	      (const :tag "Invisible text" isearch-invisible)
+	      (const :tag "Filters" isearch-filter-predicates)
+	      (const :tag "Lax whitespace" isearch-lax-whitespace)
+	      (const :tag "Regexp lax whitespace" isearch-regexp-lax-whitespace))
+  :version "24.4"
+  :group 'isearch)
+
 (defcustom isearch-resume-in-command-history nil
   "If non-nil, `isearch-resume' commands are added to the command history.
 This allows you to resume earlier Isearch sessions through the
@@ -866,8 +895,6 @@ (defun isearch-mode (forward &optional r
 	isearch-word word
 	isearch-op-fun op-fun
 	isearch-last-case-fold-search isearch-case-fold-search
-	isearch-case-fold-search case-fold-search
-	isearch-invisible search-invisible
 	isearch-string ""
 	isearch-message ""
 	isearch-cmds nil
@@ -898,6 +927,11 @@ (defun isearch-mode (forward &optional r
 	isearch-original-minibuffer-message-timeout minibuffer-message-timeout
 	minibuffer-message-timeout nil)
 
+  (unless (memq 'isearch-case-fold-search isearch-keep-mode-variables)
+    (setq isearch-case-fold-search case-fold-search))
+  (unless (memq 'isearch-invisible isearch-keep-mode-variables)
+    (setq isearch-invisible search-invisible))
+
   ;; We must bypass input method while reading key.  When a user type
   ;; printable character, appropriate input method is turned on in
   ;; minibuffer to read multibyte characters.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 30 May 2013 23:49:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 30 19:49:43 2013
Received: from localhost ([127.0.0.1]:43288 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UiCbG-0002Sl-Nr
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 19:49:43 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:53774
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1UiCbE-0002SU-IK
	for 11378 <at> debbugs.gnu.org; Thu, 30 May 2013 19:49:41 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 5A23E258B9E91C;
	Thu, 30 May 2013 16:48:05 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
	<87sj1811tq.fsf@HIDDEN> <87vc6222vi.fsf@HIDDEN>
	<084871f7-9554-450a-863f-52a5b251d7d0@default>
	<871u8pmmla.fsf@HIDDEN>
	<6dcc689e-53a8-4982-953c-1b21c11cec78@default>
	<87k3mgevq2.fsf@HIDDEN>
	<cb520411-b38b-4a63-8b11-bb7c7021cce2@default>
Date: Fri, 31 May 2013 02:47:18 +0300
In-Reply-To: <cb520411-b38b-4a63-8b11-bb7c7021cce2@default> (Drew Adams's
	message of "Thu, 30 May 2013 06:34:53 -0700 (PDT)")
Message-ID: <87wqqghvy1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 11378
Cc: Stefan Monnier <monnier@HIDDEN>, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> As has often been the case, we think similarly (but differently too) here.
> In my previous msg I mentioned a different way to combine both possibilities
> (1: start with default vs 2: start from last)).  Not limited to Isearch,
> and togglable between the two start-with behaviors.

Since a separate user option is necessary anyway, currently
I'm preparing a patch that adds it to customize the behavior of
case-fold and invisible.  Based on that, later you could provide
a prefix arg to toggle this user option, if you wish.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 30 May 2013 13:36:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 30 09:36:42 2013
Received: from localhost ([127.0.0.1]:41848 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ui321-00079X-UB
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 09:36:42 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:19207)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <drew.adams@HIDDEN>) id 1Ui31x-00078n-Gt
	for 11378 <at> debbugs.gnu.org; Thu, 30 May 2013 09:36:38 -0400
Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237])
	by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with
	ESMTP id r4UDYwqR007293
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Thu, 30 May 2013 13:34:59 GMT
Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85])
	by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	r4UDYs7W022408
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 30 May 2013 13:34:56 GMT
Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54])
	by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	r4UDYsjm001723; Thu, 30 May 2013 13:34:54 GMT
MIME-Version: 1.0
Message-ID: <cb520411-b38b-4a63-8b11-bb7c7021cce2@default>
Date: Thu, 30 May 2013 06:34:53 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: RE: bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle
	`search-invisible'
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN> <jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
	<87sj1811tq.fsf@HIDDEN> <87vc6222vi.fsf@HIDDEN>
	<084871f7-9554-450a-863f-52a5b251d7d0@default>
	<871u8pmmla.fsf@HIDDEN>
	<6dcc689e-53a8-4982-953c-1b21c11cec78@default>
	<87k3mgevq2.fsf@HIDDEN>
In-Reply-To: <87k3mgevq2.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7  (607090) [OL
	12.0.6668.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Source-IP: acsinet21.oracle.com [141.146.126.237]
X-Spam-Score: -5.3 (-----)
X-Debbugs-Envelope-To: 11378
Cc: Stefan Monnier <monnier@HIDDEN>, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.3 (-----)

> > I understand that approach.  I disagree, that's all.
>=20
> It's no surprise that you disagree because both preferences make sense:

And we agree about that.

> (1) Start each new search afresh with default values.
>=20
> (2) Keep the current search state for subsequent searches.
>=20
> There are more possible preferences:
>=20
> (3) Someone even might prefer to keep the current search state
>     within the confines of the current buffer (easy to do with
>     `make-local-variable' on the transient search variables).
>=20
> (4) Reuse the previous search values only for the repeated search
>     `C-s C-s'.  This what the variable `isearch-last-case-fold-search'
>     is used for.  But why `isearch-last-case-fold-search' only?
>     Other search variables could be supported too.
>=20
> This suggests two new customizable options: one to define which search
> variables to keep for the next search to be able to choose the behavior
> between (1) and (2) for every search variable, and another option for (4)
> to choose which search variables to keep for the repeated search `C-s C-s=
'
> (its default value could reuse the last case-fold only as it currently
> does).

As has often been the case, we think similarly (but differently too) here.
In my previous msg I mentioned a different way to combine both possibilitie=
s
(1: start with default vs 2: start from last)).  Not limited to Isearch,
and togglable between the two start-with behaviors.

When I get some time I'll throw something together and try it.  Maybe
let a (particular) prefix arg on the toggle command toggle also the current
start-with behavior.  E.g., a macro would define a user option and associat=
ed
variables, plus a toggle command usable for both start-with behaviors.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 30 May 2013 08:16:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 30 04:16:28 2013
Received: from localhost ([127.0.0.1]:41554 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Uhy28-0000KP-7J
	for submit <at> debbugs.gnu.org; Thu, 30 May 2013 04:16:28 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:52146
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1Uhy22-0000K4-KG
	for 11378 <at> debbugs.gnu.org; Thu, 30 May 2013 04:16:26 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 7289C258B9E938;
	Thu, 30 May 2013 01:14:44 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
	<87sj1811tq.fsf@HIDDEN> <87vc6222vi.fsf@HIDDEN>
	<084871f7-9554-450a-863f-52a5b251d7d0@default>
	<871u8pmmla.fsf@HIDDEN>
	<6dcc689e-53a8-4982-953c-1b21c11cec78@default>
Date: Thu, 30 May 2013 11:12:05 +0300
In-Reply-To: <6dcc689e-53a8-4982-953c-1b21c11cec78@default> (Drew Adams's
	message of "Wed, 29 May 2013 20:16:52 -0700 (PDT)")
Message-ID: <87k3mgevq2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 11378
Cc: Stefan Monnier <monnier@HIDDEN>, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> I understand that approach.  I disagree, that's all.

It's no surprise that you disagree because both preferences make sense:

(1) Start each new search afresh with default values.

(2) Keep the current search state for subsequent searches.

There are more possible preferences:

(3) Someone even might prefer to keep the current search state
    within the confines of the current buffer (easy to do with
    `make-local-variable' on the transient search variables).

(4) Reuse the previous search values only for the repeated search
    `C-s C-s'.  This what the variable `isearch-last-case-fold-search'
    is used for.  But why `isearch-last-case-fold-search' only?
    Other search variables could be supported too.

This suggests two new customizable options: one to define which search
variables to keep for the next search to be able to choose the behavior
between (1) and (2) for every search variable, and another option for (4)
to choose which search variables to keep for the repeated search `C-s C-s'
(its default value could reuse the last case-fold only as it currently does).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 30 May 2013 03:18:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 29 23:18:39 2013
Received: from localhost ([127.0.0.1]:41238 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UhtNr-0004d0-EI
	for submit <at> debbugs.gnu.org; Wed, 29 May 2013 23:18:38 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:39168)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <drew.adams@HIDDEN>) id 1UhtNn-0004cY-3i
	for 11378 <at> debbugs.gnu.org; Wed, 29 May 2013 23:18:32 -0400
Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237])
	by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with
	ESMTP id r4U3GsTa014052
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Thu, 30 May 2013 03:16:55 GMT
Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85])
	by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	r4U3Grtb001233
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 30 May 2013 03:16:54 GMT
Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54])
	by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	r4U3Gq8X015405; Thu, 30 May 2013 03:16:52 GMT
MIME-Version: 1.0
Message-ID: <6dcc689e-53a8-4982-953c-1b21c11cec78@default>
Date: Wed, 29 May 2013 20:16:52 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: RE: bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle
	`search-invisible'
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN> <jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
	<87sj1811tq.fsf@HIDDEN> <87vc6222vi.fsf@HIDDEN>
	<084871f7-9554-450a-863f-52a5b251d7d0@default>
	<871u8pmmla.fsf@HIDDEN>
In-Reply-To: <871u8pmmla.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7  (607090) [OL
	12.0.6668.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Source-IP: acsinet21.oracle.com [141.146.126.237]
X-Spam-Score: -5.3 (-----)
X-Debbugs-Envelope-To: 11378
Cc: Stefan Monnier <monnier@HIDDEN>, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.3 (-----)

> > A major difference is that my code does not hesitate to use the
> > command to toggle the user option value.  I realize you consider
> > that a no-no.  I think that commands to toggle user options are
> > often a plus, not a minus.  (Think minor-mode variables, if that helps.
> > Or think of toggling an option via the options menu.)
>=20
> Most togglable search variables should preferably have two versions
> anyway: the default value (persistent in case of `defcustom') used
> initially for every new search (and often consulted in toggling
> commands to get the initial default value) and a transient value
> used in the currently active search.
>=20
> This is what `case-fold-search' and `isearch-case-fold-search'
> already do and this is a flexible approach.  I intend to
> implement the same approach for other search variables as well,
> e.g. adding `search-filter-predicates' to hold the default value
> for `isearch-filter-predicates'.  The prefix `search-' is more
> appropriate for such variables when they are used outside of isearch.
> So `isearch-filter-predicates' could be used to incrementally
> add/remove filters in isearch-mode, but to use `search-filter-predicates'
> in `query-replace', etc.

I understand that approach.  I disagree, that's all.

I believe it is good to be able to toggle the option value (what you call
the default value) on the fly (during a search) in this case, and thus
change the behavior for subsequent searches as well (until toggled again).
That is a more useful UI, IMO, in this case and in many others.

I am not sure what I think about case-fold-search.  Generally I think the
usual approach makes more sense for it.  But there is an argument to be
made for it too to "stay put" across searches.  Partly, such "sticky"
behavior requires clear feedback to the user so s?he is aware of the curren=
t
"mode" of behavior.

It is simple enough to toggle back again.  Even for a one-off search using
a different "mode" from usual, it just means two toggles instead of one.
And if you perform multiple searches in different modes (a mix: some
case-sensitive, some not),  then the sticky/modal behavior typically means
less toggling.

I still use the usual approach for case-fold-search, because (a) I am
used to it and (b) I use case-insensitive search rarely.  But in Icicles
I have a similar toggle for completion, and it is sticky/modal.  Again,
good feedback wrt the current behavior is more important for the sticky
behavior: you are not always thrown back into some default behavior.

Ideally perhaps the choice of behavior itself would be up to the user,
and perhaps even itself via a toggle.  No, I don't mean ojust a single
option value reflecting the choice, but the ability to toggle which
behavior to use for any behavior choice (toggle or cycle).

(No, I don't really expect others to agree.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 29 May 2013 22:56:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 29 18:56:18 2013
Received: from localhost ([127.0.0.1]:40891 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UhpI0-00022z-Ph
	for submit <at> debbugs.gnu.org; Wed, 29 May 2013 18:56:17 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:48257
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1UhpHx-00022l-EO
	for 11378 <at> debbugs.gnu.org; Wed, 29 May 2013 18:56:14 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 451A7258B9E91C;
	Wed, 29 May 2013 15:54:45 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
	<87sj1811tq.fsf@HIDDEN> <87vc6222vi.fsf@HIDDEN>
	<084871f7-9554-450a-863f-52a5b251d7d0@default>
Date: Thu, 30 May 2013 01:45:53 +0300
In-Reply-To: <084871f7-9554-450a-863f-52a5b251d7d0@default> (Drew Adams's
	message of "Tue, 28 May 2013 15:45:24 -0700 (PDT)")
Message-ID: <871u8pmmla.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 11378
Cc: Stefan Monnier <monnier@HIDDEN>, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> A major difference is that my code does not hesitate to use the
> command to toggle the user option value.  I realize you consider
> that a no-no.  I think that commands to toggle user options are
> often a plus, not a minus.  (Think minor-mode variables, if that helps.
> Or think of toggling an option via the options menu.)

Most togglable search variables should preferably have two versions
anyway: the default value (persistent in case of `defcustom') used
initially for every new search (and often consulted in toggling
commands to get the initial default value) and a transient value
used in the currently active search.

This is what `case-fold-search' and `isearch-case-fold-search'
already do and this is a flexible approach.  I intend to
implement the same approach for other search variables as well,
e.g. adding `search-filter-predicates' to hold the default value
for `isearch-filter-predicates'.  The prefix `search-' is more
appropriate for such variables when they are used outside of isearch.
So `isearch-filter-predicates' could be used to incrementally
add/remove filters in isearch-mode, but to use `search-filter-predicates'
in `query-replace', etc.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 28 May 2013 22:47:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 28 18:47:01 2013
Received: from localhost ([127.0.0.1]:38191 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UhSfT-0001Vt-HZ
	for submit <at> debbugs.gnu.org; Tue, 28 May 2013 18:47:00 -0400
Received: from aserp1040.oracle.com ([141.146.126.69]:38141)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <drew.adams@HIDDEN>) id 1UhSfO-0001VW-Ix
	for 11378 <at> debbugs.gnu.org; Tue, 28 May 2013 18:46:56 -0400
Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238])
	by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with
	ESMTP id r4SMjRTo008356
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Tue, 28 May 2013 22:45:28 GMT
Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85])
	by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	r4SMjQ2k027852
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL);
	Tue, 28 May 2013 22:45:26 GMT
Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54])
	by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	r4SMjPot020843; Tue, 28 May 2013 22:45:25 GMT
MIME-Version: 1.0
Message-ID: <084871f7-9554-450a-863f-52a5b251d7d0@default>
Date: Tue, 28 May 2013 15:45:24 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Juri Linkov <juri@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Subject: RE: bug#11378: 24.1.50; Suggestion: Let M-i in isearch cycle
	`search-invisible'
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN> <jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
	<87sj1811tq.fsf@HIDDEN> <87vc6222vi.fsf@HIDDEN>
In-Reply-To: <87vc6222vi.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7  (607090) [OL
	12.0.6668.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Source-IP: acsinet22.oracle.com [141.146.126.238]
X-Spam-Score: -5.3 (-----)
X-Debbugs-Envelope-To: 11378
Cc: 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.3 (-----)

> > I'll submit a new patch soon that adds a new variable
> > `isearch-search-invisible' (or maybe just `isearch-invisible')
> > to toggle its value without changing the value of the user option
> > `search-invisible'.
>=20
> Here is a patch that adds `isearch-toggle-invisible' that
> toggles `isearch-invisible' between nil and a non-nil default value
> of `search-invisible', i.e.
>=20
> if search-invisible is `open' then toggles isearch-invisible
> between `open' and `nil'
>=20
> if search-invisible is `t' then toggles isearch-invisible
> between `t' and `nil'
>=20
> if search-invisible is `nil' then toggles isearch-invisible
> between `nil' and `open'

This is similar to what I've been doing in isearch+.el for several
years now.  Glad it will be added to Emacs.

A major difference is that my code does not hesitate to use the
command to toggle the user option value.  I realize you consider
that a no-no.  I think that commands to toggle user options are
often a plus, not a minus.  (Think minor-mode variables, if that helps.
Or think of toggling an option via the options menu.)

isearch+.el is here, FWIW:
http://www.emacswiki.org/emacs-en/download/isearch%2b.el




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 28 May 2013 21:59:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 28 17:59:02 2013
Received: from localhost ([127.0.0.1]:38104 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UhRv4-00005t-5W
	for submit <at> debbugs.gnu.org; Tue, 28 May 2013 17:59:02 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:49028
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1UhRv0-00005T-Ni
	for 11378 <at> debbugs.gnu.org; Tue, 28 May 2013 17:59:00 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 64F83258B9E938;
	Tue, 28 May 2013 14:57:36 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
	<87sj1811tq.fsf@HIDDEN>
Date: Wed, 29 May 2013 00:47:29 +0300
In-Reply-To: <87sj1811tq.fsf@HIDDEN> (Juri Linkov's message of "Tue,
	28 May 2013 01:45:12 +0300")
Message-ID: <87vc6222vi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 11378
Cc: 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> I'll submit a new patch soon that adds a new variable
> `isearch-search-invisible' (or maybe just `isearch-invisible')
> to toggle its value without changing the value of the user option
> `search-invisible'.

Here is a patch that adds `isearch-toggle-invisible' that
toggles `isearch-invisible' between nil and a non-nil default value
of `search-invisible', i.e.

if search-invisible is `open' then toggles isearch-invisible
between `open' and `nil'

if search-invisible is `t' then toggles isearch-invisible
between `t' and `nil'

if search-invisible is `nil' then toggles isearch-invisible
between `nil' and `open'

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-05-27 22:42:11 +0000
+++ lisp/isearch.el	2013-05-28 21:41:15 +0000
@@ -514,6 +514,7 @@ (defvar isearch-mode-map
     (define-key map "\M-e" 'isearch-edit-string)
 
     (define-key map "\M-sc" 'isearch-toggle-case-fold)
+    (define-key map "\M-si" 'isearch-toggle-invisible)
     (define-key map "\M-sr" 'isearch-toggle-regexp)
     (define-key map "\M-sw" 'isearch-toggle-word)
     (define-key map "\M-s_" 'isearch-toggle-symbol)
@@ -602,6 +607,11 @@ (defvar isearch-start-hscroll 0)	; hscro
 ;;   case in the search string is ignored.
 (defvar isearch-case-fold-search nil)
 
+;; search-invisible while searching.
+;;   either nil, t, or 'open.  'open means the same as t except that
+;;   opens hidden overlays.
+(defvar isearch-invisible 'open)
+
 (defvar isearch-last-case-fold-search nil)
 
 ;; Used to save default value while isearch is active
@@ -700,6 +711,7 @@ (defun isearch-forward (&optional regexp
  nonincremental search.
 
 Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity.
+Type \\[isearch-toggle-invisible] to toggle search in invisible text.
 Type \\[isearch-toggle-regexp] to toggle regular-expression mode.
 Type \\[isearch-toggle-word] to toggle word mode.
 Type \\[isearch-toggle-symbol] to toggle symbol mode.
@@ -836,6 +867,7 @@ (defun isearch-mode (forward &optional r
 	isearch-op-fun op-fun
 	isearch-last-case-fold-search isearch-case-fold-search
 	isearch-case-fold-search case-fold-search
+	isearch-invisible search-invisible
 	isearch-string ""
 	isearch-message ""
 	isearch-cmds nil
@@ -1487,6 +1527,23 @@ (defun isearch-toggle-case-fold ()
   (sit-for 1)
   (isearch-update))
 
+(defun isearch-toggle-invisible ()
+  "Toggle searching in invisible text on or off.
+Toggles the variable `isearch-invisible' between values nil
+and a non-nil default value of `search-invisible' (or `open'
+if `search-invisible' is nil by default)."
+  (interactive)
+  (setq isearch-invisible
+	(if isearch-invisible nil (or search-invisible 'open)))
+  (let ((message-log-max nil))
+    (message "%s%s [match %svisible text]"
+	     (isearch-message-prefix nil isearch-nonincremental)
+	     isearch-message
+	     (if isearch-invisible "in" "")))
+  (setq isearch-success t isearch-adjusted t)
+  (sit-for 1)
+  (isearch-update))
+
 
 ;; Word search
 
@@ -1622,6 +1679,7 @@ (defun isearch-query-replace (&optional
 	;; set `search-upper-case' to nil to not call
 	;; `isearch-no-upper-case-p' in `perform-replace'
 	(search-upper-case nil)
+	(search-invisible isearch-invisible)
 	(replace-lax-whitespace
 	 isearch-lax-whitespace)
 	(replace-regexp-lax-whitespace
@@ -2634,9 +2739,10 @@ (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 search-invisible)
+      (let ((inhibit-point-motion-hooks isearch-invisible)
 	    (inhibit-quit nil)
 	    (case-fold-search isearch-case-fold-search)
+	    (search-invisible isearch-invisible)
 	    (retry t))
 	(setq isearch-error nil)
 	(while retry





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 27 May 2013 22:47:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 27 18:47:12 2013
Received: from localhost ([127.0.0.1]:36886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Uh6C8-0003OF-85
	for submit <at> debbugs.gnu.org; Mon, 27 May 2013 18:47:12 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:57495
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1Uh6C3-0003O1-4j
	for 11378 <at> debbugs.gnu.org; Mon, 27 May 2013 18:47:09 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id A5C27258B9E91C;
	Mon, 27 May 2013 15:45:50 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
Date: Tue, 28 May 2013 01:45:12 +0300
In-Reply-To: <87lijtcx8m.fsf@HIDDEN> (Juri Linkov's message of "Tue,
	12 Jun 2012 02:44:17 +0300")
Message-ID: <87sj1811tq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 11378
Cc: 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

>> Anyway I intend to rewrite the filter `isearch-filter-visible' to just
>> check if the text is visible.  The code that opens overlays should be
>> moved to the main search loop to work independently from the filter.
>
> I believe the following patch implements the correct interaction of
> filter predicates with search-invisible.

I installed this patch.  Now it's possible to implement
two separate features:

1. `isearch-toggle-invisible'.  While testing the initial approach
that toggles the value of `search-invisible', I noticed one problem:
after toggling invisibility in one search, it is unexpectedly
reused later in another search.

This is not like `M-s c' (isearch-toggle-case-fold) works
where toggling the value of `isearch-case-fold-search'
affects only the current search.  But a new search is
always started with the default value of the user option
`case-fold-search'.

I think a new command `isearch-toggle-invisible' (`M-s i')
should not change the default value of the user option
`search-invisible' defined with `defcustom'.
It should be changed only via Customization UI.

I'll submit a new patch soon that adds a new variable
`isearch-search-invisible' (or maybe just `isearch-invisible')
to toggle its value without changing the value of the user option
`search-invisible'.

2. A patch that implements new search filters
`isearch-filter-text', `isearch-filter-nontext',
`isearch-filter-strings', `isearch-filter-comments'
will be posted to a separate feature request.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 15 Feb 2013 09:42:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 15 04:42:00 2013
Received: from localhost ([127.0.0.1]:57110 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1U6Hns-0001Xb-0R
	for submit <at> debbugs.gnu.org; Fri, 15 Feb 2013 04:42:00 -0500
Received: from ps18281.dreamhost.com ([69.163.218.105]:56405
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1U6Hno-0001XO-8k
	for 11378 <at> debbugs.gnu.org; Fri, 15 Feb 2013 04:41:57 -0500
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id DD63C201B3332D;
	Fri, 15 Feb 2013 01:41:12 -0800 (PST)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN> <87lijtcx8m.fsf@HIDDEN>
Date: Fri, 15 Feb 2013 11:22:50 +0200
In-Reply-To: <87lijtcx8m.fsf@HIDDEN> (Juri Linkov's message of "Tue,
	12 Jun 2012 02:44:17 +0300")
Message-ID: <87ip5tdikt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 11378
Cc: 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -0.0 (/)

> There is one remaining question:
> do we still need a filter for visible text?

I tend to conclude that a filter for visible text is not needed,
because to handle the value of `search-invisible' correctly
this filter should reside in `isearch-filter-predicates' permanently
that makes little sense.

This assumes that the variable `search-invisible' is not going to be
marked obsolete in favor of filters.  Only in this case filters would
make sense that will require two separate filters: one to just skip
hidden text (implementing the current value `nil' of `search-invisible'),
another filter to open hidden overlays (implementing the value `open' of
`search-invisible'), and no filter means the value `t' of `search-invisible'.

Otherwise, searching in hidden text should handle the variable
`search-invisible' without using filters.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 12 Jun 2012 00:48:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 11 20:48:50 2012
Received: from localhost ([127.0.0.1]:38518 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SeFHu-0004lL-68
	for submit <at> debbugs.gnu.org; Mon, 11 Jun 2012 20:48:50 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:50552
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1SeFHr-0004lD-RM
	for 11378 <at> debbugs.gnu.org; Mon, 11 Jun 2012 20:48:49 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 7F520451C9B1;
	Mon, 11 Jun 2012 17:46:06 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN>
Date: Tue, 12 Jun 2012 02:44:17 +0300
In-Reply-To: <87vcjesccy.fsf@HIDDEN> (Juri Linkov's message of "Wed,
	30 May 2012 03:40:05 +0300")
Message-ID: <87lijtcx8m.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> Anyway I intend to rewrite the filter `isearch-filter-visible' to just
> check if the text is visible.  The code that opens overlays should be
> moved to the main search loop to work independently from the filter.

I believe the following patch implements the correct interaction of
filter predicates with search-invisible.

It also removes `isearch-filter-visible' from the default value of
`isearch-filter-predicates' because in the current implementation
`isearch-filter-visible' in the list of filters makes no sense since
it can't be removed from the filter list.  Removing it from the list
with the intention to find hidden matches won't open overlays with hidden text
ignoring the value of `search-invisible'.

This requires moving the `isearch-range-invisible' call to the
main search loop, just after running hook-with-args
with `isearch-filter-predicates'.

There is one remaining question:
do we still need a filter for visible text?

Such filter could just check if the match is visible,
but it should not open overlays.  This can be implemented like:

(defun isearch-filter-visible (beg end)
  (let ((search-invisible nil))
    (not (isearch-range-invisible beg end))))

Adding this filter to `isearch-filter-predicates' will skip hidden text,
removing it will find matches in hidden text (and the main search loop
will open overlays).

But apparently this filter is not necessary, because handling
of hidden text (depending on the customizable `search-invisible')
will be moved to the main search loop.

So the question is whether a new command to toggle searching hidden text
should add/remove `isearch-filter-visible' from `isearch-filter-predicates',
or just change the value of `search-invisible'.

I guess to change the value of `search-invisible' (defined by `defcustom')
with a new toggling command is not the right way to change the value
of customizable variables (or maybe not).

OTOH, `isearch-range-invisible' might be called twice: one call from
`isearch-filter-visible' and another from the main search loop,
and this is not optimal.

Anyway below is the patch that should work for a list of filters
other than `isearch-filter-visible':

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2012-05-29 09:46:06 +0000
+++ lisp/isearch.el	2012-06-11 23:34:18 +0000
@@ -179,12 +179,15 @@ (defvar isearch-push-state-function nil
   "Function to save a function restoring the mode-specific Isearch state
 to the search status stack.")
 
-(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-predicates nil
+  "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.
+The property `isearch-message-prefix' put on the predicate's symbol
+specifies the prefix string displyed in the search message.")
 
 ;; Search ring.
 
@@ -2509,8 +2553,15 @@ (defun isearch-search ()
 	  (if (or (not isearch-success)
 		  (bobp) (eobp)
 		  (= (match-beginning 0) (match-end 0))
-		  (funcall isearch-filter-predicate
-			   (match-beginning 0) (match-end 0)))
+		  ;; When one of filter predicates returns nil,
+		  ;; retry the search.  Otherwise, act according
+		  ;; to search-invisible (open overlays, etc.)
+		  (and (run-hook-with-args-until-failure
+			'isearch-filter-predicates
+			(match-beginning 0) (match-end 0))
+		       (or (eq search-invisible t)
+			   (not (isearch-range-invisible
+				 (match-beginning 0) (match-end 0))))))
 	      (setq retry nil)))
 	(setq isearch-just-started nil)
 	(if isearch-success
@@ -2873,7 +2964,6 @@ (defun isearch-lazy-highlight-search ()
 	    (isearch-regexp isearch-lazy-highlight-regexp)
 	    (search-spaces-regexp isearch-lazy-highlight-space-regexp)
 	    (isearch-word isearch-lazy-highlight-word)
-	    (search-invisible nil)	; don't match invisible text
 	    (retry t)
 	    (success nil)
 	    (isearch-forward isearch-lazy-highlight-forward)
@@ -2895,8 +2985,13 @@ (defun isearch-lazy-highlight-search ()
 	  (if (or (not success)
 		  (= (point) bound) ; like (bobp) (eobp) in `isearch-search'.
 		  (= (match-beginning 0) (match-end 0))
-		  (funcall isearch-filter-predicate
-			   (match-beginning 0) (match-end 0)))
+		  (and (run-hook-with-args-until-failure
+			'isearch-filter-predicates
+			(match-beginning 0) (match-end 0))
+		       ;; Don't match invisible text.
+		       (let ((search-invisible nil))
+			 (not (isearch-range-invisible
+			       (match-beginning 0) (match-end 0))))))
 	      (setq retry nil)))
 	success)
     (error nil)))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 31 May 2012 21:27:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 31 17:27:45 2012
Received: from localhost ([127.0.0.1]:52342 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SaCuG-00040h-8M
	for submit <at> debbugs.gnu.org; Thu, 31 May 2012 17:27:45 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:55715)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SaCuE-000403-0H
	for 11378 <at> debbugs.gnu.org; Thu, 31 May 2012 17:27:42 -0400
Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca
	[132.204.27.242])
	by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q4VLPSlE023869;
	Thu, 31 May 2012 17:25:28 -0400
Received: by faina.iro.umontreal.ca (Postfix, from userid 20848)
	id 41648B4078; Thu, 31 May 2012 17:25:28 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Message-ID: <jwv62bct55b.fsf-monnier+emacs@HIDDEN>
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN>
	<jwvk3zumgw8.fsf-monnier+emacs@HIDDEN>
	<87y5o9nobl.fsf@HIDDEN>
Date: Thu, 31 May 2012 17:25:28 -0400
In-Reply-To: <87y5o9nobl.fsf@HIDDEN> (Juri Linkov's message of "Thu,
	31 May 2012 03:55:10 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Level: 
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0.2
X-NAI-Spam-Rules: 2 Rules triggered
	GEN_SPAM_FEATRE=0.2, RV4238=0
X-NAI-Spam-Version: 2.2.0.9309 : core <4238> : streams <763052> : uri <1122228>
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.5 (---)

>> I was thinking that maybe a cycling behavior would be better than
>> toggling for these: off / foo-only / foo-excluded.
> Maybe something like this:

Sounds about right, thank you,


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 31 May 2012 01:20:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 30 21:20:00 2012
Received: from localhost ([127.0.0.1]:51030 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SZu3T-0003Fs-Vr
	for submit <at> debbugs.gnu.org; Wed, 30 May 2012 21:20:00 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:35073
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1SZu38-0003FM-F8
	for 11378 <at> debbugs.gnu.org; Wed, 30 May 2012 21:19:58 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 67E06451CA66;
	Wed, 30 May 2012 18:18:04 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN>
	<jwvk3zumgw8.fsf-monnier+emacs@HIDDEN>
Date: Thu, 31 May 2012 03:55:10 +0300
In-Reply-To: <jwvk3zumgw8.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Wed, 30 May 2012 00:32:50 -0400")
Message-ID: <87y5o9nobl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

>> Then the combination of comments and strings could be named "text" with
>> its filter bound to `M-s f t'.  And the inverse filter to exclude
>> comments and strings could be bound to `M-s f T'.  Also it could be
>> enabled only in prog-mode.
>
> I was thinking that maybe a cycling behavior would be better than
> toggling for these: off / foo-only / foo-excluded.

Maybe something like this:

(define-key isearch-mode-map "\M-sft" 'isearch-cycle-filter-text)

(defun isearch-cycle-filter-text ()
  "Cycle searching inside code vs strings/comments vs off."
  (interactive)
  (setq isearch-filter-predicates
	(cond ((memq 'isearch-filter-text isearch-filter-predicates)
               (cons 'isearch-filter-nontext
                     (delq 'isearch-filter-text isearch-filter-predicates)))
              ((memq 'isearch-filter-nontext isearch-filter-predicates)
               (delq 'isearch-filter-nontext isearch-filter-predicates))
              (t (cons 'isearch-filter-text isearch-filter-predicates))))
  (setq isearch-success t isearch-adjusted t)
  (isearch-update))

(defun isearch-filter-nontext (beg end)
  "Test whether the current search hit is not inside text.
Return non-nil if the text from BEG to END is not inside
strings or comments."
  (not (isearch-filter-text beg end)))

(put 'isearch-filter-nontext 'isearch-message-prefix "code ")

(defun isearch-filter-text (beg end)
  "Test whether the current search hit is inside text.
Return non-nil if the text from BEG to END is inside
strings or comments."
  (or (isearch-filter-comments beg end)
      (isearch-filter-strings beg end)))

(put 'isearch-filter-text 'isearch-message-prefix "text ")

(defun isearch-filter-strings (beg end)
  "Test whether the current search hit is inside strings.
Return non-nil if the text from BEG to END is inside strings."
  (save-match-data (nth 3 (syntax-ppss))))

(put 'isearch-filter-strings 'isearch-message-prefix "string ")

(defun isearch-filter-comments (beg end)
  "Test whether the current search hit is inside comments.
Return non-nil if the text from BEG to END is inside comments."
  (save-match-data (nth 4 (syntax-ppss))))

(put 'isearch-filter-comments 'isearch-message-prefix "comment ")




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 30 May 2012 04:34:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 30 00:34:25 2012
Received: from localhost ([127.0.0.1]:49179 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SZac5-0003th-AO
	for submit <at> debbugs.gnu.org; Wed, 30 May 2012 00:34:25 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:52267)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SZac3-0003tT-KY
	for 11378 <at> debbugs.gnu.org; Wed, 30 May 2012 00:34:24 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Ai0FAG6Zu09MCpYd/2dsb2JhbABEsEiDSYEIghUBAQQBViMFCws0EhQYDSSIHAW6CZBEA6MzgViDBQ
X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="184036008"
Received: from 76-10-150-29.dsl.teksavvy.com (HELO pastel.home)
	([76.10.150.29])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	30 May 2012 00:32:50 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 2F65958F58; Wed, 30 May 2012 00:32:50 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Message-ID: <jwvk3zumgw8.fsf-monnier+emacs@HIDDEN>
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
	<87vcjesccy.fsf@HIDDEN>
Date: Wed, 30 May 2012 00:32:50 -0400
In-Reply-To: <87vcjesccy.fsf@HIDDEN> (Juri Linkov's message of "Wed,
	30 May 2012 03:40:05 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

>> I suggest renaming it to isearch-filter-predicates or
>> isearch-filter-functions.
> isearch-filter-functions is more usual name for the hook-like
> functionality than isearch-filter-predicates.

By convention, "-functions" is used for non-standard hooks, of which
predicates are one particular subset.  But "-predicates" is fine by me.

> Then the combination of comments and strings could be named "text" with
> its filter bound to `M-s f t'.  And the inverse filter to exclude
> comments and strings could be bound to `M-s f T'.  Also it could be
> enabled only in prog-mode.

I was thinking that maybe a cycling behavior would be better than
toggling for these: off / foo-only / foo-excluded.

> I believe that binding `inhibit-point-motion-hooks' to t unconditionally
> shouldn't cause an unwanted effect because `isearch-done' takes care
> about moving point outside of intangible text at the end of the search
> (the source lines that begin with the comment ";; If we ended in the middle
> of some intangible text, move to the further end of that intangible text.")
> But currently I know no test case to prove the effect of
> `inhibit-point-motion-hooks'.

I see.  Since I hate intangible, it's probably OK ;-)


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 30 May 2012 01:29:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 29 21:29:23 2012
Received: from localhost ([127.0.0.1]:48995 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SZXj1-0006WF-0a
	for submit <at> debbugs.gnu.org; Tue, 29 May 2012 21:29:23 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:55576
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1SZXiy-0006W2-7Z
	for 11378 <at> debbugs.gnu.org; Tue, 29 May 2012 21:29:21 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id C9C9F451C96A;
	Tue, 29 May 2012 18:27:51 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
	<jwvd35monyp.fsf-monnier+emacs@HIDDEN>
Date: Wed, 30 May 2012 03:40:05 +0300
In-Reply-To: <jwvd35monyp.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Tue, 29 May 2012 14:22:27 -0400")
Message-ID: <87vcjesccy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> I suggest renaming it to isearch-filter-predicates or
> isearch-filter-functions.

isearch-filter-functions is more usual name for the hook-like
functionality than isearch-filter-predicates.

> Also the docstring should describe its
> `isearch-message-prefix' property (BTW, why "prefix"?).

The prefix is what's displayed before the search string in the message.
The suffix is after the search string in square brackets.

>> +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.

Then the combination of comments and strings could be named "text" with
its filter bound to `M-s f t'.  And the inverse filter to exclude
comments and strings could be bound to `M-s f T'.  Also it could be
enabled only in prog-mode.

>> @@ -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?

I believe that binding `inhibit-point-motion-hooks' to t unconditionally
shouldn't cause an unwanted effect because `isearch-done' takes care
about moving point outside of intangible text at the end of the search
(the source lines that begin with the comment ";; If we ended in the middle
of some intangible text, move to the further end of that intangible text.")
But currently I know no test case to prove the effect of
`inhibit-point-motion-hooks'.

BTW, in etc/TODO I noticed this task:

*** Outlining
**** Support for incremental search automatically making hidden text visible.

It seems this is already implemented at least for outline
(but needs more testing in org-mode).

Anyway I intend to rewrite the filter `isearch-filter-visible' to just
check if the text is visible.  The code that opens overlays should be
moved to the main search loop to work independently from the filter.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 29 May 2012 18:24:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 29 14:24:01 2012
Received: from localhost ([127.0.0.1]:48706 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SZR5M-0005Ma-Qm
	for submit <at> debbugs.gnu.org; Tue, 29 May 2012 14:24:01 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:17572)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SZR5K-0005MK-R3
	for 11378 <at> debbugs.gnu.org; Tue, 29 May 2012 14:23:59 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Ai0FAG6Zu09MCpYd/2dsb2JhbABEsEiDSYEIghUBAQQBViMFCws0EhQYDSSIHAW6CZBEA6MzgViDBQ
X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="183811258"
Received: from 76-10-150-29.dsl.teksavvy.com (HELO pastel.home)
	([76.10.150.29])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	29 May 2012 14:22:28 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 21B3E58F58; Tue, 29 May 2012 14:22:27 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Message-ID: <jwvd35monyp.fsf-monnier+emacs@HIDDEN>
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<874nqzgcuk.fsf@HIDDEN>
Date: Tue, 29 May 2012 14:22:27 -0400
In-Reply-To: <874nqzgcuk.fsf@HIDDEN> (Juri Linkov's message of "Tue,
	29 May 2012 19:40:19 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 29 May 2012 16:46:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 29 12:46:12 2012
Received: from localhost ([127.0.0.1]:48659 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SZPYh-0000np-MB
	for submit <at> debbugs.gnu.org; Tue, 29 May 2012 12:46:12 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:35300
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1SZPYe-0000na-Cn
	for 11378 <at> debbugs.gnu.org; Tue, 29 May 2012 12:46:10 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 368B3451CA41;
	Tue, 29 May 2012 09:44:41 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
Date: Tue, 29 May 2012 19:40:19 +0300
In-Reply-To: <87y5pcdzxx.fsf@HIDDEN> (Juri Linkov's message of "Tue,
	01 May 2012 12:15:54 +0300")
Message-ID: <874nqzgcuk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> It would be more useful to allow multiple filters by transforming
> `isearch-filter-predicate' from the variable defining a predicate to the
> hook-like list defining a set of predicates all of which should satisfy
> for the search hit.

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

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2012-05-29 09:46:06 +0000
+++ lisp/isearch.el	2012-05-29 16:35:09 +0000
@@ -179,12 +179,13 @@
   "Function to save a function restoring the mode-specific Isearch state
 to the search status stack.")
 
-(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.")
 
 ;; Search ring.
 
@@ -506,6 +516,9 @@ (defvar isearch-mode-map
     (define-key map "\M-sw" 'isearch-toggle-word)
     (define-key map "\M-s_" 'isearch-toggle-symbol)
 
+    (define-key map "\M-sfs" 'isearch-toggle-filter-strings)
+    (define-key map "\M-sfc" 'isearch-toggle-filter-comments)
+
     (define-key map [?\M-%] 'isearch-query-replace)
     (define-key map [?\C-\M-%] 'isearch-query-replace-regexp)
     (define-key map "\M-so" 'isearch-occur)
@@ -665,6 +681,10 @@ (defun isearch-forward (&optional regexp
 Type \\[isearch-toggle-regexp] to toggle regular-expression mode.
 Type \\[isearch-toggle-word] to toggle word mode.
 Type \\[isearch-toggle-symbol] to toggle symbol mode.
+
+Type \\[isearch-toggle-filter-strings] to toggle searching inside strings.
+Type \\[isearch-toggle-filter-comments] to toggle searching inside comments.
+
 Type \\[isearch-edit-string] to edit the search string in the minibuffer.
 
 Also supported is a search ring of the previous 16 search strings.
@@ -1036,6 +1056,9 @@ (defsubst isearch-case-fold-search-state
 (defsubst isearch-pop-fun-state (frame)
   "Return the function restoring the mode-specific Isearch state in FRAME."
   (aref frame 11))
+(defsubst isearch-filter-predicate-state (frame)
+  "Return the filter predicates in FRAME."
+  (aref frame 12))
 
 (defun isearch-top-state ()
   (let ((cmd (car isearch-cmds)))
@@ -1048,7 +1071,8 @@ (defun isearch-top-state ()
 	  isearch-error (isearch-error-state cmd)
 	  isearch-wrapped (isearch-wrapped-state cmd)
 	  isearch-barrier (isearch-barrier-state cmd)
-	  isearch-case-fold-search (isearch-case-fold-search-state cmd))
+	  isearch-case-fold-search (isearch-case-fold-search-state cmd)
+	  isearch-filter-predicate (isearch-filter-predicate-state cmd))
     (if (functionp (isearch-pop-fun-state cmd))
 	(funcall (isearch-pop-fun-state cmd) cmd))
     (goto-char (isearch-point-state cmd))))
@@ -1065,7 +1089,8 @@ (defun isearch-push-state ()
 		      isearch-error isearch-wrapped isearch-barrier
 		      isearch-case-fold-search
 		      (if isearch-push-state-function
-			  (funcall isearch-push-state-function)))
+			  (funcall isearch-push-state-function))
+		      isearch-filter-predicate)
 	      isearch-cmds)))
 
 
@@ -1411,6 +1436,40 @@ (defun isearch-toggle-case-fold ()
   (sit-for 1)
   (isearch-update))
 
+(defun isearch-toggle-filter-strings ()
+  "Toggle searching inside strings on or off."
+  (interactive)
+  (setq isearch-filter-predicate
+	(if (memq 'isearch-filter-strings isearch-filter-predicate)
+	    (delq 'isearch-filter-strings isearch-filter-predicate)
+	  (cons 'isearch-filter-strings isearch-filter-predicate)))
+  (setq isearch-success t isearch-adjusted t)
+  (isearch-update))
+
+(defun isearch-filter-strings (beg end)
+  "Test whether the current search hit is inside strings.
+Return non-nil if the text from BEG to END is inside strings."
+  (nth 3 (parse-partial-sexp (point-min) (point))))
+
+(put 'isearch-filter-strings 'isearch-message-prefix "string ")
+
+(defun isearch-toggle-filter-comments ()
+  "Toggle searching inside comments on or off."
+  (interactive)
+  (setq isearch-filter-predicate
+	(if (memq 'isearch-filter-comments isearch-filter-predicate)
+	    (delq 'isearch-filter-comments isearch-filter-predicate)
+	  (cons 'isearch-filter-comments isearch-filter-predicate)))
+  (setq isearch-success t isearch-adjusted t)
+  (isearch-update))
+
+(defun isearch-filter-comments (beg end)
+  "Test whether the current search hit is inside comments.
+Return non-nil if the text from BEG to END is inside comments."
+  (nth 4 (parse-partial-sexp (point-min) (point))))
+
+(put 'isearch-filter-comments 'isearch-message-prefix "comment ")
+
 
 ;; Word search
 
@@ -2373,6 +2439,11 @@ (defun isearch-message-prefix (&optional
 			      (< (point) isearch-opoint)))
 		       "over")
 		   (if isearch-wrapped "wrapped ")
+		   (mapconcat (lambda (s)
+				(and (symbolp s)
+				     (get s 'isearch-message-prefix)))
+			      isearch-filter-predicate
+			      "")
 		   (if isearch-word
 		       (or (and (symbolp isearch-word)
 				(get isearch-word 'isearch-message-prefix))
@@ -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)
@@ -2509,8 +2578,9 @@ (defun isearch-search ()
 	  (if (or (not isearch-success)
 		  (bobp) (eobp)
 		  (= (match-beginning 0) (match-end 0))
-		  (funcall isearch-filter-predicate
-			   (match-beginning 0) (match-end 0)))
+		  (run-hook-with-args-until-failure
+		   'isearch-filter-predicate
+		   (match-beginning 0) (match-end 0)))
 	      (setq retry nil)))
 	(setq isearch-just-started nil)
 	(if isearch-success
@@ -2895,8 +3005,9 @@ (defun isearch-lazy-highlight-search ()
 	  (if (or (not success)
 		  (= (point) bound) ; like (bobp) (eobp) in `isearch-search'.
 		  (= (match-beginning 0) (match-end 0))
-		  (funcall isearch-filter-predicate
-			   (match-beginning 0) (match-end 0)))
+		  (run-hook-with-args-until-failure
+		   'isearch-filter-predicate
+		   (match-beginning 0) (match-end 0)))
 	      (setq retry nil)))
 	success)
     (error nil)))

=== modified file 'lisp/dired-aux.el'
--- lisp/dired-aux.el	2012-04-17 01:52:00 +0000
+++ lisp/dired-aux.el	2012-05-29 16:35:30 +0000
@@ -2424,8 +2425,6 @@ (defcustom dired-isearch-filenames nil
   :group 'dired
   :version "23.1")
 
-(defvar dired-isearch-filter-predicate-orig nil)
-
 (defun dired-isearch-filenames-toggle ()
   "Toggle file names searching on or off.
 When on, Isearch skips matches outside file names using the predicate
@@ -2433,9 +2432,9 @@ (defun dired-isearch-filenames-toggle ()
 When off, it uses the original predicate."
   (interactive)
   (setq isearch-filter-predicate
-	(if (eq isearch-filter-predicate 'dired-isearch-filter-filenames)
-	    dired-isearch-filter-predicate-orig
-	  'dired-isearch-filter-filenames))
+	(if (memq 'dired-isearch-filter-filenames isearch-filter-predicate)
+	    (delq 'dired-isearch-filter-filenames isearch-filter-predicate)
+	  (cons 'dired-isearch-filter-filenames isearch-filter-predicate)))
   (setq isearch-success t isearch-adjusted t)
   (isearch-update))
 
@@ -2446,29 +2445,29 @@ (defun dired-isearch-filenames-setup ()
   (when (or (eq dired-isearch-filenames t)
 	    (and (eq dired-isearch-filenames 'dwim)
 		 (get-text-property (point) 'dired-filename)))
-    (setq isearch-message-prefix-add "filename ")
-    (define-key isearch-mode-map "\M-sf" 'dired-isearch-filenames-toggle)
-    (setq dired-isearch-filter-predicate-orig
-	  (default-value 'isearch-filter-predicate))
-    (setq-default isearch-filter-predicate 'dired-isearch-filter-filenames)
+    (define-key isearch-mode-map "\M-sff" 'dired-isearch-filenames-toggle)
+    (setq isearch-filter-predicate
+	  (cons 'dired-isearch-filter-filenames isearch-filter-predicate))
     (add-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end nil t)))
 
 (defun dired-isearch-filenames-end ()
   "Clean up the Dired file name search after terminating isearch."
   (setq isearch-message-prefix-add nil)
-  (define-key isearch-mode-map "\M-sf" nil)
-  (setq-default isearch-filter-predicate dired-isearch-filter-predicate-orig)
+  (define-key isearch-mode-map "\M-sff" nil)
+  (setq isearch-filter-predicate
+	(delq 'dired-isearch-filter-filenames isearch-filter-predicate))
   (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t))
 
 (defun dired-isearch-filter-filenames (beg end)
-  "Test whether the current search hit is a visible file name.
+  "Test whether the current search hit is a file name.
 Return non-nil if the text from BEG to END is part of a file
-name (has the text property `dired-filename') and is visible."
-  (and (isearch-filter-visible beg end)
-       (if dired-isearch-filenames
-	   (text-property-not-all (min beg end) (max beg end)
-				  'dired-filename nil)
-	 t)))
+name (has the text property `dired-filename')."
+  (if dired-isearch-filenames
+      (text-property-not-all (min beg end) (max beg end)
+			     'dired-filename nil)
+    t))
+
+(put 'dired-isearch-filter-filenames 'isearch-message-prefix "filename ")
 
 ;;;###autoload
 (defun dired-isearch-filenames ()

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-05-29 09:09:38 +0000
+++ lisp/info.el	2012-05-29 16:39:00 +0000
@@ -1772,7 +1775,8 @@ (defun Info-search (regexp &optional bou
 			      (point-max)))
 	  (while (and (not give-up)
 		      (or (null found)
-			  (not (funcall isearch-filter-predicate beg-found found))))
+			  (not (run-hook-with-args-until-failure
+				'isearch-filter-predicate beg-found found))))
 	    (let ((search-spaces-regexp
 		   (if (or (not isearch-mode) isearch-regexp)
 		       Info-search-whitespace-regexp)))
@@ -1854,7 +1858,8 @@ (defun Info-search (regexp &optional bou
 		(setq give-up nil found nil)
 		(while (and (not give-up)
 			    (or (null found)
-				(not (funcall isearch-filter-predicate beg-found found))))
+				(not (run-hook-with-args-until-failure
+				      'isearch-filter-predicate beg-found found))))
 		  (let ((search-spaces-regexp
 			 (if (or (not isearch-mode) isearch-regexp)
 			     Info-search-whitespace-regexp)))
@@ -4049,7 +4054,7 @@ (define-derived-mode Info-mode nil "Info
   (set (make-local-variable 'isearch-push-state-function)
        'Info-isearch-push-state)
   (set (make-local-variable 'isearch-filter-predicate)
-       'Info-isearch-filter)
+       '(Info-isearch-filter))
   (set (make-local-variable 'search-whitespace-regexp)
        Info-search-whitespace-regexp)
   (set (make-local-variable 'revert-buffer-function)

=== modified file 'lisp/wdired.el'
--- lisp/wdired.el	2012-01-19 07:21:25 +0000
+++ lisp/wdired.el	2012-05-29 16:35:52 +0000
@@ -216,8 +216,7 @@ (defun wdired-change-to-wdired-mode ()
        (buffer-substring (point-min) (point-max)))
   (set (make-local-variable 'wdired-old-point) (point))
   (set (make-local-variable 'query-replace-skip-read-only) t)
-  (set (make-local-variable 'isearch-filter-predicate)
-       'wdired-isearch-filter-read-only)
+  (add-hook 'isearch-filter-predicate 'wdired-isearch-filter-read-only nil t)
   (use-local-map wdired-mode-map)
   (force-mode-line-update)
   (setq buffer-read-only nil)
@@ -245,9 +244,8 @@ (defun wdired-change-to-wdired-mode ()
 
 (defun wdired-isearch-filter-read-only (beg end)
   "Skip matches that have a read-only property."
-  (and (isearch-filter-visible beg end)
-       (not (text-property-not-all (min beg end) (max beg end)
-				   'read-only nil))))
+  (not (text-property-not-all (min beg end) (max beg end)
+			      'read-only nil)))
 
 ;; Protect the buffer so only the filenames can be changed, and put
 ;; properties so filenames (old and new) can be easily found.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 1 May 2012 15:23:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 01 11:23:27 2012
Received: from localhost ([127.0.0.1]:60928 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SPEvH-0000Zo-4n
	for submit <at> debbugs.gnu.org; Tue, 01 May 2012 11:23:27 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:46215
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1SPEvD-0000ZY-60
	for 11378 <at> debbugs.gnu.org; Tue, 01 May 2012 11:23:24 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id EB929451C7F0;
	Tue,  1 May 2012 08:21:52 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
	<jwvhaw083ig.fsf-monnier+emacs@HIDDEN>
Date: Tue, 01 May 2012 18:15:35 +0300
In-Reply-To: <jwvhaw083ig.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Tue, 01 May 2012 08:59:43 -0400")
Message-ID: <87zk9sc5ez.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> Sounds good to me.  Not sure how you'll fix the
>
> 	     (and (eq isearch-filter-predicate 'isearch-filter-visible)
> 		  search-invisible))

This condition is used to set the value of
`inhibit-point-motion-hooks'.  But I don't understand
the purpose of using `inhibit-point-motion-hooks' here
and why it depends on `search-invisible'.

The documentation says that when `inhibit-point-motion-hooks' is
non-nil, the `intangible' property is ignored.  But how this is
related to the `invisible' property?

Maybe we could bind `inhibit-point-motion-hooks' to t
unconditionally because `isearch-done' takes care
about moving point outside of intangible text,
and probably there are no more bad effects.

Another reason why this condition should be removed
is that other filters call `isearch-filter-visible' too
(as the first thing they test in their function body).
And it's impossible to list all such filters in the condition
that binds the value of `inhibit-point-motion-hooks' to t.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 1 May 2012 13:15:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 01 09:15:51 2012
Received: from localhost ([127.0.0.1]:60518 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SPCvn-0004RU-0X
	for submit <at> debbugs.gnu.org; Tue, 01 May 2012 09:15:51 -0400
Received: from acsinet15.oracle.com ([141.146.126.227]:25188)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <drew.adams@HIDDEN>) id 1SPCvj-0004RG-Pt
	for 11378 <at> debbugs.gnu.org; Tue, 01 May 2012 09:15:48 -0400
Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94])
	by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with
	ESMTP id q41DEDeJ021779
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Tue, 1 May 2012 13:14:14 GMT
Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156])
	by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	q41DEC8T025424
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 1 May 2012 13:14:12 GMT
Received: from abhmt113.oracle.com (abhmt113.oracle.com [141.146.116.65])
	by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id
	q41DE7GN022697; Tue, 1 May 2012 08:14:07 -0500
Received: from dradamslap1 (/10.159.222.14)
	by default (Oracle Beehive Gateway v4.0)
	with ESMTP ; Tue, 01 May 2012 06:14:07 -0700
From: "Drew Adams" <drew.adams@HIDDEN>
To: "'Juri Linkov'" <juri@HIDDEN>,
	"'Stefan Monnier'" <monnier@HIDDEN>
References: <87haw32hly.fsf@HIDDEN>
	<jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN><87397m6oxf.fsf@HIDDEN>
	<87y5pcdzxx.fsf@HIDDEN>
Subject: RE: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Date: Tue, 1 May 2012 06:14:04 -0700
Message-ID: <A7C2999324C5498396ECF47537B2FA53@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <87y5pcdzxx.fsf@HIDDEN>
Thread-Index: Ac0ne/gRtHiNoS7qT0+RgOjwOFykSwAIDxrg
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157
X-Source-IP: ucsinet22.oracle.com [156.151.31.94]
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

> It would be more useful to allow multiple filters by transforming
> `isearch-filter-predicate' from the variable defining a 
> predicate to the
> hook-like list defining a set of predicates all of which 
> should satisfy for the search hit.
> 
> The default value could be a list with the current default element
> `isearch-filter-visible'.  And it still could allow a symbol 
> as its value for backward compatibility.

+1 





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 1 May 2012 13:01:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 01 09:01:20 2012
Received: from localhost ([127.0.0.1]:60506 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SPChk-00047A-66
	for submit <at> debbugs.gnu.org; Tue, 01 May 2012 09:01:20 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:41317)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SPChh-00046x-VS
	for 11378 <at> debbugs.gnu.org; Tue, 01 May 2012 09:01:18 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AjEKACxOgk9soX5J/2dsb2JhbABDtheCDAOBDIEIggkBAQQBViMFCws0EhQYDSSIHAW2MothhHkEpEWBXYMD
X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="177955110"
Received: from 108-161-126-73.dsl.teksavvy.com (HELO pastel.home)
	([108.161.126.73])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	01 May 2012 08:59:44 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id DBEA2590E8; Tue,  1 May 2012 08:59:43 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Message-ID: <jwvhaw083ig.fsf-monnier+emacs@HIDDEN>
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN> <87y5pcdzxx.fsf@HIDDEN>
Date: Tue, 01 May 2012 08:59:43 -0400
In-Reply-To: <87y5pcdzxx.fsf@HIDDEN> (Juri Linkov's message of "Tue,
	01 May 2012 12:15:54 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

>> There are more isearch filters that could share the same map `M-s f'.
> Actually, currently these isearch filters can be used only one at a time.

> It would be more useful to allow multiple filters by transforming
> `isearch-filter-predicate' from the variable defining a predicate to the
> hook-like list defining a set of predicates all of which should satisfy
> for the search hit.

Sounds good to me.  Not sure how you'll fix the

	     (and (eq isearch-filter-predicate 'isearch-filter-visible)
		  search-invisible))

(which I already had annotated in my local tree with the comment
"FIXME: equality comparisons on functions is asking for trouble.")

> The default value could be a list with the current default element
> `isearch-filter-visible'.  And it still could allow a symbol as its value
> for backward compatibility.

Yes, you could just `run-hook-with-args-until-success'.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 1 May 2012 09:24:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 01 05:24:00 2012
Received: from localhost ([127.0.0.1]:60403 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SP9JQ-0005tw-1t
	for submit <at> debbugs.gnu.org; Tue, 01 May 2012 05:24:00 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:54367
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1SP9JN-0005tg-Ul
	for 11378 <at> debbugs.gnu.org; Tue, 01 May 2012 05:23:59 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 8D14C451C9DA;
	Tue,  1 May 2012 02:22:30 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
	<87397m6oxf.fsf@HIDDEN>
Date: Tue, 01 May 2012 12:15:54 +0300
In-Reply-To: <87397m6oxf.fsf@HIDDEN> (Juri Linkov's message of "Mon,
	30 Apr 2012 03:28:08 +0300")
Message-ID: <87y5pcdzxx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> There are more isearch filters that could share the same map `M-s f'.

Actually, currently these isearch filters can be used only one at a time.

It would be more useful to allow multiple filters by transforming
`isearch-filter-predicate' from the variable defining a predicate to the
hook-like list defining a set of predicates all of which should satisfy
for the search hit.

The default value could be a list with the current default element
`isearch-filter-visible'.  And it still could allow a symbol as its value
for backward compatibility.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 30 Apr 2012 00:36:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 29 20:36:07 2012
Received: from localhost ([127.0.0.1]:58271 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SOeb1-0005Ln-9T
	for submit <at> debbugs.gnu.org; Sun, 29 Apr 2012 20:36:07 -0400
Received: from ps18281.dreamhost.com ([69.163.218.105]:57605
	helo=ps18281.dreamhostps.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <juri@HIDDEN>) id 1SOeaf-0005Kw-Uu
	for 11378 <at> debbugs.gnu.org; Sun, 29 Apr 2012 20:36:04 -0400
Received: from localhost (ps18281.dreamhostps.com [69.163.218.105])
	by ps18281.dreamhostps.com (Postfix) with ESMTP id 6178C451C9AB;
	Sun, 29 Apr 2012 17:34:25 -0700 (PDT)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Organization: JURTA
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
Date: Mon, 30 Apr 2012 03:28:08 +0300
In-Reply-To: <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Sun, 29 Apr 2012 10:46:37 -0400")
Message-ID: <87397m6oxf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> You'll have to place it in the M-s prefix map instead, which was setup
> specifically to avoid eating up more key combinations which currently
> make isearch exit.

Or more specifically to the submap `M-s f' (where `f' means `filter')
such as e.g. `M-s f i' for `search-invisible' (or maybe `M-s f v'
since the filter predicate name is `isearch-filter-visible').

There are more isearch filters that could share the same map `M-s f'.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 29 Apr 2012 21:06:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 29 17:06:02 2012
Received: from localhost ([127.0.0.1]:58111 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SObJh-0000fi-Ub
	for submit <at> debbugs.gnu.org; Sun, 29 Apr 2012 17:06:02 -0400
Received: from mail-lb0-f172.google.com ([209.85.217.172]:61006)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <lennart.borgman@HIDDEN>) id 1SObJg-0000fF-HW
	for 11378 <at> debbugs.gnu.org; Sun, 29 Apr 2012 17:06:01 -0400
Received: by lbbgm13 with SMTP id gm13so1378559lbb.3
	for <11378 <at> debbugs.gnu.org>; Sun, 29 Apr 2012 14:04:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=WDfJZKZ5lGRk7OoVY8FzOJUn4xtlwq9omVLgjQLCvSA=;
	b=u/IIEUoquU1Hte5KQMCAR3m0y5bbJBPz6dRdDfks3Gr4oYYEid5ChoCGGtzl+gcaUS
	qrbaaBDtdKzfp5BimfNiUh0lZYtPWQ67xDXJ85o5Rf5paEGW8oUhY1wYMXAMH41GtshX
	8X7Ab6P9tZEuw+QJ89gj78wn+2NxnBgrihiGUv2v9tvkPb75a1p9G8q2pyFMigZ+uPgp
	EWERDw7N6egB3jtxb0+D3HWnLFvebzDkNjJ5gtJ0+aaegLWkZWXO+SMSlFGr/byvcVwC
	4FpO9ACKvY9ufr43M/OyyNtQln3Zh8k9SE750AglKI4fBjTGv04m2eF9e5u4aRQzaySr
	xJFw==
Received: by 10.152.103.239 with SMTP id fz15mr2265075lab.42.1335733476969;
	Sun, 29 Apr 2012 14:04:36 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.112.74.232 with HTTP; Sun, 29 Apr 2012 14:04:06 -0700 (PDT)
In-Reply-To: <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
From: Lennart Borgman <lennart.borgman@HIDDEN>
Date: Sun, 29 Apr 2012 23:04:06 +0200
Message-ID: <CANbX3669Y5gq6j6Xbj+FVk04Z=5RsYyUUmhhUv4OL=TgcY_JNQ@HIDDEN>
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
To: Stefan Monnier <monnier@HIDDEN>
Content-Type: multipart/alternative; boundary=f46d04088e9f68ccb804bed7aff6
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 11378
Cc: michael_heerdegen@HIDDEN, 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

--f46d04088e9f68ccb804bed7aff6
Content-Type: text/plain; charset=UTF-8

On Sun, Apr 29, 2012 at 16:46, Stefan Monnier <monnier@HIDDEN>wrote:

> >    (defun isearch-cycle-search-invisible ()
> >      "Cycle the value of `search-invisible'.
> >    Bound to \\<isearch-mode-map>\\[isearch-cycle-search-invisible] in
> `isearch'."
> >      (interactive)
> >      (setq search-invisible
> >            (case search-invisible
> >              ((nil) t)
> >              ((t)   'open)
> >              (else  nil)))
>
> I personally find the "search within hidden text without opening it" to
> be a completely useless option, so I couldn't want to cycle between all
> 3 options, but only between nil and `open'.
>
> >    (define-key isearch-mode-map [?\M-i]
> >           'isearch-cycle-search-invisible)
>
> You'll have to place it in the M-s prefix map instead, which was setup
> specifically to avoid eating up more key combinations which currently
> make isearch exit.
>
> > So, it would be good if the user could change the value of
> > `search-invisible' as well directly from isearch.
>
> I'm not sure I'd find it useful, but I can imagine some people might
> like it and there's plenty of room under the M-s prefix for such
> a thing.
>
> It is in my opinion very useful in org-mode.

--f46d04088e9f68ccb804bed7aff6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Sun, Apr 29, 2012 at 16:46, Stefan Monnier <span dir=3D"ltr">&lt;<a href=
=3D"mailto:monnier@HIDDEN" target=3D"_blank">monnier@HIDDEN=
l.ca</a>&gt;</span> wrote:<br><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">

&gt; =C2=A0 =C2=A0(defun isearch-cycle-search-invisible ()<br>
&gt; =C2=A0 =C2=A0 =C2=A0&quot;Cycle the value of `search-invisible&#39;.<b=
r>
&gt; =C2=A0 =C2=A0Bound to \\&lt;isearch-mode-map&gt;\\[isearch-cycle-searc=
h-invisible] in `isearch&#39;.&quot;<br>
&gt; =C2=A0 =C2=A0 =C2=A0(interactive)<br>
&gt; =C2=A0 =C2=A0 =C2=A0(setq search-invisible<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(case search-invisible<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((nil) t)<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((t) =C2=A0 &#39;open)=
<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(else =C2=A0nil)))<br>
<br>
I personally find the &quot;search within hidden text without opening it&qu=
ot; to<br>
be a completely useless option, so I couldn&#39;t want to cycle between all=
<br>
3 options, but only between nil and `open&#39;.<br>
<br>
&gt; =C2=A0 =C2=A0(define-key isearch-mode-map [?\M-i]<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &#39;isearch-cycle-search-invisible=
)<br>
<br>
You&#39;ll have to place it in the M-s prefix map instead, which was setup<=
br>
specifically to avoid eating up more key combinations which currently<br>
make isearch exit.<br>
<br>
&gt; So, it would be good if the user could change the value of<br>
&gt; `search-invisible&#39; as well directly from isearch.<br>
<br>
I&#39;m not sure I&#39;d find it useful, but I can imagine some people migh=
t<br>
like it and there&#39;s plenty of room under the M-s prefix for such<br>
a thing.<br><br></blockquote><div>It is in my opinion very useful in org-mo=
de.=C2=A0</div></div><br>

--f46d04088e9f68ccb804bed7aff6--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 29 Apr 2012 15:33:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 29 11:33:38 2012
Received: from localhost ([127.0.0.1]:57897 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SOW82-0001UQ-5H
	for submit <at> debbugs.gnu.org; Sun, 29 Apr 2012 11:33:38 -0400
Received: from rcsinet15.oracle.com ([148.87.113.117]:26829)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <drew.adams@HIDDEN>) id 1SOW80-0001UD-0z
	for 11378 <at> debbugs.gnu.org; Sun, 29 Apr 2012 11:33:36 -0400
Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238])
	by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with
	ESMTP id q3TFWDLJ013686
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Sun, 29 Apr 2012 15:32:13 GMT
Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156])
	by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	q3TFWCeJ018586
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sun, 29 Apr 2012 15:32:12 GMT
Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59])
	by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id
	q3TFWCqg016085; Sun, 29 Apr 2012 10:32:12 -0500
Received: from dradamslap1 (/10.159.176.150)
	by default (Oracle Beehive Gateway v4.0)
	with ESMTP ; Sun, 29 Apr 2012 08:32:12 -0700
From: "Drew Adams" <drew.adams@HIDDEN>
To: "'Stefan Monnier'" <monnier@HIDDEN>, <michael_heerdegen@HIDDEN>
References: <87haw32hly.fsf@HIDDEN> <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
Subject: RE: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Date: Sun, 29 Apr 2012 08:32:01 -0700
Message-ID: <3E51687FEA174928A36941535810B9FD@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
Thread-Index: Ac0mFxMXWqV/+XsjRoCphkqqDDbIqQABa/gA
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157
X-Source-IP: acsinet22.oracle.com [141.146.126.238]
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11378
Cc: 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

> I personally find the "search within hidden text without 
> opening it" to be a completely useless option, so I couldn't
> want to cycle between all 3 options, but only between nil and
> `open'.

FWIW, in isearch+.el I have a key that toggles between nil and the last non-nil
value of the option.  So if the user customizes the option to `open' then the
key toggles between `open' and nil.  But Michael might be right that some users
will want to switch between any of the 3 values.

> > So, it would be good if the user could change the value of
> > `search-invisible' as well directly from isearch.
> 
> I'm not sure I'd find it useful,

FWIW, I find the toggle useful.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at 11378 <at> debbugs.gnu.org:


Received: (at 11378) by debbugs.gnu.org; 29 Apr 2012 14:48:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 29 10:48:02 2012
Received: from localhost ([127.0.0.1]:57869 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SOVPr-0000Sx-Sq
	for submit <at> debbugs.gnu.org; Sun, 29 Apr 2012 10:48:02 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:41040)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SOVPo-0000So-0J
	for 11378 <at> debbugs.gnu.org; Sun, 29 Apr 2012 10:47:57 -0400
Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca
	[132.204.27.242])
	by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q3TEkcQd021697; 
	Sun, 29 Apr 2012 10:46:38 -0400
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
	id 17870AE113; Sun, 29 Apr 2012 10:46:37 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: michael_heerdegen@HIDDEN
Subject: Re: bug#11378: 24.1.50;
	Suggestion: Let M-i in isearch cycle `search-invisible'
Message-ID: <jwvzk9uwr0x.fsf-monnier+emacs@HIDDEN>
References: <87haw32hly.fsf@HIDDEN>
Date: Sun, 29 Apr 2012 10:46:37 -0400
In-Reply-To: <87haw32hly.fsf@HIDDEN> (Michael Heerdegen's message of "Sun, 29
	Apr 2012 08:10:33 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV4206=0
X-NAI-Spam-Version: 2.2.0.9309 : core <4206> : streams <751253> : uri <1105174>
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 11378
Cc: 11378 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.5 (---)

>    (defun isearch-cycle-search-invisible ()
>      "Cycle the value of `search-invisible'.
>    Bound to \\<isearch-mode-map>\\[isearch-cycle-search-invisible] in `isearch'."
>      (interactive)
>      (setq search-invisible
>            (case search-invisible
>              ((nil) t)
>              ((t)   'open)
>              (else  nil)))

I personally find the "search within hidden text without opening it" to
be a completely useless option, so I couldn't want to cycle between all
3 options, but only between nil and `open'.

>    (define-key isearch-mode-map [?\M-i]
>           'isearch-cycle-search-invisible)

You'll have to place it in the M-s prefix map instead, which was setup
specifically to avoid eating up more key combinations which currently
make isearch exit.

> So, it would be good if the user could change the value of
> `search-invisible' as well directly from isearch.

I'm not sure I'd find it useful, but I can imagine some people might
like it and there's plenty of room under the M-s prefix for such
a thing.
So if you can address the above two comments, and provide the result as
a patch against isearch.el, we can install it.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Apr 2012 06:10:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 29 02:10:08 2012
Received: from localhost ([127.0.0.1]:57424 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SONKi-0004wI-4V
	for submit <at> debbugs.gnu.org; Sun, 29 Apr 2012 02:10:08 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39086)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SONKf-0004vk-Mh
	for submit <at> debbugs.gnu.org; Sun, 29 Apr 2012 02:10:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SONJN-00064Z-32
	for submit <at> debbugs.gnu.org; Sun, 29 Apr 2012 02:08:46 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:43153)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SONJM-00064U-W4
	for submit <at> debbugs.gnu.org; Sun, 29 Apr 2012 02:08:45 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39610)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SONJL-0007fF-Bt
	for bug-gnu-emacs@HIDDEN; Sun, 29 Apr 2012 02:08:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SONJJ-00063v-B5
	for bug-gnu-emacs@HIDDEN; Sun, 29 Apr 2012 02:08:42 -0400
Received: from fmmailgate01.web.de ([217.72.192.221]:50154)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michael_heerdegen@HIDDEN>) id 1SONJJ-00063e-1W
	for bug-gnu-emacs@HIDDEN; Sun, 29 Apr 2012 02:08:41 -0400
Received: from moweb002.kundenserver.de (moweb002.kundenserver.de
	[172.19.20.108])
	by fmmailgate01.web.de (Postfix) with ESMTP id 81CE81AD484A6
	for <bug-gnu-emacs@HIDDEN>; Sun, 29 Apr 2012 08:08:38 +0200 (CEST)
Received: from snow.dragon ([82.113.98.117]) by smtp.web.de (mrweb001) with
	ESMTPA (Nemesis) id 0MOB3E-1SIrXF3lcy-005WoU;
	Sun, 29 Apr 2012 08:08:38 +0200
Date: Sun, 29 Apr 2012 08:10:33 +0200
Message-Id: <87haw32hly.fsf@HIDDEN>
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.1.50; Suggestion: Let M-i in isearch cycle `search-invisible'
X-Provags-ID: V02:K0:54FNADCyCL+0k1Z0kNuNiCyRvg++3GYzN0aQ3COPPSI
	sAFSbLOwClP83g4/ze/qAz+QtFyfTNVuLA/h7DNz+g3EJBXQv7
	nMGZ6b8e+1wEUMTEow6Ia7klZv+K4j++auIeI1K1KpcQ0xHL7H
	tgjh1LjRMqu7w46MOe1t/MH5df8JIFVnCNGTl1J/wktuqPQgca
	D+rOa/M0XrK7oXZNzYB8UZS9V6l/T3d5ICMe5nXv88=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: michael_heerdegen@HIDDEN
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Hi,

I want to suggest something like that:

   (defun isearch-cycle-search-invisible ()
     "Cycle the value of `search-invisible'.
   Bound to \\<isearch-mode-map>\\[isearch-cycle-search-invisible] in `isearch'."
     (interactive)
     (setq search-invisible
           (case search-invisible
             ((nil) t)
             ((t)   'open)
             (else  nil)))
     (message "search-invisible: %s" search-invisible)
     (sit-for 1.)
     (setq isearch-success t isearch-adjusted t)
     (isearch-update))
   
   (define-key isearch-mode-map [?\M-i]
          'isearch-cycle-search-invisible)

Because like regexp search, word search and case sensitivity,
`search-invisible' is not something a user will set once and forever
in his config - different values are useful in different contexts.

Many users will want to use the default value 'open most of the time,
but the other two possible values are also very useful sometimes,
e.g. to limit searching to visible parts in a folded buffer (headlines
in org, or an outline produced with hideshow-mode etc.).

So, it would be good if the user could change the value of
`search-invisible' as well directly from isearch.


Thanks,

Michael.


In GNU Emacs 24.1.50.1 (i486-pc-linux-gnu, GTK+ Version 3.4.1)
 of 2012-04-23 on zelenka, modified by Debian
 (emacs-snapshot package, version 2:20120423-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11104000
Configured using:
 `configure '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.1.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1.50/site-lisp:/usr/share/emacs/site-lisp'
 '--without-compress-info' '--with-crt-dir=/usr/lib/i386-linux-gnu/'
 '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes'
 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu'
 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2''




Acknowledgement sent to michael_heerdegen@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#11378; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 14 Jul 2021 09:30:02 UTC

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