From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 17 17:01:01 2017 Received: (at submit) by debbugs.gnu.org; 17 Nov 2017 22:01:01 +0000 Received: from localhost ([127.0.0.1]:45405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFoh2-0004Sp-V7 for submit@debbugs.gnu.org; Fri, 17 Nov 2017 17:01:01 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41537) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFoh1-0004Sd-3n for submit@debbugs.gnu.org; Fri, 17 Nov 2017 17:00:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFogu-0005lK-PA for submit@debbugs.gnu.org; Fri, 17 Nov 2017 17:00:53 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFogu-0005l1-M7 for submit@debbugs.gnu.org; Fri, 17 Nov 2017 17:00:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFogt-0006Vv-IN for bug-gnu-emacs@gnu.org; Fri, 17 Nov 2017 17:00:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFogn-0005db-AF for bug-gnu-emacs@gnu.org; Fri, 17 Nov 2017 17:00:51 -0500 Received: from mout02.posteo.de ([185.67.36.66]:37873) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFogn-0005R1-3w for bug-gnu-emacs@gnu.org; Fri, 17 Nov 2017 17:00:45 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 9811520961 for ; Fri, 17 Nov 2017 23:00:33 +0100 (CET) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3ydsVm5mqCz101B for ; Fri, 17 Nov 2017 23:00:30 +0100 (CET) From: Tomas Nordin To: bug-gnu-emacs@gnu.org Subject: dwim transpose-subr opportunity? Date: Fri, 17 Nov 2017 23:00:29 +0100 Message-ID: <87a7zkwooy.fsf@fliptop> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hello List Not a bug report but maybe a feature request. I was wondering if there is an opportunity for a dwim feature of the transpose- set of functions by something like the following: 1 file changed, 1 insertion(+), 1 deletion(-) lisp/simple.el | 2 +- modified lisp/simple.el @@ -6967,7 +6967,7 @@ transpose-subr (progn (funcall mover (- x)) (point)))))) pos1 pos2) (cond - ((= arg 0) + ((or (= arg 0) (use-region-p)) (save-excursion (setq pos1 (funcall aux 1)) (goto-char (or (mark) (error "No mark set in this buffer"))) The intention is that a 0 number prefix argument is not necessary if there is a region so that use-region-p is non-nil. I have tried it in some various ways and to me it seem to work, but I don't know all the delicate ways in which those commands might be used. What do you think? It gets a bit silly as suggested though, I guess the logic should be something like (or (= arg 0) (and transpose-dwim (use-region-p))) Best regards -- Tomas From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 18 02:48:35 2017 Received: (at 29346) by debbugs.gnu.org; 18 Nov 2017 07:48:35 +0000 Received: from localhost ([127.0.0.1]:45520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFxrf-0004uE-6G for submit@debbugs.gnu.org; Sat, 18 Nov 2017 02:48:35 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFxrd-0004u1-5k for 29346@debbugs.gnu.org; Sat, 18 Nov 2017 02:48:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFxrU-0001Fk-Nr for 29346@debbugs.gnu.org; Sat, 18 Nov 2017 02:48:27 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFxrU-0001Fg-Jk; Sat, 18 Nov 2017 02:48:24 -0500 Received: from [176.228.60.248] (port=4136 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eFxrU-0004rF-0M; Sat, 18 Nov 2017 02:48:24 -0500 Date: Sat, 18 Nov 2017 09:48:10 +0200 Message-Id: <83bmk0gh8l.fsf@gnu.org> From: Eli Zaretskii To: Tomas Nordin In-reply-to: <87a7zkwooy.fsf@fliptop> (message from Tomas Nordin on Fri, 17 Nov 2017 23:00:29 +0100) Subject: Re: bug#29346: dwim transpose-subr opportunity? References: <87a7zkwooy.fsf@fliptop> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 29346 Cc: 29346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Tomas Nordin > Date: Fri, 17 Nov 2017 23:00:29 +0100 > > @@ -6967,7 +6967,7 @@ transpose-subr > (progn (funcall mover (- x)) (point)))))) > pos1 pos2) > (cond > - ((= arg 0) > + ((or (= arg 0) (use-region-p)) > (save-excursion > (setq pos1 (funcall aux 1)) > (goto-char (or (mark) (error "No mark set in this buffer"))) > > > The intention is that a 0 number prefix argument is not necessary if > there is a region so that use-region-p is non-nil. I have tried it in > some various ways and to me it seem to work, but I don't know all the > delicate ways in which those commands might be used. What do you think? I think this would be a source of inadvertent mistakes and annoyances. Transient Mark mode is on by default, which means M-t can frequently do something the user didn't intend it to, just because the region happened to be active. A similar situation exists with typing DEL when the region is active, but at least in that case we behave like many GUI applications out there, so we can hope the user is ready for that and expects that to happen. (I'm never ready, which is probably the reason why I turn Transient Mark mode off.) With M-t, we don't have that defense. > It gets a bit silly as suggested though, I guess the logic should be > something like (or (= arg 0) (and transpose-dwim (use-region-p))) Maybe. But I wonder why this relatively rare use case is so important as to mandate a new defcustom, whose only purpose is to save the user from typing M-0 or "C-u 0". Just because people didn't read the doc string and therefore didn't know about the special meaning of an argument of zero? But then they will not know about the proposed magic, either. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 18 08:35:33 2017 Received: (at 29346) by debbugs.gnu.org; 18 Nov 2017 13:35:33 +0000 Received: from localhost ([127.0.0.1]:45652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eG3HR-0006sX-4D for submit@debbugs.gnu.org; Sat, 18 Nov 2017 08:35:33 -0500 Received: from mout02.posteo.de ([185.67.36.66]:58933) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eG3HP-0006sJ-OW for 29346@debbugs.gnu.org; Sat, 18 Nov 2017 08:35:32 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id A8AF020991 for <29346@debbugs.gnu.org>; Sat, 18 Nov 2017 14:35:24 +0100 (CET) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3yfGFR3FFfz1011; Sat, 18 Nov 2017 14:35:23 +0100 (CET) From: Tomas Nordin To: Eli Zaretskii Subject: Re: bug#29346: dwim transpose-subr opportunity? In-Reply-To: <83bmk0gh8l.fsf@gnu.org> References: <87a7zkwooy.fsf@fliptop> <83bmk0gh8l.fsf@gnu.org> Date: Sat, 18 Nov 2017 14:35:22 +0100 Message-ID: <87375bwvz9.fsf@fliptop> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: 29346 Cc: 29346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.1 (-----) Eli Zaretskii writes: > I think this would be a source of inadvertent mistakes and > annoyances. Transient Mark mode is on by default, which means M-t can > frequently do something the user didn't intend it to, just because the > region happened to be active. A similar situation exists with typing Is an example of that the following ^Jack and Jill over ^jumped the hill. The first '^' is for the mark and next is for point, making an active region, and now I hit M-t because I wanted to swap 'over' with 'jump', but instead I swapped 'Jack' with 'jumped'. Just for my understanding. Or is there better examples? >> It gets a bit silly as suggested though, I guess the logic should be >> something like (or (= arg 0) (and transpose-dwim (use-region-p))) > > Maybe. But I wonder why this relatively rare use case is so important > as to mandate a new defcustom, whose only purpose is to save the user > from typing M-0 or "C-u 0". Just because people didn't read the doc I was mostly thinking not to disturb the long lasting default I think, or the possible annoyances as you say. From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 18 09:46:14 2017 Received: (at 29346) by debbugs.gnu.org; 18 Nov 2017 14:46:14 +0000 Received: from localhost ([127.0.0.1]:45673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eG4Nq-0008RV-5z for submit@debbugs.gnu.org; Sat, 18 Nov 2017 09:46:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eG4Nm-0008RG-Sv for 29346@debbugs.gnu.org; Sat, 18 Nov 2017 09:46:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eG4Ne-0003KI-OB for 29346@debbugs.gnu.org; Sat, 18 Nov 2017 09:46:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eG4Ne-0003KA-L9; Sat, 18 Nov 2017 09:46:02 -0500 Received: from [176.228.60.248] (port=4804 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eG4Nd-0006R3-4w; Sat, 18 Nov 2017 09:46:02 -0500 Date: Sat, 18 Nov 2017 16:45:45 +0200 Message-Id: <83k1ynfxwm.fsf@gnu.org> From: Eli Zaretskii To: Tomas Nordin In-reply-to: <87375bwvz9.fsf@fliptop> (message from Tomas Nordin on Sat, 18 Nov 2017 14:35:22 +0100) Subject: Re: bug#29346: dwim transpose-subr opportunity? References: <87a7zkwooy.fsf@fliptop> <83bmk0gh8l.fsf@gnu.org> <87375bwvz9.fsf@fliptop> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 29346 Cc: 29346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Tomas Nordin > Cc: 29346@debbugs.gnu.org > Date: Sat, 18 Nov 2017 14:35:22 +0100 > > > I think this would be a source of inadvertent mistakes and > > annoyances. Transient Mark mode is on by default, which means M-t can > > frequently do something the user didn't intend it to, just because the > > region happened to be active. A similar situation exists with typing > > Is an example of that the following > > ^Jack and Jill over ^jumped the hill. > > The first '^' is for the mark and next is for point, making an active > region, and now I hit M-t because I wanted to swap 'over' with 'jump', > but instead I swapped 'Jack' with 'jumped'. > > Just for my understanding. Or is there better examples? You understood me, that's exactly what I had in mind. > >> It gets a bit silly as suggested though, I guess the logic should be > >> something like (or (= arg 0) (and transpose-dwim (use-region-p))) > > > > Maybe. But I wonder why this relatively rare use case is so important > > as to mandate a new defcustom, whose only purpose is to save the user > > from typing M-0 or "C-u 0". Just because people didn't read the doc > > I was mostly thinking not to disturb the long lasting default I think, > or the possible annoyances as you say. Thanks for clarifying that. From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 25 06:51:33 2017 Received: (at 29346) by debbugs.gnu.org; 25 Nov 2017 11:51:33 +0000 Received: from localhost ([127.0.0.1]:56799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIYzc-0006YQ-S6 for submit@debbugs.gnu.org; Sat, 25 Nov 2017 06:51:33 -0500 Received: from mout01.posteo.de ([185.67.36.141]:39029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIYzb-0006YC-18 for 29346@debbugs.gnu.org; Sat, 25 Nov 2017 06:51:31 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id EFC6B20C5A for <29346@debbugs.gnu.org>; Sat, 25 Nov 2017 12:51:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1511610684; bh=CQks7IMIMAVdHqcD10TimMsNh0bqGvHBpZ8+8jFqBo4=; h=From:To:Subject:Date:From; b=UiB5R5a6yqkKr/bDiW8nXbEkD1DzoFtXzb4xfDnX9Lq31Ace6VCxDAECpKtPvP0WY +30/JrUYtM4+myKekiSXoyzWcm+bST0TdzGrHpF7WflBPmU0Qxw+a6FNvXoHgAz4/r X+NY4rHOTr+Cj666yZk7tZ9GglCeu+wcc/QxvUecQET9MJoNMMxr37w22ruY/rQFqt vnHNAcZ0uYrBHsfUCDKAKGCtAYeAgagHbde4RC/WOt1MhNm5Npxm22VQsvPVbQslnk 1jun4fXFRKZYYpbO1kKK60/sKrOa80wKp+LVsXa2/y8YvF4PjnEcxpP5HpUOuu1DM9 vleEAuVYF+ntg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3ykWcC2Xx0z9rxC for <29346@debbugs.gnu.org>; Sat, 25 Nov 2017 12:51:23 +0100 (CET) From: Tomas Nordin To: 29346@debbugs.gnu.org Subject: dwim transpose-subr opportunity new suggestion Date: Sat, 25 Nov 2017 12:51:22 +0100 Message-ID: <873752zidh.fsf@fliptop> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 29346 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hi Debbugs Here is an update on the request/suggestion based on a suggestion from the emacs help list, with a custom addition from myself. diff --git a/lisp/simple.el b/lisp/simple.el index 41f22b2396..7773a7d5d1 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5431,6 +5431,15 @@ save-mark-and-excursion (save-excursion ,@body) (save-mark-and-excursion--restore ,saved-marker-sym))))) +(defcustom transpose-active-region-dwim nil + "Make transpose commands act as with a zero prefix when region active. + +If non-nil, a zero prefix is not required to operate over mark +and point when the region is active. See `transpose-words' for +example, (the last sentence)." + :type 'boolean + :group 'editing-basics) + (defcustom use-empty-active-region nil "Whether \"region-aware\" commands should act on empty regions. If nil, region-aware commands treat the empty region as inactive. @@ -6967,7 +6976,8 @@ transpose-subr (progn (funcall mover (- x)) (point)))))) pos1 pos2) (cond - ((= arg 0) + ((or (= arg 0) (and (= arg 1) (use-region-p) + transpose-active-region-dwim)) (save-excursion (setq pos1 (funcall aux 1)) (goto-char (or (mark) (error "No mark set in this buffer"))) Best regards -- Tomas From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 26 08:54:31 2017 Received: (at 29346) by debbugs.gnu.org; 26 Nov 2017 13:54:31 +0000 Received: from localhost ([127.0.0.1]:58669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIxOB-00077E-6p for submit@debbugs.gnu.org; Sun, 26 Nov 2017 08:54:31 -0500 Received: from mout01.posteo.de ([185.67.36.141]:49948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIxO9-000771-D1 for 29346@debbugs.gnu.org; Sun, 26 Nov 2017 08:54:30 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 3A62720F94 for <29346@debbugs.gnu.org>; Sun, 26 Nov 2017 14:54:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1511704463; bh=UdRahLdJTV92nmBuf1eSo48wm6BnMHZ6/lKSZa7Mcac=; h=From:To:Cc:Subject:Date:From; b=QKBrlr2uQwI5TgUAHcMBFo5t7LjeHJ5sxygBGTWMkodwJrssD/PhVgbAeWs9zL3cV A25srggtOP8yWYrGbfXcxlLGvXJuaFl1Qwy8RlvD5Pzif6Dsv2uzig8+mj57faceud 1R1q6gLPMtLdiLX7HSJC4wwmrhcORHV9xXFwLhAx1V/HmUFQIvc3Hc7K7bZZyJMZvx 07ZQ6nL0vmfFhvqCqLG76/iS0CUjy9yacNjoHHynPBRnAES94geEsVcfERUUJGudZa FSNbyj4fM1rTajWa+WH3asp21NjgT7MR9FOTx7rqvtFlHJkrcC2UgYqxJNJZH4DlZQ Cj/XMW20WqlnQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3ylBHd4yvcz9rxG; Sun, 26 Nov 2017 14:54:20 +0100 (CET) From: Tomas Nordin To: Eli Zaretskii Subject: Re: bug#29346: dwim transpose-subr opportunity? In-Reply-To: <83k1ynfxwm.fsf@gnu.org> References: <87a7zkwooy.fsf@fliptop> <83bmk0gh8l.fsf@gnu.org> <87375bwvz9.fsf@fliptop> <83k1ynfxwm.fsf@gnu.org> Date: Sun, 26 Nov 2017 14:54:20 +0100 Message-ID: <87d145w3g3.fsf@fliptop> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 29346 Cc: 29346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hello Debbugs Sorry if this gets double posted, I sent it first directly to 29346@debbugs.gnu.org without hooking onto this thread and I couldn't see any signs of it coming through somewhere. Anyways, here is an update on the request/suggestion based on a suggestion from the Emacs help list, with a custom addition from myself. diff --git a/lisp/simple.el b/lisp/simple.el index 41f22b2396..7773a7d5d1 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5431,6 +5431,15 @@ save-mark-and-excursion (save-excursion ,@body) (save-mark-and-excursion--restore ,saved-marker-sym))))) +(defcustom transpose-active-region-dwim nil + "Make transpose commands act as with a zero prefix when region active. + +If non-nil, a zero prefix is not required to operate over mark +and point when the region is active. See `transpose-words' for +example, (the last sentence)." + :type 'boolean + :group 'editing-basics) + (defcustom use-empty-active-region nil "Whether \"region-aware\" commands should act on empty regions. If nil, region-aware commands treat the empty region as inactive. @@ -6967,7 +6976,8 @@ transpose-subr (progn (funcall mover (- x)) (point)))))) pos1 pos2) (cond - ((= arg 0) + ((or (= arg 0) (and (= arg 1) (use-region-p) + transpose-active-region-dwim)) (save-excursion (setq pos1 (funcall aux 1)) (goto-char (or (mark) (error "No mark set in this buffer"))) Best regards -- Tomas From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 10:19:44 2020 Received: (at control) by debbugs.gnu.org; 19 Jan 2020 15:19:44 +0000 Received: from localhost ([127.0.0.1]:43740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itCMZ-0006YI-Sg for submit@debbugs.gnu.org; Sun, 19 Jan 2020 10:19:44 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:52420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itCMY-0006Y2-FI for control@debbugs.gnu.org; Sun, 19 Jan 2020 10:19:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Subject:From:To:Date:Sender:Reply-To:Message-ID:Cc:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eqd75zZhtU2v1ZH4a6RY71tV9srwz41kTclKXsL1iDU=; b=WDtvuk1jEn/uipJsxFDRbbuyBq 1oXxGtPW+cY9y5gqbG03qYCWU1IlJpW8aYyEZ6ILzzD1kypLW8+iSP2DjY1TPEcWNAk1KLYDIxOIE +qiHBF8UJgO+uZ4wnFuzMaYBLvifxZqn+WXhDkrRMKqikPf1PhlvEu8UrM5Xq19QB3o5YlTTvr0uK 4G30NCS0ZscfTDyePxAcizTlzJJB+uW7zoJYOWYOWoOxLOpL8ah0KiZO7lYLYBUu4vBTK0hF+CnnN eoPXamJ2nt+HsN8ydR40jALKWM6wgA4vNs2lD48jzaoTnTdsXUSKhwHqB+XYdtR04tU8sBHrqoR0q 6YYQ7G7A==; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:46950 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1itCMS-0003N0-CO for control@debbugs.gnu.org; Sun, 19 Jan 2020 10:19:36 -0500 Date: Sun, 19 Jan 2020 16:19:34 +0100 To: control@debbugs.gnu.org From: Stefan Kangas Subject: control message for bug #29346 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" Message-Id: X-Spam-Score: -1.0 (-) tags 29346 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 10 10:11:10 2020 Received: (at 29346) by debbugs.gnu.org; 10 Aug 2020 14:11:10 +0000 Received: from localhost ([127.0.0.1]:37027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k58W5-0001LI-RR for submit@debbugs.gnu.org; Mon, 10 Aug 2020 10:11:10 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k58W3-0001L1-NJ for 29346@debbugs.gnu.org; Mon, 10 Aug 2020 10:11:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JT52kV+l4+oB8fU/zjM+z9qPpPFFSGgEUbDLNwOawf4=; b=uCAir4EzDwufl83sU3pTKijMP0 +DDC9BLrQySM3bUOxj7WrTMqlIMz4NN+eaMp26TQ2ZOhtKTEzC5rZnuPu81xyq9yLjWr7dipkxETs bDgFaksjtIts5k3oe4ok+pvU+2TNfE12BlNEH9+VUt+bSZ5TzSxylHaCkFa4RphcQqWw=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k58Vr-0005hm-Ud; Mon, 10 Aug 2020 16:11:01 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#29346: dwim transpose-subr opportunity? References: <87a7zkwooy.fsf@fliptop> <83bmk0gh8l.fsf@gnu.org> Date: Mon, 10 Aug 2020 16:10:54 +0200 In-Reply-To: <83bmk0gh8l.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Nov 2017 09:48:10 +0200") Message-ID: <871rke3829.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: >> It gets a bit silly as suggested though, I guess the logic should be >> something like (or (= arg 0) (and transpose-dwim (use-region-p))) > > Maybe. But I wonder why this relatively rare use case i [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 29346 Cc: Tomas Nordin , 29346@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> It gets a bit silly as suggested though, I guess the logic should be >> something like (or (= arg 0) (and transpose-dwim (use-region-p))) > > Maybe. But I wonder why this relatively rare use case is so important > as to mandate a new defcustom, whose only purpose is to save the user > from typing M-0 or "C-u 0". Just because people didn't read the doc > string and therefore didn't know about the special meaning of an > argument of zero? But then they will not know about the proposed > magic, either. I think the conclusion here was that it didn't seem worth it to add a new variable to control this behaviour (since `M-0' easy to type), so I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 10 10:11:15 2020 Received: (at control) by debbugs.gnu.org; 10 Aug 2020 14:11:15 +0000 Received: from localhost ([127.0.0.1]:37030 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k58WB-0001LY-4L for submit@debbugs.gnu.org; Mon, 10 Aug 2020 10:11:15 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k58W9-0001LA-A4 for control@debbugs.gnu.org; Mon, 10 Aug 2020 10:11:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Y/Shi9f9E8tL9khfC83QIxoW5nMS3HL1TKrRlIAfs98=; b=Gjid0Bb9p6x+e1QH4czATi6tCd X8FyncdetvNzqOmsfrCHTLR45uanVNX6R8OjmDCKdkBYX9bRrDyngAoCAU3bvCu+aCqWfigcS4yvI JkC3SiNy0fIAhFqnIz1lFUTHELcuIlZwtyIH+eAhKuBOQa2FfCQSEkMBg0T+nJi6skcI=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k58W1-0005i1-Lm for control@debbugs.gnu.org; Mon, 10 Aug 2020 16:11:07 +0200 Date: Mon, 10 Aug 2020 16:11:04 +0200 Message-Id: <87zh721thj.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #29346 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 29346 wontfix close 29346 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 29346 wontfix close 29346 quit From unknown Tue Jun 24 05:12:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 08 Sep 2020 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator