From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Arnaldo Mandel Newsgroups: gmane.emacs.help Subject: Re: yank-and-indent Date: Wed, 20 Nov 2002 19:43:57 -0200 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <15836.541.18822.678125@gargle.gargle.HOWL> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1037828840 3926 80.91.224.249 (20 Nov 2002 21:47:20 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 20 Nov 2002 21:47:20 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18Ecgo-000115-00 for ; Wed, 20 Nov 2002 22:47:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18Ecf1-0000Sg-00; Wed, 20 Nov 2002 16:45:27 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18Ecdk-0007Ew-00 for help-gnu-emacs@gnu.org; Wed, 20 Nov 2002 16:44:08 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18Ecdd-00071J-00 for help-gnu-emacs@gnu.org; Wed, 20 Nov 2002 16:44:06 -0500 Original-Received: from bidu.ime.usp.br ([143.107.45.12]) by monty-python.gnu.org with smtp (Exim 4.10) id 18Ecdc-0006z0-00 for help-gnu-emacs@gnu.org; Wed, 20 Nov 2002 16:44:00 -0500 Original-Received: (qmail 23424 invoked from network); 20 Nov 2002 21:43:58 -0000 Original-Received: from benavuya.ime.usp.br (143.107.45.38) by bidu.ime.usp.br with SMTP; 20 Nov 2002 21:43:58 -0000 Original-Received: (qmail 19814 invoked by uid 201); 20 Nov 2002 21:43:57 -0000 Original-To: help-gnu-emacs@gnu.org Original-Newsgroups: gnu.emacs.help In-Reply-To: X-Mailer: VM 7.03 under Emacs 21.1.9 Full-Name: Arnaldo Mandel Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3817 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3817 Michael Slass wrote (on Nov 20, 2002): > "Timur Aydin" 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." To me this seems excessive: one more function and one more binding to remember. What Timur should realize is that step (4) is superfluous - the yanked lines form the region immediately after yanking. So, ???? is simply C-y M-C-\ am -- Arnaldo Mandel Departamento de Ciência da Computação - Computer Science Department Universidade de São Paulo, Bra[sz]il am@ime.usp.br