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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29346 in the body.
You can then email your comments to 29346 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29346
; Package
emacs
.
(Fri, 17 Nov 2017 22:01:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tomas Nordin <tomasn <at> posteo.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 17 Nov 2017 22:01:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello List
Not a bug report but maybe a feature request. I was wondering if there
is an opportunity for a dwim feature of the transpose-<thing> set of
functions by something like the following:
1 file changed, 1 insertion(+), 1 deletion(-)
lisp/simple.el | 2 +-
modified lisp/simple.el
@@ -6967,7 +6967,7 @@ transpose-subr
(progn (funcall mover (- x)) (point))))))
pos1 pos2)
(cond
- ((= arg 0)
+ ((or (= arg 0) (use-region-p))
(save-excursion
(setq pos1 (funcall aux 1))
(goto-char (or (mark) (error "No mark set in this buffer")))
The intention is that a 0 number prefix argument is not necessary if
there is a region so that use-region-p is non-nil. I have tried it in
some various ways and to me it seem to work, but I don't know all the
delicate ways in which those commands might be used. What do you think?
It gets a bit silly as suggested though, I guess the logic should be
something like (or (= arg 0) (and transpose-dwim (use-region-p)))
Best regards
--
Tomas
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29346
; Package
emacs
.
(Sat, 18 Nov 2017 07:49:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 29346 <at> debbugs.gnu.org (full text, mbox):
> From: Tomas Nordin <tomasn <at> posteo.net>
> Date: Fri, 17 Nov 2017 23:00:29 +0100
>
> @@ -6967,7 +6967,7 @@ transpose-subr
> (progn (funcall mover (- x)) (point))))))
> pos1 pos2)
> (cond
> - ((= arg 0)
> + ((or (= arg 0) (use-region-p))
> (save-excursion
> (setq pos1 (funcall aux 1))
> (goto-char (or (mark) (error "No mark set in this buffer")))
>
>
> The intention is that a 0 number prefix argument is not necessary if
> there is a region so that use-region-p is non-nil. I have tried it in
> some various ways and to me it seem to work, but I don't know all the
> delicate ways in which those commands might be used. What do you think?
I think this would be a source of inadvertent mistakes and
annoyances. Transient Mark mode is on by default, which means M-t can
frequently do something the user didn't intend it to, just because the
region happened to be active. A similar situation exists with typing
DEL when the region is active, but at least in that case we behave
like many GUI applications out there, so we can hope the user is ready
for that and expects that to happen. (I'm never ready, which is
probably the reason why I turn Transient Mark mode off.) With M-t, we
don't have that defense.
> It gets a bit silly as suggested though, I guess the logic should be
> something like (or (= arg 0) (and transpose-dwim (use-region-p)))
Maybe. But I wonder why this relatively rare use case is so important
as to mandate a new defcustom, whose only purpose is to save the user
from typing M-0 or "C-u 0". Just because people didn't read the doc
string and therefore didn't know about the special meaning of an
argument of zero? But then they will not know about the proposed
magic, either.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29346
; Package
emacs
.
(Sat, 18 Nov 2017 13:36:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 29346 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> I think this would be a source of inadvertent mistakes and
> annoyances. Transient Mark mode is on by default, which means M-t can
> frequently do something the user didn't intend it to, just because the
> region happened to be active. A similar situation exists with typing
Is an example of that the following
^Jack and Jill over ^jumped the hill.
The first '^' is for the mark and next is for point, making an active
region, and now I hit M-t because I wanted to swap 'over' with 'jump',
but instead I swapped 'Jack' with 'jumped'.
Just for my understanding. Or is there better examples?
>> It gets a bit silly as suggested though, I guess the logic should be
>> something like (or (= arg 0) (and transpose-dwim (use-region-p)))
>
> Maybe. But I wonder why this relatively rare use case is so important
> as to mandate a new defcustom, whose only purpose is to save the user
> from typing M-0 or "C-u 0". Just because people didn't read the doc
I was mostly thinking not to disturb the long lasting default I think,
or the possible annoyances as you say.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29346
; Package
emacs
.
(Sat, 18 Nov 2017 14:47:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 29346 <at> debbugs.gnu.org (full text, mbox):
> From: Tomas Nordin <tomasn <at> posteo.net>
> Cc: 29346 <at> debbugs.gnu.org
> Date: Sat, 18 Nov 2017 14:35:22 +0100
>
> > I think this would be a source of inadvertent mistakes and
> > annoyances. Transient Mark mode is on by default, which means M-t can
> > frequently do something the user didn't intend it to, just because the
> > region happened to be active. A similar situation exists with typing
>
> Is an example of that the following
>
> ^Jack and Jill over ^jumped the hill.
>
> The first '^' is for the mark and next is for point, making an active
> region, and now I hit M-t because I wanted to swap 'over' with 'jump',
> but instead I swapped 'Jack' with 'jumped'.
>
> Just for my understanding. Or is there better examples?
You understood me, that's exactly what I had in mind.
> >> It gets a bit silly as suggested though, I guess the logic should be
> >> something like (or (= arg 0) (and transpose-dwim (use-region-p)))
> >
> > Maybe. But I wonder why this relatively rare use case is so important
> > as to mandate a new defcustom, whose only purpose is to save the user
> > from typing M-0 or "C-u 0". Just because people didn't read the doc
>
> I was mostly thinking not to disturb the long lasting default I think,
> or the possible annoyances as you say.
Thanks for clarifying that.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29346
; Package
emacs
.
(Sat, 25 Nov 2017 11:52:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 29346 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29346
; Package
emacs
.
(Sun, 26 Nov 2017 13:55:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 29346 <at> debbugs.gnu.org (full text, mbox):
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
Added tag(s) patch.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sun, 19 Jan 2020 15:20:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29346
; Package
emacs
.
(Mon, 10 Aug 2020 14:12:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 29346 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> It gets a bit silly as suggested though, I guess the logic should be
>> something like (or (= arg 0) (and transpose-dwim (use-region-p)))
>
> Maybe. But I wonder why this relatively rare use case is so important
> as to mandate a new defcustom, whose only purpose is to save the user
> from typing M-0 or "C-u 0". Just because people didn't read the doc
> string and therefore didn't know about the special meaning of an
> argument of zero? But then they will not know about the proposed
> magic, either.
I think the conclusion here was that it didn't seem worth it to add a
new variable to control this behaviour (since `M-0' easy to type), so
I'm closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) wontfix.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Aug 2020 14:12:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
29346 <at> debbugs.gnu.org and Tomas Nordin <tomasn <at> posteo.net>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Aug 2020 14:12:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 08 Sep 2020 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 236 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.