From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#29346: dwim transpose-subr opportunity? Date: Sat, 18 Nov 2017 09:48:10 +0200 Message-ID: <83bmk0gh8l.fsf@gnu.org> References: <87a7zkwooy.fsf@fliptop> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1510991352 19753 195.159.176.226 (18 Nov 2017 07:49:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Nov 2017 07:49:12 +0000 (UTC) Cc: 29346@debbugs.gnu.org To: Tomas Nordin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 18 08:49:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFxs7-0004br-Sv for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Nov 2017 08:49:04 +0100 Original-Received: from localhost ([::1]:49086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFxsE-0005BG-RL for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Nov 2017 02:49:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFxs9-0005B8-SG for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 02:49:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFxs6-0001Ua-NC for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 02:49:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36839) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eFxs6-0001UK-JR for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 02:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eFxs6-0004ut-Cp for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 02:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Nov 2017 07:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29346 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29346-submit@debbugs.gnu.org id=B29346.151099131518866 (code B ref 29346); Sat, 18 Nov 2017 07:49:02 +0000 Original-Received: (at 29346) by debbugs.gnu.org; 18 Nov 2017 07:48:35 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 In-reply-to: <87a7zkwooy.fsf@fliptop> (message from Tomas Nordin on Fri, 17 Nov 2017 23:00:29 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140040 Archived-At: > 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.