GNU bug report logs - #29346
dwim transpose-subr opportunity?

Previous Next

Package: emacs;

Reported by: Tomas Nordin <tomasn <at> posteo.net>

Date: Fri, 17 Nov 2017 22:01:01 UTC

Severity: wishlist

Tags: patch, wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Tomas Nordin <tomasn <at> posteo.net>
To: 29346 <at> debbugs.gnu.org
Subject: dwim transpose-subr opportunity new suggestion
Date: Sat, 25 Nov 2017 12:51:22 +0100
Hi Debbugs

Here is an update on the request/suggestion based on a suggestion from
the emacs help list, with a custom addition from myself.

diff --git a/lisp/simple.el b/lisp/simple.el
index 41f22b2396..7773a7d5d1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5431,6 +5431,15 @@ save-mark-and-excursion
             (save-excursion ,@body)
          (save-mark-and-excursion--restore ,saved-marker-sym)))))
 
+(defcustom transpose-active-region-dwim nil
+  "Make transpose commands act as with a zero prefix when region active.
+
+If non-nil, a zero prefix is not required to operate over mark
+and point when the region is active.  See `transpose-words' for
+example, (the last sentence)."
+  :type 'boolean
+  :group 'editing-basics)
+
 (defcustom use-empty-active-region nil
   "Whether \"region-aware\" commands should act on empty regions.
 If nil, region-aware commands treat the empty region as inactive.
@@ -6967,7 +6976,8 @@ transpose-subr
 		       (progn (funcall mover (- x)) (point))))))
 	pos1 pos2)
     (cond
-     ((= arg 0)
+     ((or (= arg 0) (and (= arg 1) (use-region-p)
+                         transpose-active-region-dwim))
       (save-excursion
 	(setq pos1 (funcall aux 1))
 	(goto-char (or (mark) (error "No mark set in this buffer")))


Best regards
--
Tomas




This bug report was last modified 4 years and 289 days ago.

Previous Next


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