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

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

Using lisp code in query-replace-regexp


From: Julien Cubizolles
Subject: Using lisp code in query-replace-regexp
Date: Tue, 04 Nov 2014 15:49:22 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

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.




reply via email to

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