|
From: | Emanuel Berg |
Subject: | Re: replace deprecated function ? |
Date: | Wed, 14 Feb 2018 04:34:55 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Yuri Khan wrote: > This will ask for all jameses first, and then > all blishes. The original snippet probably > intended to do them all in document order. (defun replace-list-ask-3 (re dict) (save-excursion (goto-char (point-min)) (while (re-search-forward re nil t) (let*((match-string (match-string-no-properties 0)) (default (cdr (assoc match-string dict)) )) (when (and default (yes-or-no-p (format "Replace \"%s\" with \"%s\" ? " match-string default))) (replace-match default) ))))) ;; (replace-list-ask-3 "james\\|blish" '(("james" . "James" ) ("blish" . "Blish")) ) -- underground experts united http://user.it.uu.se/~embe8573
[Prev in Thread] | Current Thread | [Next in Thread] |