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

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

Re: narrow-to-region for a rectangle


From: C K Kashyap
Subject: Re: narrow-to-region for a rectangle
Date: Tue, 4 Jun 2013 18:23:33 +0530

The function below takes in a region and surrounds each line with input
strings -

(defun k-quotes (beg end st en)
  (interactive "r*\nsStart Pattern: \nsEnd Pattern: \n")
  (save-excursion
    (save-restriction
      (narrow-to-region beg end)
      (goto-char beg)
      (replace-regexp "\\(.*\\)" (concat st "\\1" en))
      )))

I'd like this function to be able to restrict to a rectangle instead of a
region. While on the first line it restricts "^" to match whereever I
started the mark from - on the rest of the lines, its the beginning of the
line.

Regards,
Kashyap

On Tue, Jun 4, 2013 at 6:10 PM, Jambunathan K <kjambunathan@gmail.com>wrote:

> C K Kashyap <ckkashyap@gmail.com> writes:
>
> > Hi,
> > Is there a function that restricts the modifiable area to the rectangle
> > rather than  the region?
>
> If such a thing is available, what will you do with it?  Give an
> example.
>
> > Regards,
> > Kashyap
>


reply via email to

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