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

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

Re: Character first of all lines


From: Piet van Oostrum
Subject: Re: Character first of all lines
Date: 11 Jul 2003 11:29:05 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> Luiz Siqueira Neto <cybersamurai@mac.com> (LSN) wrote:

LSN> How I can put some character first of all lines inside of a region?
LSN> ---
LSN> like this:

LSN> x = 1
LSN> print x

LSN> go to

LSN> # x = 1
LSN> # print x
LSN> ---

I use a command for this: quote-region:


(defun quote-region (start end string)
  "Quote the region with the given STRING.
Called from a program, takes three args: START, END, and STRING."
  (interactive "r\nsQuote region with string: ")
  (save-excursion
    (goto-char end)
    (setq end (point-marker))
    (goto-char start)
    (or (bolp) (forward-line 1))
    (while (< (point) end)
      (insert string)
      (forward-line 1))
    (move-marker end nil)))

-- 
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum@hccnet.nl


reply via email to

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