[Top][All Lists]

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

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

From: Decebal
Subject: Re: Writing a function for a indented copy of a region
Date: Wed, 17 Dec 2008 09:09:45 -0800 (PST)
User-agent: G2/1.0

On 17 dec, 16:59, "Drew Adams" <address@hidden> wrote:
> > A lot of times I need to copy a part of a (log) file for an e-mail. I
> > like to indent this (default with four spaces). At this moment I do
> > this by hand. But I would like to do this with a function.
> > 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?
> `C-x TAB' is `indent-rigidly'
> `M-w' copies the region to the `kill-ring'

But the first statement unselects the region, that is why I want to
write an elisp function to call after I selected the region. Is it
possible to see if there is a region selected in an elisp function?
What I was thinking about was to put the start and the end of the
region in registers and use those registers in the function to mark
the region again after I indented to put the indented text into the
kill-ring. After that I should do an undo. And then the file is not
changed, but I have the indented region in the kill-ring.

reply via email to

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