bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29346: dwim transpose-subr opportunity new suggestion


From: Tomas Nordin
Subject: bug#29346: 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]