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

From: Michael Heerdegen <[email-masked]>
Date: Tue, 05 Jul 2022 16:41:23 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> I.e.,
>
> (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))))
>
> and fix_command would pick them up from the symbol plist and use those
> forms instead of the value for these arguments.

If we do that, it would be impossible to explicitly specify START and
END values that are different from an active region from ELisp code. If
the region is active, those arguments would always just be ignored.

We would substitute one ugly corner case with another one, but would
have added more semantic complexity.

We only have a problem for `repeat-complex-command' usage, right?  Then
the effect of a new `declare' spec should better be limited to the value
added to `command-history'.

Michael.