From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthias Newsgroups: gmane.emacs.help Subject: Re: Writing a function for a indented copy of a region Date: Wed, 17 Dec 2008 17:26:59 +0100 Organization: Universite de Versailles Saint-Quentin-en-Yvelines Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: ger.gmane.org 1229532061 20333 80.91.229.12 (17 Dec 2008 16:41:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2008 16:41:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 17 17:42:05 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LCzT7-00031T-Mq for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 17:41:53 +0100 Original-Received: from localhost ([127.0.0.1]:42667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCzRv-0005WV-OU for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 11:40:39 -0500 Original-Newsgroups: gnu.emacs.help Original-Lines: 18 Original-NNTP-Posting-Host: fermat.math.uvsq.fr Original-X-Trace: io.uvsq.fr 1229531219 42099 193.51.32.1 (17 Dec 2008 16:26:59 GMT) Original-X-Complaints-To: Newsmaster@uvsq.fr Original-NNTP-Posting-Date: Wed, 17 Dec 2008 16:26:59 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (berkeley-unix) Cancel-Lock: sha1:wx+A/AJiGLMQkSjwvDQ97hRKpVQ= Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!feeder.erje.net!newsfeed.straub-nv.de!proxad.net!feeder1-2.proxad.net!feed.ac-versailles.fr!uvsq.fr!not-for-mail Original-Xref: news.stanford.edu gnu.emacs.help:165407 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:60738 Archived-At: Decebal writes: > What I would like this function to do is take the part that is > selected, indent this with (default) four spaces, put the > indented region in the kill-ring and undo the indent. Has anyone > a pointer about how to code this? Why don't you use a keyboard macro? First, select the text to indent and kill; Then `C-x (' to start defining a keyboard macro, `M-x replace-regexp' the beginning of line (that is "^") with four spaces, etc. Then `C-x )' to finish the macro definition. Then to call the macro you just `C-x e'. Read the manual to learn how to give it a name, save it to file, etc. -- Matthias