unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Zhang Haijun <ccsmile2008@outlook.com>, help-gnu-emacs@gnu.org
Subject: RE: How to yank a regexp in isearch-mode?
Date: Sat, 10 Nov 2018 18:22:19 -0800 (PST)	[thread overview]
Message-ID: <225f0813-8140-4ab5-a97c-bfdee0451be6@default> (raw)
In-Reply-To: <4DFE9F27-7B86-4C33-B1BE-8193B56AD261@outlook.com>

> 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	other threads:[~2018-11-11  2:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11  0:46 How to yank a regexp in isearch-mode? Zhang Haijun
2018-11-11  2:22 ` Drew Adams [this message]
     [not found]   ` <C911266F-D49A-4164-ABAF-BF84D9C2C8F9@outlook.com>
2018-11-11 17:13     ` Drew Adams
2018-11-12 10:43       ` Zhang Haijun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=225f0813-8140-4ab5-a97c-bfdee0451be6@default \
    --to=drew.adams@oracle.com \
    --cc=ccsmile2008@outlook.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).