[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45607: 27.1; compiled replace-string breaks repeat-complex-command
From: |
Eli Zaretskii |
Subject: |
bug#45607: 27.1; compiled replace-string breaks repeat-complex-command |
Date: |
Tue, 09 Aug 2022 21:48:18 +0300 |
> Cc: Michael Heerdegen <michael_heerdegen@web.de>, 45607@debbugs.gnu.org,
> Allen Li <darkfeline@felesatra.moe>
> From: Juri Linkov <juri@linkov.net>
> Date: Tue, 09 Aug 2022 21:41:24 +0300
>
> > It should be added to all commands that work on the region like this,
> > yes. But I wondered whether we should make some trivial helper
> > functions first like
> >
> > (defun use-region-beginning ()
> > "Return the start of the region if `use-region-p'."
> > (and (use-region-p) (region-beginning)))
> >
> > and the same for -end to avoid having to repeat that code phrase so many
> > places.
>
> Indeed, this will help to make the history items shorter:
>
> (replace-string "a" "b" nil (if (use-region-p) (region-beginning)) (if
> (use-region-p) (region-end)))
> ->
> (replace-string "a" "b" nil (use-region-beginning) (use-region-end))
Bonus points for calling use-region-p just once, not twice.
- bug#45607: 27.1; compiled replace-string breaks repeat-complex-command, Lars Ingebrigtsen, 2022/08/08
- bug#45607: 27.1; compiled replace-string breaks repeat-complex-command, Lars Ingebrigtsen, 2022/08/09
- bug#45607: 27.1; compiled replace-string breaks repeat-complex-command, Juri Linkov, 2022/08/09
- bug#45607: 27.1; compiled replace-string breaks repeat-complex-command, Lars Ingebrigtsen, 2022/08/12
- bug#45607: 27.1; compiled replace-string breaks repeat-complex-command, Juri Linkov, 2022/08/12
- bug#45607: 27.1; compiled replace-string breaks repeat-complex-command, Lars Ingebrigtsen, 2022/08/13
- bug#45607: 27.1; compiled replace-string breaks repeat-complex-command, Juri Linkov, 2022/08/13
- bug#45607: 27.1; compiled replace-string breaks repeat-complex-command, Lars Ingebrigtsen, 2022/08/15