GNU bug report logs -
#8686
24.0.50; `re-search-backward' does not respect `search-invisible'
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Tue, 17 May 2011 22:10:03 UTC
Severity: wishlist
Tags: notabug
Found in version 24.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8686 in the body.
You can then email your comments to 8686 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Tue, 17 May 2011 22:10:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Drew Adams" <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 17 May 2011 22:10:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
My impression is that `re-search-backward' and `*-forward' do not
respect `search-invisible'. This makes it difficult if not impossible
to use them in code to not find matches in hidden text. Why would this
variable be respected only in the Isearch Lisp code? What am I missing?
My use case at the moment is to make Imenu (conditionally) not count
definitions that are commented out, by temporarily hiding commented
code. I bind `search-invisible' to nil, but that has no effect on
`re-search-backward', which is called by the Imenu code
(e.g. `imenu--generic-function'). The code finds commented out
definitions, in spite of `search-invisible'.
In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
of 2011-05-16 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt --cflags
-Ic:/build/include'
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 00:06:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 8686 <at> debbugs.gnu.org (full text, mbox):
> My impression is that `re-search-backward' and `*-forward' do not
> respect `search-invisible'.
These are low-level C functions, whereas search-invisible is implemented
on top in Elisp and is a Customization variable rather than a variable
for use by Elisp code.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 00:40:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 8686 <at> debbugs.gnu.org (full text, mbox):
> > My impression is that `re-search-backward' and `*-forward' do not
> > respect `search-invisible'.
>
> These are low-level C functions, whereas search-invisible is
> implemented on top in Elisp and is a Customization variable
> rather than a variable for use by Elisp code.
Well, yes. In a sense that is precisely what this bug report is about. There
should be a simple way in Lisp to direct the search functions to ignore or see
hidden text. It should be enough to bind some variable for the relevant
context/duration.
And BTW, there is already Lisp code that binds `search-invisible' - in
isearch.el itself! It is just as kosher for other Lisp code to act similarly.
If lazy highlighting can bind it for its own purposes, so can other code that
uses or adapts search functions.
Also BTW, the variable is named `search-invisible', not `isearch-invisible'
(unlike, e.g., `isearch-open-invisible'). Presumably it is not only for
incremental search, or even interactive search.
Question: What is the simplest way, from Lisp, to get the "low-level C" search
functions to optionally respect/ignore hidden text? Should Lisp programmers be
required to reproduce the entire invisibility-respecting scaffolding created in
isearch.el (or equivalent)? How about having a single, standard infrastructure
provided by Emacs?
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 00:52:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 8686 <at> debbugs.gnu.org (full text, mbox):
> Question: What is the simplest way, from Lisp, to get the "low-level
> C" search functions to optionally respect/ignore hidden text?
Something like
(while (and (re-search-forward blabla)
(invisible-p (point)))
...)
The same idea can be used with syntax-ppss to skip over matches that are
inside comments/strings.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 01:16:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 8686 <at> debbugs.gnu.org (full text, mbox):
On Wed, May 18, 2011 at 2:51 AM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> Question: What is the simplest way, from Lisp, to get the "low-level
>> C" search functions to optionally respect/ignore hidden text?
>
> Something like
>
> (while (and (re-search-forward blabla)
> (invisible-p (point)))
> ...)
>
> The same idea can be used with syntax-ppss to skip over matches that are
> inside comments/strings.
Maybe implement this as minor modes for isearch, occur etc?
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 02:19:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 8686 <at> debbugs.gnu.org (full text, mbox):
> > Question: What is the simplest way, from Lisp, to get the "low-level
> > C" search functions to optionally respect/ignore hidden text?
>
> Something like
>
> (while (and (re-search-forward blabla)
> (invisible-p (point)))
> ...)
>
> The same idea can be used with syntax-ppss to skip over
> matches that are inside comments/strings.
Yes, but why not have this built into the search functions themselves, just as
is done for isearch? That was the point/suggestion.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 09:58:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 8686 <at> debbugs.gnu.org (full text, mbox):
On Wed, May 18, 2011 at 4:18 AM, Drew Adams <drew.adams <at> oracle.com> wrote:
>> > Question: What is the simplest way, from Lisp, to get the "low-level
>> > C" search functions to optionally respect/ignore hidden text?
>>
>> Something like
>>
>> (while (and (re-search-forward blabla)
>> (invisible-p (point)))
>> ...)
>>
>> The same idea can be used with syntax-ppss to skip over
>> matches that are inside comments/strings.
>
> Yes, but why not have this built into the search functions themselves, just as
> is done for isearch? That was the point/suggestion.
Which also was the point of my suggestions...
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 12:14:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 8686 <at> debbugs.gnu.org (full text, mbox):
>> > Question: What is the simplest way, from Lisp, to get the "low-level
>> > C" search functions to optionally respect/ignore hidden text?
>>
>> Something like
>>
>> (while (and (re-search-forward blabla)
>> (invisible-p (point)))
>> ...)
>>
>> The same idea can be used with syntax-ppss to skip over
>> matches that are inside comments/strings.
> Yes, but why not have this built into the search functions themselves,
> just as is done for isearch?
Because I'd rather that the low-level functions do one thing and one
thing well.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 13:13:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 8686 <at> debbugs.gnu.org (full text, mbox):
On Wed, May 18, 2011 at 2:13 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>>> > Question: What is the simplest way, from Lisp, to get the "low-level
>>> > C" search functions to optionally respect/ignore hidden text?
>>>
>>> Something like
>>>
>>> (while (and (re-search-forward blabla)
>>> (invisible-p (point)))
>>> ...)
>>>
>>> The same idea can be used with syntax-ppss to skip over
>>> matches that are inside comments/strings.
>
>> Yes, but why not have this built into the search functions themselves,
>> just as is done for isearch?
>
> Because I'd rather that the low-level functions do one thing and one
> thing well.
(Of course my suggestion with minor modes was not for the low level functions.)
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Wed, 18 May 2011 14:33:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 8686 <at> debbugs.gnu.org (full text, mbox):
> >> The same idea can be used with syntax-ppss to skip over
> >> matches that are inside comments/strings.
>
> > Yes, but why not have this built into the search functions
> > themselves, just as is done for isearch?
>
> Because I'd rather that the low-level functions do one thing and one
> thing well.
Sure. Define `re-search-forward' & compagnie in Lisp.
Have them call C functions that each do one simple thing well.
That way, existing code that uses these long-standing functions can benefit from
this feature (or can ignore it) just by binding a variable.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Thu, 28 Apr 2016 10:49:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 8686 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
> My impression is that `re-search-backward' and `*-forward' do not
> respect `search-invisible'. This makes it difficult if not impossible
> to use them in code to not find matches in hidden text. Why would this
> variable be respected only in the Isearch Lisp code? What am I missing?
Well, `search-invisible' is documented as only applying to interactive
searches:
----
search-invisible is a variable defined in ‘isearch.el’.
Its value is ‘open’
Documentation:
If t incremental search/query-replace can match hidden text.
A nil value means don’t match invisible text.
----
If you want code not to match invisible text, you have to make your code
check for the visibility. Closing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) notabug.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 28 Apr 2016 10:49:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
8686 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 28 Apr 2016 10:49:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8686
; Package
emacs
.
(Thu, 28 Apr 2016 13:53:02 GMT)
Full text and
rfc822 format available.
Message #42 received at 8686 <at> debbugs.gnu.org (full text, mbox):
> > My impression is that `re-search-backward' and `*-forward' do not
> > respect `search-invisible'. This makes it difficult if not impossible
> > to use them in code to not find matches in hidden text. Why would this
> > variable be respected only in the Isearch Lisp code? What am I missing?
>
> Well, `search-invisible' is documented as only applying to interactive
> searches:
>
> ----
>
> search-invisible is a variable defined in 'isearch.el'.
> Its value is 'open'
>
> Documentation:
> If t incremental search/query-replace can match hidden text.
> A nil value means don't match invisible text.
>
> ----
>
> If you want code not to match invisible text, you have to make your code
> check for the visibility. Closing.
I don't think this is correct. Did you check whether it
truly works only for interactive use? It is a general
test, used in multiple places now (including `perform-replace').
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 27 May 2016 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 23 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.