help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: isearch based on syntax?


From: Drew Adams
Subject: RE: [External] : Re: isearch based on syntax?
Date: Thu, 30 Jun 2022 01:47:54 +0000

> > Is it possible to limit (i)search to, say, Lisp doc strings?
> 
> Not with vanilla isearch, AFAIK, but you can load library
> isearch+ (https://www.emacswiki.org/emacs/IsearchPlus).

Yes.  You need only `isearch-prop.el' for this, not
also `isearch+.el' (they're both part of Isearch+).

After loading `isearch-prop.el' you can use command
`isearch-property(-regexp)-forward' (or `-backward')
to search within zones of text that have text or an
overlay, or both, with one or more `face' properties
(or any other properties).

You can use those commands from within regular
Isearch (e.g. `C-s'), by using `C-t' (or `C-M-t' for
regexp search).

In this case, you just want to search within text
that has face `font-lock-doc-face'.

With no prefix arg you're prompted for the following:

* property type (e.g. `text')
  (The default is both text and overlay properties.)
* property (e.g., `face')
* property values (e.g., one or more face names)

You only need go through the prompting once, if you
want to search zones of the same property again: use
`C-u C-t' (or `C-u C-M-t') to repeat the same kind
of property search - no prompting.

(To be able to use a prefix arg within Isearch, set
option `isearch-allow-prefix' to non-nil.)

When you're prompted for the property name, and you
say `face', you're prompted repeatedly for faces.
Just hit RET with no input to end the list of faces.

E.g., enter `font-lock-doc-face RET RET', to search
within text with that face - including with any
other faces as well, e.g. `font-lock-constant-face'.

Or `font-lock-doc-face RET font-lock-constant-face
RET RET', to search only within that combination of
faces, i.e., only constants in doc strings, not
other doc-string text and not constants in comments.

You can also search the text that does NOT have a
face (or a set of faces) - e.g., the text outside
doc strings.  Just use `C-M-~' while searching, to
toggle searching the complement of a set of zones.

`isearch-prop.el' is here:

https://www.emacswiki.org/emacs/download/isearch-prop.el



reply via email to

[Prev in Thread] Current Thread [Next in Thread]