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

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

RE: How to yank a regexp in isearch-mode?


From: Drew Adams
Subject: RE: How to yank a regexp in isearch-mode?
Date: Sat, 10 Nov 2018 18:22:19 -0800 (PST)

> Is there a functions like isearch-yank-string but yank a regexp?
> 
> (defun my-isearch-foobar ()
>   (interactive)
>   (isearch-mode t)
>   (isearch-yank-string " foobar "))

`isearch-yank-string' can yank a regexp string as well.

If you use Isearch+ then you have option
`isearchp-regexp-quote-yank-flag':

Non-nil means escape special chars in text yanked for a regexp isearch.
You can toggle this using `isearchp-toggle-regexp-quote-yank', bound
to `C-`' during Isearch.

IOW, if you turn off this escaping then regexp search
interprets yanked regexps normally.  If you turn it on
then a yanked regexp string has its special chars
quoted (escaped).

With this escaping turned off, you can yank text such
as `^\*.*' without it being transformed to `\^\\\*\.\*'.

Isearch+:

https://www.emacswiki.org/emacs/IsearchPlus




reply via email to

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