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

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

Re: Adding String to Beginning of Lines


From: Christopher Dimech
Subject: Re: Adding String to Beginning of Lines
Date: Tue, 10 Nov 2020 14:40:08 +0100

I now have got 'rec-cont', which lets me pass a string.
How can I add a dafault  if I don't pass a regex in the
mini-buffer.

(defun rec-cont (beg end regex)
  (interactive "r\ns rec-cont regex: ")
  (replace-regexp "^" regex nil beg end))
  ;; (replace-regexp "^" ";; + " nil beg end))


> Sent: Tuesday, November 10, 2020 at 1:16 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Adding String to Beginning of Lines
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > Have used the following
> >
> > (defun compfx ()
> >   (interactive "r")
> >   (query-replace-regexp "^" ";; + "))
>
> (defun compfx (beg end)
>   (interactive "r")
>   (query-replace-regexp "^" ";; + " nil beg end))
>
> Do you want to be asked interactively whether to replace each "match"?
> If not, we want to use something non-interactive instead of
> `query-replace-regexp'.
>
>
> Michael.
>
>
>



reply via email to

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