help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: putting double quotes efficiently


From: C K Kashyap
Subject: Re: putting double quotes efficiently
Date: Mon, 3 Jun 2013 17:22:54 +0530

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öhler <
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
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]