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

From: Juri Linkov <[email-masked]>
Date: Fri, 12 Aug 2022 20:39:32 +0300

>> 2392:      (if (use-region-p) (region-beginning))
>> 2393:      (if (use-region-p) (region-end))
>
> That's fewer than I'd have guessed -- but I guess that quite a few
> commands stash the logic down into the function body instead of putting
> it into the `interactive' spec.  Commands like `duplicate-dwim', for
> instance, could be pretty easily fixed in that way, for instance.

OTOH, `duplicate-dwim' is optimized to call `use-region-p' only once:

  (cond
   ((use-region-p)
    (let* ((beg (region-beginning))
           (end (region-end))