[Top][All Lists]

[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

;; 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 <> - In a variety of flavors!
Parrot in a raincoat: polyunsaturated.

reply via email to

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