unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: execute function in replace-regexp
Date: Sun, 1 Oct 2017 09:55:00 +0200	[thread overview]
Message-ID: <20171001075500.GC16509@tuxteam.de> (raw)
In-Reply-To: <864lrjwo0b.fsf@zoho.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, Oct 01, 2017 at 05:22:28AM +0200, Emanuel Berg wrote:
> How can I execute a Lisp function, namely
> `downcase', on the match from `replace-regexp'?
> 
> I Googled it and found [1] the syntax
> 
>     \, (downcase \1)
> 
> but doesn't get executed, just replaced as is.

 - There should be no space between the comma and the paren:
   \,(...)

 - I *think* you should string-quote the \1 (the \1 itself gets,
   AFAIR, replaced literally: to have correct elisp you need
   quotes, but I might be wrong on that)

This would make:

     \,(downcase "\1")

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlnQn1QACgkQBcgs9XrR2kaiNwCfbH21XW7lqm1mSOGmk1xpnI74
0hEAniA4jqwA5Vi/YvKyYnwwbCUECzzZ
=cfqz
-----END PGP SIGNATURE-----



  reply	other threads:[~2017-10-01  7:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-01  3:22 execute function in replace-regexp Emanuel Berg
2017-10-01  7:55 ` tomas [this message]
2017-10-01  8:44   ` Emanuel Berg
2017-10-01  8:49     ` tomas
2017-10-01 18:41 ` Marcin Borkowski
2017-10-01 20:26   ` Emanuel Berg
2017-10-02  4:49     ` Marcin Borkowski
2017-10-02  8:11       ` Emanuel Berg
2017-10-02  7:08   ` tomas

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=20171001075500.GC16509@tuxteam.de \
    --to=tomas@tuxteam.de \
    --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).