unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Using lisp code in query-replace-regexp
@ 2014-11-04 14:49 Julien Cubizolles
  2014-11-04 18:38 ` Andreas Röhler
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Cubizolles @ 2014-11-04 14:49 UTC (permalink / raw)
  To: help-gnu-emacs

I can use the following replace string (for lack of a better term) with
query-replace-regexp

--8<---------------cut here---------------start------------->8---
\,(if (equal \2 nil) "+" (concat "+ " \2 " ::"))
--8<---------------cut here---------------end--------------->8---

How can I input it in a lisp function like:

--8<---------------cut here---------------start------------->8---
(defun jc-item-to-plus (Begin End)
  "Replace \\item by +"
  (interactive "r")
  (query-replace-regexp Begin End "some_standard_regexp" (if (equal \2 nil) "+" (concat "+ " \2 " ::")))
  )
--8<---------------cut here---------------end--------------->8---

Julien.




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

end of thread, other threads:[~2014-11-04 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 14:49 Using lisp code in query-replace-regexp Julien Cubizolles
2014-11-04 18:38 ` Andreas Röhler
2014-11-04 20:58   ` Julien Cubizolles

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