help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Operate on region string


From: Hadron Quark
Subject: Re: Operate on region string
Date: Mon, 18 Sep 2006 14:28:31 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Tassilo Horn <heimdall@uni-koblenz.de> writes:

> Hadron Quark <hadronquark@gmail.com> writes:
>
> Hi Hadron,
>
>> Whats the "de-facto" recommended way to work on a region?
>>
>> I guess the sequence is something like
>>
>>         (setq t (region-text))
>>         (setq t (dowork-on-text((t))))
>>         (replace-region(t))
>>
>> What is the correct approach?
>
> Here's a samplte function which operates on a region. It reverses the
> lines of the region, boxquotes it and titles the boxquote (needs
> boxquote.el):
>
>                   +-------------------------------+
>                   |The beginning and end positions|
>                   |of the marked region.          |
>                   +-------------------------------+
>                                    X
>                                   / \
>                                  /   \
> (defun reverse-boxquote-region (BEG END)
>   (interactive "r") ;; <-- "r" means: "Operate on a region"
>                     ;; see C-h f interactive RET
>   (reverse-region BEG END)
>   (boxquote-region BEG END)
>   (boxquote-title "Reversed and boxquoted region"))

Thanks Tassilo - but this isnt showing me how to actually do anything
myself with the text string contained by the region if you get my
meaning.

I tried reading the code in boxquote, but there are too many function
calls not documented. 

Maybe you could help?

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

I hilite some text and then call remove-vowels-in-region.

A first step would be sufficient to get me on my way : I'm not a lisp
programmer but am learning a little.

>
> Bye,
> Tassilo

-- 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]