[OS X Emacs] aquamacs: next "logical" line, not visual line
David Reitter
david.reitter at gmail.com
Tue Mar 22 14:12:24 EDT 2011
Hi Elizabeth,
thanks for your question.
On Mar 22, 2011, at 9:37 AM, Elizabeth Kellner wrote:
>
> In this case, I'm working on a csv file with long lines. I defined a keyboard macro to navigate through some of the fields, and edit them. My emacs habit is to record the macro, move the cursor to the next line and then C-a it back to the beginning. In this way I can then call the macro in rapid succession.
>
> The behavior is that (next-line) doesn't move to the next line, so C-a moves within the same line, and the macro gets stuck.
>
> Can anyone suggest a workaround? Is there an emacs function that's something like (next-logical-line)?
You can easily look you help for the function of C-a by pressing C-h k C-a.
This will point you to `visual-line-mode'. Turning it off will let you jump to the beginning of lines. You will want to turn it on/off permanently to make sure your macro works in that case.
Keyboard macros in Emacs are generally meant to replicate behavior exactly as during their definition, i.e., if C-a jumps to the beginning of the visual line, it should do so during execution of the macro as well.
If you'd like to avoid having to change `visual-line-mode', I would simply use M-x move-beginning-of-line RET in place of C-a when defining your keyboard macro. Then, `visual-line-mode' won't influence the behavior. (I haven't tested this - please let me know if there are problems, and I'll investigate.)
Finally, I quote the manual (changelog, version 2.0), which I searched using the Apple Help interface (in Aquamacs 2.2):
> Note that Word Wrapping (`visual-line-mode') affects the function of the cursor movement keys (arrows, and C-a, C-e, C-p and C-n). In Aquamacs, this can be easily customized. The default is as such:
> • In Word Wrapping (visual-line-mode), C-aenp and arrow keys move according to visual lines.
> • Without Word Wrapping (visual-line-mode off), arrow keys move visually, but C-aenp move non-visually according to buffer lines as in Emacs 22 and Aquamacs 1.x.
> Users may configure this behavior via the (new) `line-move-visual' customization variable. Set it to t for unconditional visual movement of all keys, and nil for unconditional logical (buffer) movement of all keys.
Hope that helps.
--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and support the Aquamacs Project!
More information about the MacOSX-Emacs
mailing list