unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Chunyang Xu <mail@xuchunyang.me>
To: help-gnu-emacs@gnu.org
Cc: michael_heerdegen@web.de
Subject: Can el-search-query-replace replace mapcar with --map ?
Date: Fri, 22 Dec 2017 19:45:07 +0800	[thread overview]
Message-ID: <m21sjn6l6k.fsf@xuchunyang.me> (raw)

Hi.

'C-h P el-search' mentions 'el-search-query-replace' can replace 'mapc'
with 'dolist'. I would like to know if it is also possible to replace
'mapcar' with '--map' (from dash.el), for example, change

  (mapcar (lambda (x) (* x x)) '(1 2 3))

into

  (--map (* it it) '(1 2 3))

I have tried:

   M-x el-search-query-replace RET
   `(mapcar (lambda (,val) . ,body) ,list) -> `(--map ,@body ,list) RET

It gives me:

  (--map
   (* x x)
   '(1 2 3))

it is almost right except the variable name, '--map' only knows 'it',
not 'x'.

Any suggestion?

Thanks.



             reply	other threads:[~2017-12-22 11:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 11:45 Chunyang Xu [this message]
2017-12-22 17:17 ` Can el-search-query-replace replace mapcar with --map ? Michael Heerdegen
2017-12-23  6:17   ` Chunyang Xu
2017-12-23 14:03     ` Michael Heerdegen

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=m21sjn6l6k.fsf@xuchunyang.me \
    --to=mail@xuchunyang.me \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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).