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: Wed, 11 Nov 2020 14:22:44 +0100

> Sent: Wednesday, November 11, 2020 at 12:16 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Adding String to Beginning of Lines
>
> <tomas@tuxteam.de> writes:
>
> > But watch out: the replacement string (confusingly called `regex' here,
> > others have already pointed that out) might contain special sequences
> > (e.g. "\\&") which have a meaning in this context.
>
> Indeed, an important objection.
>
> I would suggest to avoid using any query-replace at all and rather use
> something like
>
> #+begin_src emacs-lisp
> (save-excursion
>   (while (and (<= (point) end)
>               (not (eobp)))
>     (insert my-string)
>     (forward-line +1))
>   (deactivate-mark))
> #+end_src

That's what I started doing at the beginning.  Should we revert to this
or continue with replace-regexp.  Have now removed the confusingly called
`regex' and it is currently called nwltok.

> > Cheers
>
> Ebenso!
>
>
> Regards,
>
> Michael.
>
>
>



reply via email to

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