Subject: bug#8686: 24.0.50; `re-search-backward' does not respect `search-invisible'

From: "Drew Adams" <[email-masked]>
Date: Tue, 17 May 2011 17:38:43 -0700

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