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

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

Re: Writing a function for a indented copy of a region


From: Matthias
Subject: Re: Writing a function for a indented copy of a region
Date: Wed, 17 Dec 2008 17:26:59 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (berkeley-unix)

Decebal <CLDWesterhof@gmail.com> 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


reply via email to

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