]> code.delx.au - gnu-emacs/blobdiff - lisp/simple.el
Fix 'next-line' and 'previous-line' during keyboard macro
[gnu-emacs] / lisp / simple.el
index affc403dcdc8f08159be246ce1ab05de095a4e8f..3d25ec19ab26e616af67280f2690d2ed14168047 100644 (file)
@@ -6054,7 +6054,13 @@ If NOERROR, don't signal an error if we can't move that many lines."
          (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