[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: yank-and-indent
From: |
Alan Shutko |
Subject: |
Re: yank-and-indent |
Date: |
Wed, 20 Nov 2002 21:07:59 GMT |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu) |
"Timur Aydin" <asdfweasdf@diowekfsdf.dersdre> writes:
> In programming, very often a number of lines are killed, yanked to another
> location and are reindented according to the new location.
Try this. No idea where i got it. Actually, looks like I got it
from
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=u66crixve.fsf%40sdm.de&rnum=1
;; automatically indenting yanked text if in programming-modes
(defadvice yank (after indent-region activate)
(if (member major-mode '(emacs-lisp-mode
c-mode c++-mode
tcl-mode sql-mode
perl-mode cperl-mode
java-mode jde-mode
LaTeX-mode TeX-mode))
(let ((transient-mark-mode nil))
(indent-region (region-beginning) (region-end) nil))))
--
Alan Shutko <ats@acm.org> - In a variety of flavors!
Parrot in a raincoat: polyunsaturated.