From: Michael Slass <miknrene@drizzle.com>
Subject: Re: yank-and-indent
Date: Wed, 20 Nov 2002 21:01:57 GMT [thread overview]
Message-ID: <m3n0o4c5k7.fsf@localhost.localdomain> (raw)
In-Reply-To: O4SdnWlgF5V3ckagXTWcpA@giganews.com
"Timur Aydin" <asdfweasdf@diowekfsdf.dersdre> writes:
>Hi,
>
>In programming, very often a number of lines are killed, yanked to another
>location and are reindented according to the new location. Currently, the
>following sequence has to be done manually:
>
>1) Mark the lines to be killed
>2) Kill the lines
>3) Yank into new location
>4) Mark the same lines again.
>5) Hit C-M-\ to indent the lines according to new location.
>
>I would like to reduce the procedure to:
>
>1) Mark the lines to be killed
>2) Kill the lines
>3) Hit ???? to yank and indent the lines.
>
>Any wisdom on how this can be accomplished? I am a beginner in lisp, so
>hopefully there is a way that doesn't require writing a lisp function...
>
>--
>Timur
>
>
Try this:
(defun yank-and-indent ()
"Yank and indent yanked material according to mode."
(interactive)
(save-restriction
(narrow-to-region (point) (point))
(yank)
(let ((beg (point-min))
(end (point-max)))
(widen)
(indent-region beg end nil))))
--
Mike Slass
next prev parent reply other threads:[~2002-11-20 21:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-20 20:28 yank-and-indent Timur Aydin
2002-11-20 21:01 ` Michael Slass [this message]
2002-11-20 21:43 ` yank-and-indent Arnaldo Mandel
2002-11-20 21:07 ` yank-and-indent Alan Shutko
2002-11-20 21:29 ` yank-and-indent Michael Slass
2002-11-20 21:39 ` yank-and-indent Timur Aydin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3n0o4c5k7.fsf@localhost.localdomain \
--to=miknrene@drizzle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.