* lisp/simple.el (line-move-visual): Handle the case when point
moves outside of the visible portion of the buffer while executing
a keyboard macro. (Bug#13452) (Bug#23551) (Bug#23555)
(setq temporary-goal-column
(cons (/ (float x-pos)
(frame-char-width))
- hscroll))))))
+ hscroll)))
+ (executing-kbd-macro
+ ;; When we move beyond the first/last character visible in
+ ;; the window, posn-at-point will return nil, so we need to
+ ;; approximate the goal column as below.
+ (setq temporary-goal-column
+ (mod (current-column) (window-text-width)))))))
(if target-hscroll
(set-window-hscroll (selected-window) target-hscroll))
;; vertical-motion can move more than it was asked to if it moves