From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: replace deprecated function ? Date: Tue, 13 Feb 2018 20:27:17 +0100 Organization: Aioe.org NNTP Server Message-ID: <86vaf0g06i.fsf@zoho.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1518550152 1348 195.159.176.226 (13 Feb 2018 19:29:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Feb 2018 19:29:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 13 20:29:08 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elgFi-0006P0-QI for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Feb 2018 20:28:30 +0100 Original-Received: from localhost ([::1]:41652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elgHk-0008MQ-H2 for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Feb 2018 14:30:36 -0500 X-Received: by 10.223.150.47 with SMTP id b44mr278325wra.0.1518550040996; Tue, 13 Feb 2018 11:27:20 -0800 (PST) Original-Path: usenet.stanford.edu!e26no3868421wmh.0!news-out.google.com!n14ni27940wmi.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: UHWYWQF2IuZrSKObhXEbig.user.gioia.aioe.org Original-X-Complaints-To: abuse@aioe.org Cancel-Lock: sha1:q3qtcHHsi06oYkeBiWkwoWd7x28= Mail-Copies-To: never X-Notice: Filtered by postfilter v. 0.8.3 Original-Xref: usenet.stanford.edu gnu.emacs.help:221864 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:115978 Archived-At: 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