Subject: bug#45607: 27.1; compiled replace-string breaks repeat-complex-command

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 06 Jul 2022 13:35:28 +0200

Juri Linkov <[email-masked]> writes:

>>> (defun replace-string (from-string to-string &optional delimited start end backward region-noncontiguous-p)
>>> ...
>>>   (declare (arg start (if (use-region-p) (region-beginning)))
>>>            (arg end (if (use-region-p) (region-end))))

[...]

> Indeed, some users might want to have numbers for START and END values
> to repeat the command exactly on the same previous region, but other users
> might want to repeat the command on a newly selected region with
> (region-beginning)/(region-end) in the command history.

Have a look at fix_command -- it tries to parse code in an interactive
spec to find instances of

  preserved_fns = pure_list (intern_c_string ("region-beginning"),
			     intern_c_string ("region-end"),
			     intern_c_string ("point"),
			     intern_c_string ("mark"));

in the code.  (Which doesn't work now, of course, since the spec is
byte-compiled.)  My `declare' suggestion would just make this work
again, and fix a regression.  That is, this isn't new functionality.

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