From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse Date: Sun, 29 May 2022 13:40:20 +0530 Message-ID: <87y1yk7o9f.fsf@gmail.com> References: <87zgj1v9xc.fsf@gmail.com> <83ilpplbhr.fsf@gnu.org> <8735gs9819.fsf@gmail.com> <837d64ltka.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20554"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 55692@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 29 10:11:32 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 1nvE1M-0005DP-56 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 May 2022 10:11:32 +0200 Original-Received: from localhost ([::1]:41698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nvE1K-0007TT-Q0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 May 2022 04:11:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvE0t-0007TF-0Z for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 04:11:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45433) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nvE0s-0006gj-O0 for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 04:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nvE0s-0007Vr-I8 for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 04:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 May 2022 08:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55692 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 55692-submit@debbugs.gnu.org id=B55692.165381183528847 (code B ref 55692); Sun, 29 May 2022 08:11:02 +0000 Original-Received: (at 55692) by debbugs.gnu.org; 29 May 2022 08:10:35 +0000 Original-Received: from localhost ([127.0.0.1]:39330 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvE0R-0007VA-8h for submit@debbugs.gnu.org; Sun, 29 May 2022 04:10:35 -0400 Original-Received: from mail-pf1-f196.google.com ([209.85.210.196]:41614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvE0N-0007Uw-64 for 55692@debbugs.gnu.org; Sun, 29 May 2022 04:10:33 -0400 Original-Received: by mail-pf1-f196.google.com with SMTP id p8so7985267pfh.8 for <55692@debbugs.gnu.org>; Sun, 29 May 2022 01:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=zCRFPqd3Upa6ahBwCs+gn2JaktScz4lpFeqvbl5B35k=; b=WCJTMb/pq5rS0/TB74giKU/rJoCdXL4hp+k9l8oBJQkG9c13oLsl8l2c3XoQqw+Zyu 6uJ3037bYdQP4kHr+qrWv+zz5kvKOhZVMq5PDN0t0ufSrrHQHQzxT2btgTwJgPD/jDxH hZCnkd6Md8JMW8P2n1HWAgNRWoK759F0TrrwLfjWovl50bTHB6ep2N1Ca84lTMDeQUeM 0f/U8e81ezC+aCmx8JFzGJjtPzWsnhn72GZX6Wsy01i71VBhd1mZ3svDhakUe1G++6Kl FTFA1tazAUd55PPZY7xskunb9kfW0MsBMQPSmRuBVz286Ny5CSrn04oi0H4pdkVQ1AxE bsWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=zCRFPqd3Upa6ahBwCs+gn2JaktScz4lpFeqvbl5B35k=; b=q/EVVPbgNt1qcrym7HtFgXDP6OOJvHelwVQpn/LHkn/7eF/k+/26MerNnIiFYxkig8 qaWoSjUy4ZWKsh807082p69LsfyuxpCZMbh9J077+fIzTRnWYUncIH0RV9TN3ZgnB3Nl QjEvfbLBZOauiCahefAMmSr/u1eBknicu/CLgKXn/JFKIqrz1Nswuhy8QpveFgJcEiVh AQYQKGHB0RgZ9x1UAxwIWVvPOA2u7Nr6yUDgYLi92KchbmoB8uo/AKoy1nZFqbMj91HU eg0nYIG5YYOoopQOy0mRVlTsYogtv+noeJtUOvWNmXoDTWFZqfyns59y33+ztFAsuHZ8 CSuQ== X-Gm-Message-State: AOAM53315v6N3fnVrQFyevyNdoBRMUXU6Smi36mlSOZMQtPn6A46LO+8 a442Fhr0VnpFfqrReUL3I82Y0xQAJlo= X-Google-Smtp-Source: ABdhPJwPCWW+pDiW2cr/ob7honp7LQeWJr7usLEJHBNpzSP8kLmkifGYluKuv+/lMaUCCniaMBIo3A== X-Received: by 2002:a65:6c08:0:b0:3f2:6a6a:98d with SMTP id y8-20020a656c08000000b003f26a6a098dmr43487782pgu.30.1653811825105; Sun, 29 May 2022 01:10:25 -0700 (PDT) Original-Received: from localhost ([49.205.87.32]) by smtp.gmail.com with ESMTPSA id y13-20020aa79e0d000000b0050dc76281c9sm6512607pfq.163.2022.05.29.01.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 May 2022 01:10:24 -0700 (PDT) In-Reply-To: <837d64ltka.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 29 May 2022 09:52:05 +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:233293 Archived-At: [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=AE=E0=AF=87 = 29, 2022] Eli Zaretskii wrote: >> From: Visuwesh >> Cc: 55692@debbugs.gnu.org >> Date: Sun, 29 May 2022 11:47:32 +0530 >>=20 >> [=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=AE=E0=AF=87 28, 2022] Eli Zaretskii = wrote: >>=20 >> > IMO, we shouldn't distinguish between the mouse and shift-selection >> > methods of defining the region. So this feature, if accepted, should >> > also treat both methods of defining the region the same. >>=20 >> Considering shift-selection would be convenient as well. Please check >> attached patch. > > Thanks. > >> +@vindex delete-selection-temporary-regions-only > > I'd drop the "-only" part: it is not necessary, and makes the variable > name longer. > Okay, will do. >> By default, text insertion occurs normally even if the mark is >> active---for example, typing @kbd{a} inserts the character @samp{a}, >> then deactivates the mark. Delete Selection mode, a minor mode, >> modifies this behavior: if you enable that mode, then inserting text >> while the mark is active causes the text in the region to be deleted >> -first. To toggle Delete Selection mode on or off, type @kbd{M-x >> -delete-selection-mode}. >> +first. If you want to replace only temporary regions, set by >> +mouse-dragging or shift-selection, then change the variable > > There should be cross-references here to where these methods are > described in the manual. > These methods as in "mouse-dragging" or "shift-selection". I'm afraid I don't fully understand what you mean. >> @@ -251,6 +259,10 @@ delete-selection-pre-hook >> have this property won't delete the selection. >> See `delete-selection-helper'." >> (when (and delete-selection-mode (use-region-p) >> + (if delete-selection-temporary-regions-only >> + (and (consp transient-mark-mode) >> + (eq (car transient-mark-mode) 'only)) >> + t) > > I wonder whether we should also optionally allow replacing text in > regions activated by "C-u C-x C-x" when transient-mark-mode is off. > Those cause transient-mark-mode to have the value 'lambda', not > '(only...)'. So maybe the new defcustom should be a tristate, not a > boolean? > Sure, that could be useful. But I have transient-mark-mode turned on always so I can't comment much on it. However, what would the third state be? When the defcustom is t, we could have it check for '(only . ...)' and the value 'lambda', no? > Also, can we have the above condition in a more elegant form? In > general, whenever you have something like > > (if SOMETHING foo t) > > it begs to be rewritten so the "t" part is not needed, because 'if' > itself already returns a boolean value. Sure. I will factor out the condition into a separate function. Is that more elegant? I will send an updated patch a bit later. Thanks.