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

Previous Next

Package: emacs;

Reported by: Theodor Thornhill <theo <at> thornhill.no>

Date: Sat, 17 Dec 2022 12:25:01 UTC

Severity: wishlist

Tags: patch

Found in version 30.0.50

Fixed in version 30.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60157 in the body.
You can then email your comments to 60157 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, eliz <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#60157; Package emacs. (Sat, 17 Dec 2022 12:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Theodor Thornhill <theo <at> thornhill.no>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, eliz <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Sat, 17 Dec 2022 12:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; [PATCH]: Change interactive form in transpose-chars
Date: Sat, 17 Dec 2022 13:23:53 +0100
[Message part 1 (text/plain, inline)]
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

[0001-Use-p-in-interactive-form-in-transpose-chars.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60157; Package emacs. (Sat, 24 Dec 2022 07:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 60157 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: 60157 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#60157: 30.0.50;
 [PATCH]: Change interactive form in transpose-chars
Date: Sat, 24 Dec 2022 09:01:55 +0200
> Cc: monnier <at> iro.umontreal.ca, eliz <at> gnu.org
> From: Theodor Thornhill <theo <at> thornhill.no>
> Date: Sat, 17 Dec 2022 13:23:53 +0100
> 
> 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
> 
> >From f7d98eb478b9d10c15e6b2d168049e65fcd3c448 Mon Sep 17 00:00:00 2001
> From: Theodor Thornhill <theo <at> thornhill.no>
> 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

Stefan, any further comments, or should I install this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60157; Package emacs. (Sat, 24 Dec 2022 13:42:01 GMT) Full text and rfc822 format available.

Message #11 received at 60157 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60157 <at> debbugs.gnu.org, Theodor Thornhill <theo <at> thornhill.no>
Subject: Re: bug#60157: 30.0.50; [PATCH]: Change interactive form in
 transpose-chars
Date: Sat, 24 Dec 2022 08:40:58 -0500
>>  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?

>> +  (transpose-subr 'forward-char arg))

Please use #' to quote function names.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60157; Package emacs. (Sat, 24 Dec 2022 19:12:01 GMT) Full text and rfc822 format available.

Message #14 received at 60157 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 60157 <at> debbugs.gnu.org
Subject: Re: bug#60157: 30.0.50; [PATCH]: Change interactive form in
 transpose-chars
Date: Sat, 24 Dec 2022 20:11:41 +0100
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> 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


[0001-Use-p-in-interactive-form-in-transpose-chars.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60157; Package emacs. (Sun, 25 Dec 2022 01:12:02 GMT) Full text and rfc822 format available.

Message #17 received at 60157 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: 60157 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#60157: 30.0.50; [PATCH]: Change interactive form in
 transpose-chars
Date: Sat, 24 Dec 2022 20:11:31 -0500
> Is this okay?

The code is OK.
I don't understand the motivation behind the change, tho.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60157; Package emacs. (Sun, 25 Dec 2022 07:38:01 GMT) Full text and rfc822 format available.

Message #20 received at 60157 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 60157 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#60157: 30.0.50; [PATCH]: Change interactive form in transpose-chars
Date: Sun, 25 Dec 2022 08:36:03 +0100

On 25 December 2022 02:11:31 CET, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>> Is this okay?
>
>The code is OK.
>I don't understand the motivation behind the change, tho.
>
>
>        Stefan
>

Mostly uniformity with surrounding code and housekeeping, but if such changes are unwanted, I'm fine with that too.

Theo




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 04 Sep 2023 15:12:01 GMT) Full text and rfc822 format available.

Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Wed, 06 Sep 2023 07:09:02 GMT) Full text and rfc822 format available.

Notification sent to Theodor Thornhill <theo <at> thornhill.no>:
bug acknowledged by developer. (Wed, 06 Sep 2023 07:09:02 GMT) Full text and rfc822 format available.

Message #27 received at 60157-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: 60157-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#60157: 30.0.50;
 [PATCH]: Change interactive form in transpose-chars
Date: Wed, 6 Sep 2023 00:08:04 -0700
Version: 30.1

Theodor Thornhill <theo <at> thornhill.no> writes:

> On 25 December 2022 02:11:31 CET, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>>> Is this okay?
>>
>>The code is OK.
>>I don't understand the motivation behind the change, tho.
>>
>
> Mostly uniformity with surrounding code and housekeeping, but if such changes are unwanted, I'm fine with that too.

No further comments within 9 months.

Pushed to master as commit 4ac83ee105a.  Closing.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 04 Oct 2023 11:24:27 GMT) Full text and rfc822 format available.

This bug report was last modified 176 days ago.

Previous Next


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