From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60157: 30.0.50; [PATCH]: Change interactive form in transpose-chars Date: Sat, 17 Dec 2022 13:23:53 +0100 Message-ID: <87k02qte06.fsf@thornhill.no> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16507"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, eliz@gnu.org To: 60157@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 17 13:25:29 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6WFs-00042a-9u for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Dec 2022 13:25:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6WFX-0001Ys-1u; Sat, 17 Dec 2022 07:25:07 -0500 Original-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 ) id 1p6WFT-0001WT-Dw for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 07:25:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6WFT-0007Zu-0o; Sat, 17 Dec 2022 07:25:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6WFS-0006Jd-4C; Sat, 17 Dec 2022 07:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, eliz@gnu.org, bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 12:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60157 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca, eliz@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167127984324236 (code B ref -1); Sat, 17 Dec 2022 12:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 12:24:03 +0000 Original-Received: from localhost ([127.0.0.1]:55616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6WEV-0006Iq-9x for submit@debbugs.gnu.org; Sat, 17 Dec 2022 07:24:03 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:40818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6WEU-0006Ik-1I for submit@debbugs.gnu.org; Sat, 17 Dec 2022 07:24:02 -0500 Original-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 ) id 1p6WET-0001Rm-PK for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 07:24:01 -0500 Original-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 ) id 1p6WEQ-0007OI-Sd for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 07:24:01 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com 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== X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=91.218.175.217; envelope-from=theo@thornhill.no; 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251276 Archived-At: --=-=-= 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 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 --=-=-=--