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#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse Date: Sun, 29 May 2022 09:52:05 +0300 Message-ID: <837d64ltka.fsf@gnu.org> References: <87zgj1v9xc.fsf@gmail.com> <83ilpplbhr.fsf@gnu.org> <8735gs9819.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28614"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55692@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 29 08:53:16 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 1nvCnc-0007KH-8W for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 May 2022 08:53:16 +0200 Original-Received: from localhost ([::1]:49710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nvCna-00065o-TM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 May 2022 02:53:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvCnO-00065d-56 for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 02:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nvCnN-00051j-RM for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 02:53:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nvCnN-0005bV-Oy for bug-gnu-emacs@gnu.org; Sun, 29 May 2022 02:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 May 2022 06:53:01 +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.165380713521476 (code B ref 55692); Sun, 29 May 2022 06:53:01 +0000 Original-Received: (at 55692) by debbugs.gnu.org; 29 May 2022 06:52:15 +0000 Original-Received: from localhost ([127.0.0.1]:39276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvCmc-0005aK-V4 for submit@debbugs.gnu.org; Sun, 29 May 2022 02:52:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvCma-0005a3-Bx for 55692@debbugs.gnu.org; Sun, 29 May 2022 02:52:13 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvCmU-0004zh-Te; Sun, 29 May 2022 02:52:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=U7xjXaVRaMuHFvUs/flZorj/OdO7AI5LIJYg6uYg7CU=; b=FpBktiKeb7YpcqsL7rYc Mva5N6sdc3Yp+hApYv6KcTjRqWqQxIPYixlHhs+zHvkqqUw0iZyJEq/Fx1c827Mh6MqJGSzc5IieG mhDNwRDGX27iZzv3aCgrAIZkevNXruTWa1Y2rgDMYozw9qTQYBIicm2U78aC2T07OWa/K03hMstJK 4wT621txMS+Nqw+TNZGv6745xD/9NpouMFiomwYtYytr4eCGaMcHnhH2Lng8WNfvxBmgMAhjqHRZY TMdzisZEgq39cfhSv2uCnXmZHltGOGvRZXCQS6sluHHmW4zpqsLGaWJ40uTeCaBCJfclU5ODQKjFq EPcdhZbVbNNm8Q==; Original-Received: from [87.69.77.57] (port=2315 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 1nvCmU-0003h5-BV; Sun, 29 May 2022 02:52:06 -0400 In-Reply-To: <8735gs9819.fsf@gmail.com> (message from Visuwesh on Sun, 29 May 2022 11:47:32 +0530) 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:233290 Archived-At: > From: Visuwesh > Cc: 55692@debbugs.gnu.org > Date: Sun, 29 May 2022 11:47:32 +0530 > > [சனி மே 28, 2022] Eli Zaretskii wrote: > > > 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. > > 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. > 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. > @@ -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? 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.