GNU bug report logs -
#29346
dwim transpose-subr opportunity?
Previous Next
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
View this message in rfc822 format
Hello Debbugs
Sorry if this gets double posted, I sent it first directly to
29346 <at> debbugs.gnu.org without hooking onto this thread and I couldn't
see any signs of it coming through somewhere.
Anyways, 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.