I often press C-<end> or C-<next>
accidentally. It's annoying and disorientating because I lose my
place in the document as well as my train of thought. I think
of them (a bit dramatically) as "Deadly Navigation Keys." But I
discovered two valuable Emacs features to make it easy to
recover from them (or prevent them) as a result.
The first valuable feature is that C-<end> (which is bound to
end-of-buffer) sets the mark at the cursor location prior to
setting point to the end of the buffer. (I only just realized
this after seeing the message "Mark set" in the minibuffer about
fifty times.)
There's an almost-applicable saying, "What goes up, must come
down," except in this case I'd say, "What gets pushed, may be
popped." A simple invocation of C-h a pop.+mark
revealed the
pop-to-mark-command. And then, happily, M-x pop-to-mark-command
returned me to exactly where I left off. It was the undo feature
that Emacs had been missing -- a sort of undo-cursor-motion.
Recovering from beginning-of-buffer
is just as easy. It, too,
pushes mark.
There are, however, other Deadly Navigation Keys that do not push
mark. In fact, they don't even change the position of the cursor.
Instead, they scroll the buffer. I'm referring to scroll-left
and
scroll-right
. These are disabled by default. However, I figured
that only babies needed to shielded from such commands, so I enabled
them.
Holy cow was that a mistake! On my laptop keyboard, the page
down and right arrow keys are crammed very close together. I often
press C-<right>
to advance one word, but that's only 1 cm away from
C-<next>, which is bound
to scroll-left. And scroll-left alters
the view of the buffer such that all the content I been work on
shifts off screen. The first time it happened, I freaked, of
course, and then I checked the status bar to see if the buffer had
been modified. (It hadn't.) So I closed Emacs entirely and
restarted it. Then I re-disabled scroll-left and scroll-right.
But then it occurred to me to disable end-of-buffer
and
beginning-of-buffer, too, because I rarely use those functions,
and if I really need to call them, all I'd have to do is press
the spacebar after each C-<end>. Disabling a command is a
convenient way of seeking confirmation without making the user
type "yes" (or "y").
What commands do you have disabled? And why?
1 comment:
- 'package-report-bug', bound to 'b' in the "*Packages*" buffer, because I don't want to use email in Emacs.
- `suspend-frame' because I tend to panick before I realize that Emacs is only suspended.
- 'Info-goto-node-web', default keybinding "G" in info-mode, because I don't want to accidently going online.
- all `doc-view' commands, e.g. in dired, because I can't stand it.
- `treemacs-delete-file' because of a dangerous bug in this external package: https://github.com/Alexander-Miller/treemacs/issues/1028
Post a Comment
Thank you for taking time to comment. Please note that comments may be deleted if they:
* Contain link(s) to a domain outside USA or Canada or to a commercial enterprise.
* Include non-English words or characters.
* Are irrelevant to the subject matter of the post.
For posts older than 14 days, comments are moderated and require approval.