Emacs: line-move-visual

By Xah Lee. Date:

When you use Keyboard Macro, you might want the arrow up/down keys move the cursor by a logical line, as opposed to visual line. (Emacs 23's default is visual line.)

To set to logical line, Alt+x set-variable, then give line-move-visual, with value nil. (t for true; nil for false).

When you play back macro, be sure the line-move-visual is the same as when you recorded it.

One thing you can do is to set line-move-visual at the beginning of your keyboard macro, and set it back at the end.

Here's a command to toggle it.

(defun toggle-line-move-visual ()
  "Toggle behavior of up/down arrow key, by visual line vs logical line."
  (if line-move-visual
      (setq line-move-visual nil)
    (setq line-move-visual t)))
Liket it? Put $1 at patreon. Or Buy Xah Emacs Tutorial. Thanks.