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

From: Theodor Thornhill <[email-masked]>
Date: Sat, 24 Dec 2022 20:11:41 +0100

Stefan Monnier <[email-masked]> writes:

>>>  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))
>
> Hmm... If you remove this, does it still behave as described on the last
> line of the docstring?
>

You're right.  It does not.  I fixed that in the latest patch.

>>> +  (transpose-subr 'forward-char arg))
>
> Please use #' to quote function names.
>

Sure!

Is this okay?

Theo

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

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

diff --git a/lisp/simple.el b/lisp/simple.el
index b3174eef7d..69a7189a35 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -8423,12 +8423,12 @@ transpose-chars
   "Interchange characters around point, moving forward one character.
 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))
+If at end of line, the previous two chars are exchanged."
+  (interactive "*p")
+  (when (and (eolp) (not (bobp))
 	     (not (get-text-property (1- (point)) 'read-only)))
     (forward-char -1))
-  (transpose-subr 'forward-char (prefix-numeric-value arg)))
+  (transpose-subr #'forward-char arg))
 
 (defun transpose-words (arg)
   "Interchange words around point, leaving point at end of them.
-- 
2.34.1