From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Operate on region string Date: Mon, 18 Sep 2006 12:37:56 +0200 Organization: University Koblenz-Landau Campus Koblenz Message-ID: <878xkhe9yz.fsf@baldur.nicundtas.de> References: <871wq9mr5h.fsf@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1158579701 6810 80.91.229.2 (18 Sep 2006 11:41:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Sep 2006 11:41:41 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 18 13:41:37 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GPHUr-0005Z4-MM for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Sep 2006 13:41:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GPHUr-0006Ce-4j for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Sep 2006 07:41:09 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!news.uni-kl.de!cache.uni-koblenz.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: dslb-084-063-036-001.pools.arcor-ip.net Original-X-Trace: cache.uni-koblenz.de 1158575877 11262 84.63.36.1 (18 Sep 2006 10:37:57 GMT) Original-X-Complaints-To: news@cache.uni-koblenz.de Original-NNTP-Posting-Date: Mon, 18 Sep 2006 10:37:57 +0000 (UTC) User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:NtMCCgMMYTKJor/FHMLp5KgijNU= Original-Xref: shelby.stanford.edu gnu.emacs.help:141828 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:37451 Archived-At: Hadron Quark 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."