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 17:22:54 +0530 Message-ID: References: <51AC4543.1000508@easy-emacs.de> <51AC4C03.7050504@easy-emacs.de> <51AC5D6C.2080505@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 1370260392 11184 80.91.229.3 (3 Jun 2013 11:53:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Jun 2013 11:53:12 +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 13:53:13 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 1UjTK4-0005Qz-8O for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jun 2013 13:53:12 +0200 Original-Received: from localhost ([::1]:57575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjTK3-0005IQ-Ll for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jun 2013 07:53:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjTJs-0005IK-Qn for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 07:53:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjTJo-0004z8-3N for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 07:53:00 -0400 Original-Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]:33820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjTJn-0004yq-Sv for help-gnu-emacs@gnu.org; Mon, 03 Jun 2013 07:52:56 -0400 Original-Received: by mail-pa0-f42.google.com with SMTP id bj1so855969pad.1 for ; Mon, 03 Jun 2013 04:52:54 -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=M+0FXkvx2grDEIQoDffoiBLT3tDswFYiEKqW3w0X2Uo=; b=skJtkfPuYIhl7Ac/L3nhDYhpHujfku+yenPQM6xWR7iZOpzVwYbwH9lvBTn2Zrstzc IlxLVNXiADU+8yvG84jweAun1i9rZPTyDXPlqvjQj1yr6RZNwiN9aR1/xn5eYG9G6E6o cCSskY73f3pAlx6frrwwEq+uXcMDk8odBT8N2/ZuamjJXecpqvhMX40uAGG+J4mLobvK xjqFWhTtdotLFHPCmbg3nUMDEvt4EvR+N4jzekU8vuopCGUJE7foXGNmh+oDTUjxhYrt FowH5YQCXRLrhuYICD8zsEfEhRd+H2Qas++09U7fMms8tA21s0XJACtDTdIq1U+9R1cO 7DFg== X-Received: by 10.66.150.226 with SMTP id ul2mr24091270pab.17.1370260374885; Mon, 03 Jun 2013 04:52:54 -0700 (PDT) Original-Received: by 10.70.32.162 with HTTP; Mon, 3 Jun 2013 04:52:54 -0700 (PDT) In-Reply-To: <51AC5D6C.2080505@easy-emacs.de> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22a 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:91255 Archived-At: Thanks Andreas, This is exactly what I was looking for - (defun kash-util-quotes (beg end st en) (interactive "r*\nsStart Pattern: \nsEnd Pattern: \n") (save-excursion (save-restriction (string-rectangle beg end st) ; (narrow-to-region beg end) (goto-char beg) (replace-regexp "$" en) ))) Thanks, Kashyap On Mon, Jun 3, 2013 at 2:40 PM, Andreas R=F6hler < andreas.roehler@easy-emacs.de> wrote: > Am 03.06.2013 10:03, schrieb C K Kashyap: > > Thanks Andreas, >> This works. >> Although I'd still like to know how to write custom function that work >> over >> a marked region. >> > > For example that way: > > (defun my-New-Command (beg end) > (interactive "r*") > (save-excursion > (save-restriction > (narrow-to-region beg end) > (goto-char beg) > (DO-What-I-Want... > > Recommend a walk through Info section Elisp, you will find plenty of > useful stuff. > > Cheers, > > Andreas >