From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#45607: 27.1; compiled replace-string breaks repeat-complex-command Date: Tue, 09 Aug 2022 21:48:18 +0300 Message-ID: <83wnbhs171.fsf@gnu.org> References: <80o8i7676p.fsf@felesatra.moe> <87czfkir6n.fsf@gnus.org> <86r1402un1.fsf@mail.linkov.net> <87y1y79x82.fsf@gnus.org> <87v8t9y8hi.fsf@gnus.org> <87r13xy8c3.fsf@gnus.org> <871quzaagc.fsf@web.de> <861quywusu.fsf@mail.linkov.net> <8735felbi7.fsf@gnus.org> <864jzursq8.fsf@mail.linkov.net> <87zghlgxk4.fsf@gnus.org> <87bksuzvs5.fsf@gnus.org> <86iln264vg.fsf@mail.linkov.net> <871qtpzck5.fsf@gnus.org> <868rnxqmy3.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19444"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael_heerdegen@web.de, larsi@gnus.org, 45607@debbugs.gnu.org, darkfeline@felesatra.moe To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 09 20:51:22 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLUK2-0004rM-1i for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Aug 2022 20:51:22 +0200 Original-Received: from localhost ([::1]:48754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLUK0-00087m-8F for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Aug 2022 14:51:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLUHm-0007Qb-Ss for bug-gnu-emacs@gnu.org; Tue, 09 Aug 2022 14:49:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55245) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oLUHm-0001Tq-Jq for bug-gnu-emacs@gnu.org; Tue, 09 Aug 2022 14:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oLUHm-0003O0-Fk for bug-gnu-emacs@gnu.org; Tue, 09 Aug 2022 14:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Aug 2022 18:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45607 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 45607-submit@debbugs.gnu.org id=B45607.166007091912987 (code B ref 45607); Tue, 09 Aug 2022 18:49:02 +0000 Original-Received: (at 45607) by debbugs.gnu.org; 9 Aug 2022 18:48:39 +0000 Original-Received: from localhost ([127.0.0.1]:44994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLUHP-0003NO-9Y for submit@debbugs.gnu.org; Tue, 09 Aug 2022 14:48:39 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLUHL-0003NA-Kr for 45607@debbugs.gnu.org; Tue, 09 Aug 2022 14:48:37 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLUHF-0001R5-Nz; Tue, 09 Aug 2022 14:48:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6qQNu/0txv7opYVcgoDNTvJuos41FGfQSJ6qc5aNt7k=; b=GWaMONlo2uXw 2XN8wD+z41xN8JdDZRc+8KY1mtGDiXeZlAanY+ZKDh1VfYghLB2QKfKqPdbKk0e5OFP6PXL+vYEIr 0wQY/vZohQPP9ASOOnFxYDUrRDAVQYnlFqeh6JPM9VFQlMElD8tbzxwMgr316SzpMS0uVQcQXJaSn Rf+MmP7T+armyIaOpnDSlqlujF6zFi6kgs3oLHYAtcYoBMN6pCLZ3nJ4Vm7AGR/FpkjX5bxH0fhd5 SiUTZG59Ngf2X27NJyERUF4ruoawG+hW13sOYTh8zhSSaPPee753uc8fAitLk7hAxTjsn2Hh8AEo9 h/4ZfebkOEKv8Sr6qx417g==; Original-Received: from [87.69.77.57] (port=1659 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLUHF-0006SG-7i; Tue, 09 Aug 2022 14:48:29 -0400 In-Reply-To: <868rnxqmy3.fsf@mail.linkov.net> (message from Juri Linkov on Tue, 09 Aug 2022 21:41:24 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:239205 Archived-At: > Cc: Michael Heerdegen , 45607@debbugs.gnu.org, > Allen Li > From: Juri Linkov > 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.