unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: robert.thorpe@antenova.com
Subject: Re: Operate on region string
Date: 20 Sep 2006 03:14:49 -0700	[thread overview]
Message-ID: <1158747288.902396.206470@e3g2000cwe.googlegroups.com> (raw)
In-Reply-To: <87hcz52o6d.fsf@gmail.com>

Hadron Quark wrote:
> Tassilo Horn <heimdall@uni-koblenz.de> writes:
>
> > Hadron Quark <hadronquark@gmail.com> writes:
> >
> > Hi Hadron,
> >
> >> I want something like this to work on a buffer region
> >>
> >> (defun remove-vowels-region(te)
> >>   "Remove the vowels"
> >>   (interactive "sTe:")
> >>   (replace-regexp-in-string "[aeiouAEIOU]" "" te)
> >> )
> >
> > Try that:
> >
> > (defun remove-vowels-region (start end)
> >   (interactive "r")
> >   (replace-regexp "[aeiouAEIOU]" "" nil start end))
> >
> > Bye,
> > Tassilo
>
> vn shrtr nd swtr!
>
> (even shorter and sweeter)

As a sidenote, you look at the problem like this:

* Is there a function that works on a region I can use for my purpose.
If so it is simple like the above.

* If not, maybe there is a function that works on the whole region.  In
this case I can use M-x widen and M-x narrow-to-region to perform an
action on a region.

* If that doesn't work (which is very unlikely) then convert the region
to a string and operate on the string.

  reply	other threads:[~2006-09-20 10:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-18  9:59 Operate on region string Hadron Quark
2006-09-18 10:37 ` Tassilo Horn
2006-09-18 12:28   ` Hadron Quark
2006-09-18 12:55     ` Tassilo Horn
2006-09-18 15:24       ` Hadron Quark
2006-09-20 10:14         ` robert.thorpe [this message]
2006-09-18 13:02     ` Mathias Dahl
2006-09-18 13:10       ` Hadron Quark
2006-09-19 22:20         ` John Sullivan
2006-09-18 11:13 ` Pascal Bourguignon
2006-09-18 12:21   ` Hadron Quark
2006-09-19  9:07     ` Pascal Bourguignon
2006-10-14 22:23       ` David Combs

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1158747288.902396.206470@e3g2000cwe.googlegroups.com \
    --to=robert.thorpe@antenova.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).