Subject: Re: bug#55514: 29.0.50; Keyboard macros and visual-line-mode

From: Eli Zaretskii <[email-masked]>
Date: Thu, 19 May 2022 10:08:18 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> 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.