[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replace deprecated function ?
From: |
Emanuel Berg |
Subject: |
Re: replace deprecated function ? |
Date: |
Tue, 13 Feb 2018 20:27:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
B. T. Raven wrote:
> But I notice that query-replace-regexp-eval is
> no longer considered kosher. How should this be
> rewritten for Emacs ver. 25? Especially I would
> like a function that is more immediately
> understandable than what I have now.
In general, you do this with a while loop: in
the condition, you search, and in the body, you
replace.
Note: `search-forward-regexp'/`replace-match'
is recommended but I don't see (right now) why
you can't do it with `re-search-forward' just
as well.
So an example would be, to replace all REGEXP
matches with REPLACE:
(defun replace-regexp-buffer (regexp replace)
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(replace-match replace) )))
For your situation,
1) Do the simplest possibly such
loop-and-replace (like my example)
2) Do a function that keeps a list, just as you
have, and then iterates the list and feed it
to the function from step 1.
--
underground experts united
http://user.it.uu.se/~embe8573
- replace deprecated function ?, B. T. Raven, 2018/02/13
- Re: replace deprecated function ?,
Emanuel Berg <=
- Re: replace deprecated function ?, Emanuel Berg, 2018/02/13
- Re: replace deprecated function ?, B. T. Raven, 2018/02/13
- Re: replace deprecated function ?, Joost Kremers, 2018/02/13
- Re: replace deprecated function ?, Emanuel Berg, 2018/02/13
- Re: replace deprecated function ?, Emanuel Berg, 2018/02/13
- Re: replace deprecated function ?, Yuri Khan, 2018/02/13
- Message not available
- Re: replace deprecated function ?, Emanuel Berg, 2018/02/13
- Message not available
- Re: replace deprecated function ?, B. T. Raven, 2018/02/14
- Re: replace deprecated function ?, Emanuel Berg, 2018/02/16
- Re: replace deprecated function ?, B. T. Raven, 2018/02/16