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

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

Re: replace-regexp


From: Emanuel Berg
Subject: Re: replace-regexp
Date: Sat, 08 May 2021 20:46:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier via Users list for the GNU Emacs text editor wrote:

> There are indeed 2 "standard" solutions:
> 1- start your loop at the end, moving towards the beginning.

You mean like this? Also works. Maybe better than the
`copy-marker' stuff?

(defun md-latex-back (beg end)
  (interactive "r")
  (save-excursion
    (goto-char end)
    (while (re-search-backward "_\\(.*\\)_" beg t)
      (replace-match "\\\\textit{\\1}") )))

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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