From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Goldman Newsgroups: gmane.emacs.help Subject: Re: yank without indentation? Date: Mon, 09 Jun 2014 20:00:30 -0400 Message-ID: References: <87oay7v179.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1402358481 17617 80.91.229.3 (10 Jun 2014 00:01:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Jun 2014 00:01:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 10 02:01:14 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wu9V2-0007VV-OH for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Jun 2014 02:01:12 +0200 Original-Received: from localhost ([::1]:35656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wu9V2-0006r0-9C for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jun 2014 20:01:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wu9Uk-0006pk-7i for help-gnu-emacs@gnu.org; Mon, 09 Jun 2014 20:01:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wu9Uc-00023V-K6 for help-gnu-emacs@gnu.org; Mon, 09 Jun 2014 20:00:54 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:44790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wu9Uc-000234-Cq for help-gnu-emacs@gnu.org; Mon, 09 Jun 2014 20:00:46 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Wu9UZ-00078j-6d for help-gnu-emacs@gnu.org; Tue, 10 Jun 2014 02:00:43 +0200 Original-Received: from 75-17-109-153.lightspeed.nrwlct.sbcglobal.net ([75.17.109.153]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 10 Jun 2014 02:00:43 +0200 Original-Received: from kgoldman by 75-17-109-153.lightspeed.nrwlct.sbcglobal.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 10 Jun 2014 02:00:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 23 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 75-17-109-153.lightspeed.nrwlct.sbcglobal.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:98118 Archived-At: 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 > to properly indent it for the new contexxt