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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 21 May 2022 15:41:13 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 21 May 2022 13:40:38 +0200
> 
> Eli Zaretskii <[email-masked]> 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.