GNU bug report logs - #60157
30.0.50; [PATCH]: Change interactive form in transpose-chars

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Theodor Thornhill <theo@HIDDEN>; Keywords: patch; dated Sat, 17 Dec 2022 12:25:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 12:24:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 17 07:24:03 2022
Received: from localhost ([127.0.0.1]:55616 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p6WEV-0006Iq-9x
	for submit <at> debbugs.gnu.org; Sat, 17 Dec 2022 07:24:03 -0500
Received: from lists.gnu.org ([209.51.188.17]:40818)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <theo@HIDDEN>) id 1p6WEU-0006Ik-1I
 for submit <at> debbugs.gnu.org; Sat, 17 Dec 2022 07:24:02 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <theo@HIDDEN>) id 1p6WET-0001Rm-PK
 for bug-gnu-emacs@HIDDEN; Sat, 17 Dec 2022 07:24:01 -0500
Received: from out-217.mta0.migadu.com ([91.218.175.217])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <theo@HIDDEN>) id 1p6WEQ-0007OI-Sd
 for bug-gnu-emacs@HIDDEN; Sat, 17 Dec 2022 07:24:01 -0500
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no;
 s=key1; t=1671279835;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=IzT8rbmzUXDLMuND8yjw8gcxQEymVw000B1q9x3IjoA=;
 b=RWp7C+B9YAfiyEcBZYCevOMEqIDbaiybF5T2R6kcDE3GqtwZpBGtNa9uPiM8Tn8hzMt94u
 2TAYusnAeyoFZ4e1inR6+TjKbs6xPnDYrph2xttNabTArNE+ye25co7wk61Fgd8d+9zsv5
 BemIROeve+aWy27ldTEoTjWp3NLaENu0k6zGeoLlKIKy2GWYN09wI3ERvzmAxhdCCGoa6q
 xlZtlnZreyfktgcXKX2mN/ri0f9vAAMqXCOr0wOp4tTiMXRNWJUnGH/fWwjGqNj5udg9Im
 /cwL/uiOsO58d4FkZB4EPtWj9Ae0FhkDbsVa6CjFx0b4eEH5SCL4xndzbHPwXQ==
From: Theodor Thornhill <theo@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.50; [PATCH]: Change interactive form in transpose-chars
X-Debbugs-Cc: monnier@HIDDEN, eliz@HIDDEN
Date: Sat, 17 Dec 2022 13:23:53 +0100
Message-ID: <87k02qte06.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=91.218.175.217; envelope-from=theo@HIDDEN;
 helo=out-217.mta0.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain


Hi Stefan and Eli!

As a part of my investigation into transposing things using tree-sitter
I promised to also introduce some improvements to both the code and
documentation, as the latter is a little sparse.  I'll add some patches
while I work on the tree-sitter stuff.

This commit simplifies the transpose-chars.  The bug described in the
commit history is no longer reproducible, so I think its complicated
nature can be removed.  What do you think?

Theo


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Use-p-in-interactive-form-in-transpose-chars.patch

From f7d98eb478b9d10c15e6b2d168049e65fcd3c448 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@HIDDEN>
Date: Sat, 17 Dec 2022 13:14:22 +0100
Subject: [PATCH] Use *p in interactive form in transpose-chars

There are two changes in this commit.  The first one is removal of an
obsolete guard against moving into read-only text, as described in
bug#17829.  The second is a simplification of the code to make it more
similar to its sibling commands.  We can convert the prefix into a
number immediately, rather than later.

* lisp/simple.el (transpose-chars): Use '*p' instead of '*P' like the
other transpose-* functions.
---
 lisp/simple.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index dcc2242e49..bde65d96f1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -8421,11 +8421,8 @@ transpose-chars
 With prefix arg ARG, effect is to take character before point
 and drag it forward past ARG other characters (backward if ARG negative).
 If no argument and at end of line, the previous two chars are exchanged."
-  (interactive "*P")
-  (when (and (null arg) (eolp) (not (bobp))
-	     (not (get-text-property (1- (point)) 'read-only)))
-    (forward-char -1))
-  (transpose-subr 'forward-char (prefix-numeric-value arg)))
+  (interactive "*p")
+  (transpose-subr 'forward-char arg))
 
 (defun transpose-words (arg)
   "Interchange words around point, leaving point at end of them.
-- 
2.34.1


--=-=-=--




Acknowledgement sent to Theodor Thornhill <theo@HIDDEN>:
New bug report received and forwarded. Copy sent to monnier@HIDDEN, eliz@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to monnier@HIDDEN, eliz@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#60157; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 17 Dec 2022 12:30:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.