GNU bug report logs - #45607
27.1; compiled replace-string breaks repeat-complex-command

Previous Next

Package: emacs;

Reported by: Allen Li <darkfeline <at> felesatra.moe>

Date: Sat, 2 Jan 2021 09:08:02 UTC

Severity: normal

Tags: moreinfo

Found in version 27.1

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #72 received at 45607 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: michael_heerdegen <at> web.de, larsi <at> gnus.org, 45607 <at> debbugs.gnu.org,
 darkfeline <at> felesatra.moe
Subject: Re: 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 <at> web.de>, 45607 <at> debbugs.gnu.org,
>  Allen Li <darkfeline <at> felesatra.moe>
> From: Juri Linkov <juri <at> 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.




This bug report was last modified 2 years and 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.