Visual versus logical lines

In GNU Emacs 23 the default line-movement behavior changed with regard to wrapped lines.

Not that I realized it at the time, entirely—like not realizing that I not only knew M-f (forward-word) and M-b (backward-word), but used them every day, I was so habituated to the prior behavior that I couldn’t articulate what had changed, I just knew something was different that was annoying me to no end.1

It was only when I found a reference to line-move-visual in the GNU Emacs Manual, that I realized exactly what it was that had changed—and, more importantly, how to change it back:2

(setq line-move-visual nil
      track-eol t)

line-move-visual, when set to a value other than nil, indicates that if there was a line on the screen, the cursor keys should move through it, even if it was the wrapped continuation of a prior line. Emacs’ prior behavior was that the cursor keys would move the cursor based on the basis of “logical lines”—that is, the lines as determined by the presence of line-ending characters. So if you had a “logical line” that spanned three lines on screen, when you hit C-n (next-line) on that line, you ended up three lines down on screen.

If I hadn’t been habituated to this, I probably wouldn’t care—I don’t really think one behavior is significantly better than the other. But the prior behavior is what I’m used to, so I’m going to change it back.

At the same time, I’m setting track-eol to t so that when I move the cursor up and down while at the end of a “logical line”, the cursor will stick to the end of lines, no matter how long or short they are. This sort of stickiness is another behavior I’m used to at a fairly low level.


1 I am amused to find that no less than Mark Crispin, developer of the IMAP protocol agrees with me.

2 This is, ultimately, one of the reasons I enjoy emacs—more than any other editor, I suspect, if you don’t like something, you can probably change it. GNU Emacs is, as I used to tell people, “a programming environment cleverly disguised as an editor.”

Just getting around

The this blog had its genesis when I sat down to read the GNU Emacs Manual while we were travelling over the holidays—I figured I could skim it, maybe pick up one or two new things, but, really, it would mostly be just speed-reading.

What it actually proved was that I had never tried to read the manual recently, perhaps ever. I would stumble across basic stuff I feel like I should have known all along, and then an hour or two later would have to work very hard to remember what it was that I had stumbled across.

I have come to realize I retain things better if I write them down—I still don’t understand how I got all the way through college, since I never took notes worth a damn. So this is my public notebook.

While I know M-f (forward-word) and M-b (backward-word) at such a low level that I thought I didn’t know them until I used them without thinking about it, I didn’t know about M-RIGHT/C-RIGHT (right-word) and M-LEFT/C-LEFT (left-word), which do basically the same thing, but are a little bit more ergonomic since you’re not doing both keys with the same hand. Something to retrain, I suspect.

I probably also need to try to train myself to use my right Meta key more; unfortunately, on my laptop keyboard, it falls somewhat awkwardly under my thumb, so it may take some time to make that transition.

Finally (for today), there’s M-g M-g/M-g g (goto-line) which I use at least a couple of times a day…by typing M-x goto-line. I think this will be a little faster.