From: Emanuel Berg <moasen@zoho.com>
To: help-gnu-emacs@gnu.org
Subject: Re: replace deprecated function ?
Date: Tue, 13 Feb 2018 20:27:17 +0100 [thread overview]
Message-ID: <86vaf0g06i.fsf@zoho.com> (raw)
In-Reply-To: p5va1k0iq5@news2.newsguy.com
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
next prev parent reply other threads:[~2018-02-13 19:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 18:16 replace deprecated function ? B. T. Raven
2018-02-13 19:27 ` Emanuel Berg [this message]
2018-02-13 20:00 ` Emanuel Berg
2018-02-13 22:41 ` B. T. Raven
2018-02-13 23:19 ` Joost Kremers
2018-02-13 23:26 ` Emanuel Berg
2018-02-13 23:33 ` Emanuel Berg
2018-02-14 2:36 ` Yuri Khan
[not found] ` <mailman.9079.1518575794.27995.help-gnu-emacs@gnu.org>
2018-02-14 3:34 ` Emanuel Berg
[not found] ` <mailman.9067.1518563981.27995.help-gnu-emacs@gnu.org>
2018-02-14 23:04 ` B. T. Raven
2018-02-16 16:57 ` Emanuel Berg
2018-02-16 20:19 ` B. T. Raven
2018-02-13 21:14 ` Kaushal Modi
[not found] ` <mailman.9061.1518556487.27995.help-gnu-emacs@gnu.org>
2018-02-14 23:31 ` B. T. Raven
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86vaf0g06i.fsf@zoho.com \
--to=moasen@zoho.com \
--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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.