[Top][All Lists]

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

Re: query-replace-regexp: Can't use \0 in TO-STRING

From: Tino Calancha
Subject: Re: query-replace-regexp: Can't use \0 in TO-STRING
Date: Sat, 6 May 2017 21:39:25 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)

On Sat, 6 May 2017, zhanghj wrote:

Tino Calancha <address@hidden> writes:

The docstring for `query-replace-regexp' was updated in commit 38f4b8ea615
to fix Bug#23884.
Apparently, \0 has never referred to the whole match in this command
(\& it does), so we might want to skip \0 from this docstring and the

Why not \0? I think \0 is more intuitive and also used in vim.
I agree is more intuitive, and it works in `replace-match', or instance:
 (lambda (group)
   (let ((str "foo123"))
     (when (string-match "[a-z]+\\([1-9]+\\)" str)
       (replace-match "bar" nil nil str group))))
 (list 0 1))
=> ("bar" "foobar")

Are you willing to write a patch to implement it?

reply via email to

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