Emacs
Text editor and IDE.
⚓
On this page, I document only the emacs commands that I use interactively.
Green means built-in, orange means custom.
⚓
⚓
Commands accessible from anywhere unless overridden.
⚠ Incomplete
⚓
Some possibly less-well-known commands I routinely use are: M-m, C-x C-v, C-j.
⚓
These commands move point (the cursor) and/or scroll to show a different portion of the buffer in the current window, but never modify the buffer.
- C-s, C-r ⚓
-
isearch-forward
,isearch-backward
.My favorite way of moving around in emacs!
Allows you to move directly where you want to, with a minimum of thinking, keystrokes, and time. Useful for all but the shortest distances.
Also, a staple of keyboard macros.
- C-v, M-v ⚓
- PageDown, PageUp (casual)
-
scroll-up
,scroll-down
.Scrolls down (respectively up). ("Scrolls the text up (respectively down)", hence the weird "reversed" nomenclature.)
Related
.emacs
sample:(setf next-screen-context-lines 1)
(overrides default: 2.) - M-<, M-> ⚓
-
beginning-of-buffer
,end-of-buffer
.Go to the first or last position in the buffer, respectively.
- C-f, C-b, C-n, C-p ⚓
-
forward-char
,backward-char
,next-line
,previous-line
.Roughly, go one position forward, backward, down or up, respectively.
I never use the arrow keys in emacs.
I have
(setf line-move-visual nil)
in my.emacs
, to move by logical lines. The default,t
, is perhaps initially appealing, but can really wreak havoc in keyboard macros in particular, and anyway moving about in even extremely long lines is trivial with C-s and C-r. - C-a, C-e ⚓
-
move-beginning-of-line
,move-end-of-line
.Move to the beginning or end of the line, respectively.
- M-m ⚓
-
back-to-indentation
Like C-a, but skips initial whitespace.
⚓
- C-x C-f ⚓
-
find-file
TODO
- C-x C-v ⚓
-
find-alternate-file
TODO
- C-x C-s ⚓
-
save-buffer
TODO
- C-x b ⚓
-
switch-to-buffer
TODO
(Actually iswitchb-buffer in my case.)
- C-x k ⚓
-
kill-buffer
TODO
⚓
- C-x 0 ⚓
-
delete-window
TODO
- C-x 1 ⚓
-
delete-other-windows
TODO
- C-x 2 ⚓
-
split-window-vertically
TODO
- C-x + ⚓
-
balance-windows
TODO
⚓
- C-k ⚓
-
kill-line
Kill from the current position to the end of the line.
- C-SPC ⚓
-
set-mark-command
TODO
- C-w ⚓
-
kill-region
TODO
- C-y ⚓
-
yank
Paste the last block of consecutively killed text, or the last one that was yanked (pasted), whichever happened most recently.
Normally leaves point at the end of the yanked text, but with a prefix argument, leaves point at the start of the yanked text, which is sometimes useful in keyboard macros in particular.
The mark is usefully left at the opposite end of the yanked text, so you can immediately select the region of just-yanked text with C-x C-x if you need to operate on it.
- M-y ⚓
-
yank-pop
Successive invocations of this command, which must happen after an initial C-y, cycle through the kill ring.
- C-x r s ⚓
-
copy-to-register
TODO
- C-x r i ⚓
-
insert-register
TODO
- C-j ⚓
-
newline-and-indent
TODO
⚓
- C-x ( ⚓
-
kmacro-start-macro
TODO
- C-x ) ⚓
-
kmacro-end-macro
TODO
- C-x e ⚓
-
kmacro-end-and-call-macro
TODO
- M-x name-last-kbd-macro ⚓
-
name-last-kbd-macro
TODO
(Not actually in fundamental mode.)
- C-x r n ⚓
-
number-to-register
TODO
- C-x r + ⚓
-
increment-register
TODO
- M-q ⚓
-
fill-paragraph
TODO
⚓
- C-x C-c ⚓
-
save-buffers-kill-terminal
TODO
- C-h k ⚓
-
describe-key
TODO
- C-h w ⚓
-
where-is
TODO
- C-h m ⚓
-
describe-mode
Give an overview of how to use the current major mode.
- C-x z ⚓
-
repeat
TODO
- C-x r SPC ⚓
-
point-to-register
TODO
- C-x r j ⚓
-
jump-to-register
TODO
- M-x indent-region ⚓
-
indent-region
TODO
IS in fundamental mode, but the default keybinding is hard or impossible to type in my configuration.
- M-x untabify ⚓
-
untabify
TODO
(Not actually in fundamental mode.)
- C-x 3 ⚓
-
split-window-horizontally
TODO
- C-x C-x ⚓
-
exchange-point-and-mark
TODO
- M-x make-directory ⚓
-
make-directory
TODO
- C-x i ⚓
-
insert-file
TODO
⚓
Filesystem browser and editor.
✔ Ready
⚓
- RET ⚓
-
dired-find-file
Visit the currently selected file or directory.
If it's a directory, open a new, independent instance of dired. The previous dired instance is left open in the background. (Might be unintuitive to some, it certainly was to me at first...)
- d ⚓
-
dired-flag-file-deletion
Flag a file or directory for deletion.
- x ⚓
-
dired-do-flagged-delete
Delete the files and directories currently flagged for deletion.
- g ⚓
-
revert-buffer
Reload the directory from the filesystem, particularly to see changes made outside of emacs.
⚓
- DEL ⚓
-
dired-unmark-backwards
Select the previous file or directory and unflag it.
- u ⚓
-
dired-unmark
Unflag the current file or directory.
- R ⚓
-
dired-do-rename
Rename (and/or move) the currently selected file or directory.
- C ⚓
-
dired-do-copy
Copy the currently selected file or directory.
⚓
- ^ ⚓
-
dired-up-directory
Open a new, independent instance of dired in the parent directory.
I often do C-x C-v and delete the last directory instead...
⚓
Documentation browser.
✔ Ready
⚓
- RET ⚓
-
Info-follow-nearest-node
Follow a link.
- d ⚓
-
Info-directory
Go to the topmost Info node, listing all Info manuals.
- u ⚓
-
Info-up
Go up in the hierarchy of Info nodes.
- l ⚓
-
Info-history-back
Go back to where you were before following the last link (menu item or cross-reference).
Especially useful after visiting a cross-reference to a tangential topic.
- q ⚓
-
Info-exit
"Exit Info by selecting some other buffer."
For movement within an Info node, I simply use the normal emacs movement commands. I never ever use Info's utterly confusing SPC and DEL to scroll down and up, as they don't respect node boundaries and as a result don't make me feel in control.
⚓
-
Info-menu
Follow a link by (approximate) name in the current page's menu.
Honestly I usually just navigate to the link manually via other means and press RET...
But this is useful especially in the directory node to access a manual directly. For example, d m Emacs RET, d m elisp RET, d m sed RET, etc.
⚓
⚓
A good base to build support for specific lisp dialects.
✘ Stub+
⚓
- C-M-f, C-M-b ⚓
-
forward-sexp
,backward-sexp
.TODO
- C-M-a, C-M-e ⚓
-
beginning-of-defun
,end-of-defun
.TODO
- C-M-k ⚓
-
kill-sexp
TODO
- C-M-q ⚓
-
indent-sexp
TODO
⚓
⚓
⚓
⚓
The most advanced open-source IDE for Common Lisp.
⚓
Stub.
⚓
Stub.
⚓
Stub.
⚓
Stub.
⚓
Here's my .emacs
file (see it on github). It's very raw and messy and undocumented, but it works for me...