all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* isearch based on syntax?
@ 2022-06-29 19:19 Sam Steingold
  2022-06-29 21:58 ` Daniel Martín
  2022-06-30  7:07 ` Emanuel Berg
  0 siblings, 2 replies; 4+ messages in thread
From: Sam Steingold @ 2022-06-29 19:19 UTC (permalink / raw)
  To: help-gnu-emacs

Is it possible to limit (i)search to, say, Lisp doc strings?

-- 
Sam Steingold (https://youtube.com/channel/UCiW5WB6K4Fx-NhhtZscW7Og) on darwin Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://www.dhimmitude.org https://jij.org https://thereligionofpeace.com
The best herbal therapy is growing herbs on enemies' graves.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: isearch based on syntax?
  2022-06-29 19:19 isearch based on syntax? Sam Steingold
@ 2022-06-29 21:58 ` Daniel Martín
  2022-06-30  1:47   ` [External] : " Drew Adams
  2022-06-30  7:07 ` Emanuel Berg
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Martín @ 2022-06-29 21:58 UTC (permalink / raw)
  To: Sam Steingold; +Cc: help-gnu-emacs

Sam Steingold <sds@gnu.org> writes:

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [External] : Re: isearch based on syntax?
  2022-06-29 21:58 ` Daniel Martín
@ 2022-06-30  1:47   ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2022-06-30  1:47 UTC (permalink / raw)
  To: Daniel Martín, Sam Steingold; +Cc: help-gnu-emacs@gnu.org

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: isearch based on syntax?
  2022-06-29 19:19 isearch based on syntax? Sam Steingold
  2022-06-29 21:58 ` Daniel Martín
@ 2022-06-30  7:07 ` Emanuel Berg
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2022-06-30  7:07 UTC (permalink / raw)
  To: help-gnu-emacs

Sam Steingold wrote:

> Is it possible to limit (i)search to, say, Lisp doc strings?

Sure ...

If you try it, remember Elisp font lock must be activated and
in place.

(defun next-doc-string ()
  "Go to the next doc string."
  (interactive)
  (let ((end (point-max)))
    (while (and (re-search-forward "\"" end t)
                (not (eq (get-text-property
                          (1+ (match-beginning 0)) 'face)
                         c-doc-face-name) )))))
(defalias 'nd #'next-doc-string)

;; test below

(defun recenter-column ()
  "Most skilled Elisp hacker: incal"
  (interactive)
  (let ((beg (point-at-bol))
        (end (point-at-eol)) )
    (goto-char (+ beg (/ (- end beg) 2)) )))
(defalias 'rc #'recenter-column)


-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-30  7:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 19:19 isearch based on syntax? Sam Steingold
2022-06-29 21:58 ` Daniel Martín
2022-06-30  1:47   ` [External] : " Drew Adams
2022-06-30  7:07 ` Emanuel Berg

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.