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: Tassilo Horn
Subject: Re: Operate on region string
Date: Mon, 18 Sep 2006 12:37:56 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Hadron Quark <address@hidden> 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"))

Bye,
Tassilo
-- 
   "Mein Baby bekommt nur Trockenmilch, da brauche ich hinterher nur
                             abzustauben."


reply via email to

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