[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replace-regexp
From: |
Emanuel Berg |
Subject: |
Re: replace-regexp |
Date: |
Sun, 09 May 2021 04:48:19 +0200 |
> Again, I don't think the user, not even the Lisp user,
> should do this thing. I'll see if I can show you what
> I mean, later.
Here, what is wrong with this?
(defun replace-regexp-1 (regexp to-string &optional beg end)
(interactive
`(,(read-from-minibuffer "regexp: ")
,(read-from-minibuffer "to string: ")
,@(if (use-region-p)
(list (region-beginning) (region-end))
(list (point-min) (point-max))) ))
(let ((beg-set (or beg (point-min)))
(end-set (or end (point-max))) )
(save-excursion
(goto-char end-set)
(while (re-search-backward regexp beg-set t)
(replace-match to-string) ))))
Works interactively and non-interactively using the same good
function... or?
--
underground experts united
https://dataswamp.org/~incal
- Re: replace-regexp, (continued)
- Re: replace-regexp, Emanuel Berg, 2021/05/07
- Re: replace-regexp, Emanuel Berg, 2021/05/07
- Re: replace-regexp, Yuri Khan, 2021/05/08
- Re: replace-regexp, Stefan Monnier, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Stefan Monnier, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Tassilo Horn, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- RE: [External] : Re: replace-regexp, Drew Adams, 2021/05/08
- Re: replace-regexp,
Emanuel Berg <=
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Stefan Monnier, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Stefan Monnier, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Stefan Monnier, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/09
- avoid narrow-to-region (was: Re: replace-regexp), Emanuel Berg, 2021/05/08
- Re: avoid narrow-to-region (was: Re: replace-regexp), Yuri Khan, 2021/05/09