GNU bug report logs -
#55514
29.0.50; Keyboard macros and visual-line-mode
Previous Next
To reply to this bug, email your comments to 55514 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Thu, 19 May 2022 02:00:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Lars Ingebrigtsen <larsi <at> gnus.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 19 May 2022 02:00:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
visual-line-mode is nice, but it has one major drawback -- it makes
<down> not "reliable" when recording macros.
That is, if you record
C-x ( C-SPC <down> <down> C-k C-x )
(i.e., "kill two lines"), you can't really use `C-x e' to do much of
anything, because the buffer may have too-long lines that makes <down>
move down into the middle of a logical line.
So perhaps we should have a user option that remaps
next-line/previous-line to next-logical-line/previous-logical-line while
inside a `C-x ('?
(Or something to that effect -- perhaps the user option should make `C-x
(' switch visual-line-mode off and exiting recording switches it on
again (and the recorded macro would also contain those commands).
In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0)
of 2022-05-17 built on xo
Repository revision: 803041e01474f2a522170c9f388068e8460be2ae
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Debian GNU/Linux bookworm/sid
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Thu, 19 May 2022 07:09:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 55514 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Thu, 19 May 2022 03:59:01 +0200
>
> visual-line-mode is nice, but it has one major drawback -- it makes
> <down> not "reliable" when recording macros.
>
> That is, if you record
>
> C-x ( C-SPC <down> <down> C-k C-x )
>
> (i.e., "kill two lines"), you can't really use `C-x e' to do much of
> anything, because the buffer may have too-long lines that makes <down>
> move down into the middle of a logical line.
>
> So perhaps we should have a user option that remaps
> next-line/previous-line to next-logical-line/previous-logical-line while
> inside a `C-x ('?
>
> (Or something to that effect -- perhaps the user option should make `C-x
> (' switch visual-line-mode off and exiting recording switches it on
> again (and the recorded macro would also contain those commands).
Maybe all we need is to add a hook that will be called by
kmacro-call-macro before running the macro. Then users can do
whatever they like in that hook, including turning off
line-move-visual (which I'm guessing is what you meant, not
visual-line-mode).
We could also have a new user option to turn that off automatically
while running a macro, but that sounds too specific to some uses of
macros in some use cases, not something many users will want in many
cases.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Thu, 19 May 2022 23:42:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 55514 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Maybe all we need is to add a hook that will be called by
> kmacro-call-macro before running the macro. Then users can do
> whatever they like in that hook, including turning off
> line-move-visual (which I'm guessing is what you meant, not
> visual-line-mode).
But that doesn't really fix the issue -- the non-visual-line-moving
commands have to be replicated when we execute the macro.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Fri, 20 May 2022 07:02:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 55514 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 55514 <at> debbugs.gnu.org
> Date: Fri, 20 May 2022 01:41:30 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > Maybe all we need is to add a hook that will be called by
> > kmacro-call-macro before running the macro. Then users can do
> > whatever they like in that hook, including turning off
> > line-move-visual (which I'm guessing is what you meant, not
> > visual-line-mode).
>
> But that doesn't really fix the issue -- the non-visual-line-moving
> commands have to be replicated when we execute the macro.
No, you need just turn off line-move-visual in that hook, then C-n
will follow physical lines instead of visual lines, which is AFAIU
what you wanted.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Fri, 20 May 2022 07:15:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 55514 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> No, you need just turn off line-move-visual in that hook, then C-n
> will follow physical lines instead of visual lines, which is AFAIU
> what you wanted.
I don't understand what you mean here. Of course `C-n' will move
logically when you switch line-move-visual off. But when you switch it
back on again after recording the macro, `C-x e' will move visually
again, which is what you don't want.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Fri, 20 May 2022 07:23:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 55514 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 55514 <at> debbugs.gnu.org
> Date: Fri, 20 May 2022 09:14:23 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > No, you need just turn off line-move-visual in that hook, then C-n
> > will follow physical lines instead of visual lines, which is AFAIU
> > what you wanted.
>
> I don't understand what you mean here. Of course `C-n' will move
> logically when you switch line-move-visual off. But when you switch it
> back on again after recording the macro, `C-x e' will move visually
> again, which is what you don't want.
Then maybe I didn't understand the original report. I thought you
wanted a way to make sure the macro runs with C-n/C-p working by
physical lines?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Fri, 20 May 2022 07:27:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 55514 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Then maybe I didn't understand the original report. I thought you
> wanted a way to make sure the macro runs with C-n/C-p working by
> physical lines?
I want people to be able to create usable keyboard macros -- that's the
major regression line-move-visual led to, so I never understood why this
wasn't fixed when it was introduced.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Fri, 20 May 2022 10:47:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 55514 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 55514 <at> debbugs.gnu.org
> Date: Fri, 20 May 2022 09:26:50 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > Then maybe I didn't understand the original report. I thought you
> > wanted a way to make sure the macro runs with C-n/C-p working by
> > physical lines?
>
> I want people to be able to create usable keyboard macros -- that's the
> major regression line-move-visual led to, so I never understood why this
> wasn't fixed when it was introduced.
I don't agree that using visual-line movement in a macro makes the
macro "unusable". But I don't mind supporting your use case. As I
said earlier, we could add a special value of line-move-visual, which
would mean "move by visual lines, except when executing macros", which
would I think solve your problem. I just thought that adding a hook
could cater to a more general class of use cases, that's all.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Sat, 21 May 2022 11:41:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 55514 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> As I said earlier, we could add a special value of line-move-visual,
> which would mean "move by visual lines, except when executing macros",
> which would I think solve your problem.
That seems like a heavier solution than I had envisioned (without
looking at the code). You can bind keyboard macros to keys and have
them executed, and the point is that they should execute the same way as
they were recorded. That's the fantastic utility of recording keyboard
macros, after all.
I don't think a setting that affects line-move-visual in this way would
be all that sturdy. You can, for instance, record a macro, save it to a
file, and use it later. It would be awkward if flipping a setting then
affects how the macro executes.
I think having <down> recorded as `M-x next-logical-line' (etc), or
something to that effect, is the way to go here.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Sat, 21 May 2022 12:42:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 55514 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 55514 <at> debbugs.gnu.org
> Date: Sat, 21 May 2022 13:40:38 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > As I said earlier, we could add a special value of line-move-visual,
> > which would mean "move by visual lines, except when executing macros",
> > which would I think solve your problem.
>
> That seems like a heavier solution than I had envisioned (without
> looking at the code). You can bind keyboard macros to keys and have
> them executed, and the point is that they should execute the same way as
> they were recorded. That's the fantastic utility of recording keyboard
> macros, after all.
I don't think I understand. Emacs always knows when it is executing a
keyboard macro.
And what do you mean by "execute the same as they were recorded"?
With C-n, it can only be exactly "the same" if you move across exactly
the same text. Once the text is different, the partition into
physical and screen lines is different, and the effect is different.
To my mind, keyboard macros are about repeating the _commands_; the
effect of those commands is not guaranteed to be exactly the same in
each case.
> I don't think a setting that affects line-move-visual in this way would
> be all that sturdy. You can, for instance, record a macro, save it to a
> file, and use it later. It would be awkward if flipping a setting then
> affects how the macro executes.
The idea was that you won't flip the value, but set it once to that
value, assuming that you always (or frequently) want C-n/C-p go by
physical lines when invoked from a macro. Wasn't that your original
request?
> I think having <down> recorded as `M-x next-logical-line' (etc), or
> something to that effect, is the way to go here.
That's trivial to program, so I'm not sure I understand why would we
need that in core.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Sat, 21 May 2022 13:39:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 55514 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> And what do you mean by "execute the same as they were recorded"?
Moving logically versus visually.
>> I think having <down> recorded as `M-x next-logical-line' (etc), or
>> something to that effect, is the way to go here.
>
> That's trivial to program, so I'm not sure I understand why would we
> need that in core.
Trivial how?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Sat, 21 May 2022 14:01:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 55514 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 55514 <at> debbugs.gnu.org
> Date: Sat, 21 May 2022 15:38:37 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > And what do you mean by "execute the same as they were recorded"?
>
> Moving logically versus visually.
Not sure I follow. When you recorded the macro, was C-n moving by
logical lines or by screen lines? If the former, how did you get it
to move by logical lines, when the default is to move by screen lines?
> >> I think having <down> recorded as `M-x next-logical-line' (etc), or
> >> something to that effect, is the way to go here.
> >
> > That's trivial to program, so I'm not sure I understand why would we
> > need that in core.
>
> Trivial how?
Write a command that binds line-move-visual to nil and invokes
next-line, then bind it to some key, and use that key when you record
the macro.
But maybe your answer to my first questions above will explain to me
that I misunderstood you all the way.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Sun, 22 May 2022 11:15:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 55514 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Not sure I follow. When you recorded the macro, was C-n moving by
> logical lines or by screen lines? If the former, how did you get it
> to move by logical lines, when the default is to move by screen lines?
That is what this bug report is about -- recording and executing macros.
> Write a command that binds line-move-visual to nil and invokes
> next-line, then bind it to some key, and use that key when you record
> the macro.
I think we'll just have to let this rest for a while, because we've been
over this too many times. The original bug report really has all the
details.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55514
; Package
emacs
.
(Sun, 22 May 2022 13:01:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 55514 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 55514 <at> debbugs.gnu.org
> Date: Sun, 22 May 2022 13:14:37 +0200
>
> I think we'll just have to let this rest for a while, because we've been
> over this too many times. The original bug report really has all the
> details.
FWIW, I think my proposal -- to have an optional feature whereby
C-n/C-p move by logical lines inside a macro -- would solve the issue
presented in the original report.
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sun, 19 Jun 2022 14:10:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 360 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.