From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dkcombs@panix.com (David Combs) Newsgroups: gmane.emacs.help Subject: Re: Operate on region string Date: Sat, 14 Oct 2006 22:23:30 +0000 (UTC) Organization: Public Access Networks Corp. Message-ID: References: <871wq9mr5h.fsf@gmail.com> <873bap1l7t.fsf@thalassa.informatimago.com> <87u035wekr.fsf@gmail.com> <87lkogz0kj.fsf@thalassa.informatimago.com> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1160865684 26598 80.91.229.2 (14 Oct 2006 22:41:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 14 Oct 2006 22:41:24 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 15 00:41:24 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 1GYsC3-0003kS-WA for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Oct 2006 00:41:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GYsC3-0004pY-Gr for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Oct 2006 18:41:23 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!panix!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Original-NNTP-Posting-Host: panix2.panix.com Original-X-Trace: reader1.panix.com 1160864610 1334 166.84.1.2 (14 Oct 2006 22:23:30 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Sat, 14 Oct 2006 22:23:30 +0000 (UTC) X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Original-Xref: shelby.stanford.edu gnu.emacs.help:142424 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:38045 Archived-At: In article <87lkogz0kj.fsf@thalassa.informatimago.com>, Pascal Bourguignon wrote: >Hadron Quark writes: >>> But if you want the best performances, emacs is optimized to work in >>> the buffers, not on strings. So if you can do it, better to directly >>> modify the buffer: >>> >>> (defun my-command (start end) >>> (interactive "r") >>> (do-work-on-region start end)) >> >> this is what I wanted to know : what is the best way to "do-work-on-region"? > >You need to learn the emacs lisp functions, notably those who work on >the buffers and on the strings. > >Most of the functions that work on the buffers are actually commands >that are also bound to some keys and that you use. > >For example, if you want to remove every other character in the region, >you can do it manually with C-f C-d C-f C-d ... > >You can know what functions are called when you type C-f or C-d: > > C-h k C-f > C-h k C-d > Easy way to do that: define the seq as a macro, then do "insert-macro" (or whatever it's called) -- that code shows the function-NAMES too. David