From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: C K Kashyap Newsgroups: gmane.emacs.help Subject: Re: putting double quotes efficiently Date: Mon, 3 Jun 2013 13:33:46 +0530 Message-ID: References: <51AC4543.1000508@easy-emacs.de> <51AC4C03.7050504@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1370246644 23177 80.91.229.3 (3 Jun 2013 08:04:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Jun 2013 08:04:04 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: =?ISO-8859-1?Q?Andreas_R=F6hler?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 03 10:04:04 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 1UjPkG-0005zi-S8 for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jun 2013 10:04:00 +0200 Original-Received: from localhost ([::1]:54824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjPkG-0000l4-4E for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jun 2013 04:04:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjPk4-0000ky-P0 for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 04:03:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjPk3-0006HB-9d for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 04:03:48 -0400 Original-Received: from mail-pd0-f169.google.com ([209.85.192.169]:33811) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjPk3-0006H5-2a for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 04:03:47 -0400 Original-Received: by mail-pd0-f169.google.com with SMTP id y11so5316655pdj.28 for ; Mon, 03 Jun 2013 01:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=oG4GM9Qq4z01tlhCaOTj1d+Q1LwaIVzAB3Ef/DdEqsY=; b=lxqlvO1YcLHLTMby+NWghfxoz2FkWi3N7KemTwuO+DU9sNxuAsAdYCS+FVGp1fqYvi dnV66zTAmuoVviUvw7lJ82/ppK/P51FSzMq9vrvUV0yqJ4sspoM3RVhhQUPL7hP0di9+ IXIq3ILGkeoblj0QijZ04Lr47TL0167P9rQPWEh14Rcni3d1quGrHsFkHYv6BgIZ+xS8 2OtLcGCl+Jh+yK8K5nF/u54VitNMkYucVeECqN0r7llD5ZIcNSpdhUQnGY7nxYgcgUn6 ecspIZeqy6NjFriC9FHfxMLEiPc7SoLY86DgQqKMX83evcYipGXjwrjsvsrgHHeKhI/K N5IQ== X-Received: by 10.68.2.196 with SMTP id 4mr22691135pbw.156.1370246626291; Mon, 03 Jun 2013 01:03:46 -0700 (PDT) Original-Received: by 10.70.32.162 with HTTP; Mon, 3 Jun 2013 01:03:46 -0700 (PDT) In-Reply-To: <51AC4C03.7050504@easy-emacs.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.169 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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:91252 Archived-At: Thanks Andreas, This works. Although I'd still like to know how to write custom function that work over a marked region. Regards, Kashyap On Mon, Jun 3, 2013 at 1:25 PM, Andreas R=F6hler < andreas.roehler@easy-emacs.de> wrote: > Am 03.06.2013 09:26, schrieb Andreas R=F6hler: > > 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 us= e >>> the line range in the mark set mode in user defined function? >>> >>> Regards, >>> Kashyap >>> >>> >> M-x query-replace-regexp >> >> ^\([^ ]+\) \(.+\) >> RET >> \1 "\2; >> RET >> >> >> > resp. with missing " in replace expression > > \1 "\2"; > >