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

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

Re: yank without indentation?


From: Ken Goldman
Subject: Re: yank without indentation?
Date: Mon, 09 Jun 2014 20:00:30 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

How about an automated version?  I've been using this:

; 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))
      (indent-region (region-beginning) (region-end) nil)))


On 6/5/2014 3:25 PM, Jacob Gerlach wrote:
I run in to this problem sometimes when yanking a piece of code with
certain indentation into a new place where it should have different (more
or less) indentation. My solution is:

C-y
C-x C-x (exchange-point-and-mark) to re-highlight the yanked text
<TAB> to properly indent it for the new contexxt





reply via email to

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