From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: putting double quotes efficiently Date: Mon, 03 Jun 2013 09:26:59 +0200 Message-ID: <51AC4543.1000508@easy-emacs.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1370244271 32409 80.91.229.3 (3 Jun 2013 07:24:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Jun 2013 07:24:31 +0000 (UTC) To: "help-gnu-emacs@gnu.org List" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 03 09:24:27 2013 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 1UjP7y-0003dj-UV for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jun 2013 09:24:27 +0200 Original-Received: from localhost ([::1]:36377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjP7y-000529-GN for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jun 2013 03:24:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjP7k-00051x-Kj for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 03:24:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjP7g-0000OY-5l for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 03:24:12 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.8]:63444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjP7f-0000OP-T0 for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 03:24:08 -0400 Original-Received: from [192.168.178.21] (brln-4db9a7f0.pool.mediaWays.net [77.185.167.240]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MHaGK-1Ug6nq2t5A-003fJM; Mon, 03 Jun 2013 09:24:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 In-Reply-To: X-Provags-ID: V02:K0:5Bz8IiSyorEGwxREm7eFcNwvWJ2KyNKaw1v17yu0bOK JWjai7UIHEn+zkK/jqML34La/frMcBhccRTUFGCnOny+AU4Ozx KawbN3q5/GL5kdBzhZoWE/H1ZMIkZzePBbdIxtsSKWFe1t8B28 3C6IJcB/jXcHKoNHe+LVuI65xiHypfxJC2SqEeyeAAE/NfDMEw Wo2udETJ09LMKlIi3WpLkKWswjyIL8OyRHOeeQyocUEocmiOy4 y71WeAruuBxa4UBFT/774A+VBnHR9WZsKBxiOKOOiN7B2KfEAJ psZS2Rc7KVhuXLakifeUHCtBZZZV74CvmaioHi/9Kql6vBEAc1 l58EOeNxUwJSn6VXIZmv4shiLnibb+h0KaVr6YzzE X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.8 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:91250 Archived-At: Am 03.06.2013 07:43, schrieb C K Kashyap: > Hi, > I am looking for a way to transform > > print line1 > print line two > print line3 > > into > > print "line1"; > print "line two"; > print "line3"; > > most efficiently. For the first quote of each line I place the cursor > before line1 and I set the mark and then move all the way down to just > before line3 and then do a C-x-r-t " > Then I do a regexp replace to change $ to "; > > I'd like to do better. While at it, can I please also know how I can use > the line range in the mark set mode in user defined function? > > Regards, > Kashyap > M-x query-replace-regexp ^\([^ ]+\) \(.+\) RET \1 "\2; RET