all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Francesco Potorti` <pot@gnu.org>
Subject: Re: please implement query-exchange
Date: 19 Nov 2002 23:10:51 +0100	[thread overview]
Message-ID: <87r8dhgqhg.fsf@pot.cnuce.cnr.it> (raw)
In-Reply-To: <m3fztxqsfz.fsf@fischman.org>

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)))))))

  reply	other threads:[~2002-11-19 22:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-16  1:59 please implement query-exchange Dan Jacobson
2002-11-16 18:14 ` Eli Zaretskii
     [not found]   ` <8765uvpx52.fsf@jidanni.org>
     [not found]     ` <9003-Mon18Nov2002210929+0200-eliz@is.elta.co.il>
2002-11-18 23:37       ` Dan Jacobson
2002-11-19  6:57         ` Eli Zaretskii
2002-11-19 21:57           ` Dan Jacobson
2002-11-19 17:25   ` Ami Fischman
2002-11-19 17:59     ` Eli Zaretskii
2002-11-19 19:18       ` Ami Fischman
2002-11-19 22:10         ` Francesco Potorti` [this message]
2002-11-19 23:43           ` Dan Jacobson
2002-11-20  1:03           ` Dan Jacobson
2002-11-20 21:29             ` Ami Fischman
2002-11-21 23:22               ` Dan Jacobson
2002-11-21 17:12             ` Richard Stallman

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=87r8dhgqhg.fsf@pot.cnuce.cnr.it \
    --to=pot@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.