Subject: Re: bug#45973: replace-regexp lisp replacement bug

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 19 Jan 2021 04:44:52 +0100

Nicholas Drozd <[email-masked]> writes:

> I tried to make a Lisp test to reproduce this, but the `\,`
> replacement feature is interactive-only, and I don't know how to test
> it non-interactively.

The reproducer is:

(replace-regexp "\\(\\(L\\)\\|\\(R\\)\\)" '(replace-eval-replacement replace-quote (if (match-string 2) "R" "L")) nil nil nil nil nil)

And this leads to the following backtrace:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  make-overlay(nil nil)
  replace-highlight(2 3 nil nil "\\(\\(L\\)\\|\\(R\\)\\)" t nil nil nil)
  perform-replace("\\(\\(L\\)\\|\\(R\\)\\)" (replace-eval-replacement replace-quote (if (match-string 2) "R" "L")) nil t nil nil nil nil nil nil nil)
  replace-regexp("\\(\\(L\\)\\|\\(R\\)\\)" (replace-eval-replacement replace-quote (if (match-string 2) "R" "L")) nil nil nil nil nil)
  eval((replace-regexp "\\(\\(L\\)\\|\\(R\\)\\)" '(replace-eval-replacement replace-quote (if (match-string 2) "R" "L")) nil nil nil nil nil) t)
  eval-expression((replace-regexp "\\(\\(L\\)\\|\\(R\\)\\)" '(replace-eval-replacement replace-quote (if (match-string 2) "R" "L")) nil nil nil nil nil) nil nil 127)
  funcall-interactively(eval-expression (replace-regexp "\\(\\(L\\)\\|\\(R\\)\\)" '(replace-eval-replacement replace-quote (if (match-string 2) "R" "L")) nil nil nil nil nil) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

So this is a problem with the new code that highlights the matches, I
think?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no