|
From: | Francesco Potorti` |
Subject: | Re: please implement query-exchange |
Date: | 19 Nov 2002 23:10:51 +0100 |
User-agent: | Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.92 |
Untested: (defun query-exchange ( &optional fstr sstr ) "Exchanges all occurences of fstr with sstr and vice-versa in the region." (interactive) (if (interactive-p) (progn (setq fstr (read-from-minibuffer "First string: ")) (setq sstr (read-from-minibuffer "Second string: ")))) (save-excursion (goto-char (region-beginning) (while (re-search-forward (concat "\\(" fstr "\\)\\|\\(" sstr "\\)) (region-end) t) (if (nilp (match-beginning 1)) (replace-match fstr) (replace-match sstr)))))))
[Prev in Thread] | Current Thread | [Next in Thread] |