on Emacs

an opinionated chaotic draft cheatsheet

general

C-x k
kill-buffer

C-_
C-/
undo

C-v, PUp
scroll-up-command

M-v, PDown
scroll-down-command

M-d
kill-word

M-Bspc
kill-word-backwards

C-w
kill-region
(cut)
M-w
kill-ring-save
(copy region)
C-y
yank
(paste)
M-y
yank-pop
cycle the yank with the kill ring, after a yank[-pop]
C-x h
mark-whole-buffer
(select all)
C-s
isearch-forward

C-r
isearch-backward

C-h c
describe-key-briefly
(because M-x describe-key opens a buffer)
M-h
mark-paragraph

M-@
mark-word

C-M-h
mark-defun

C-M-@
C-M-Spc
mark-sexp

C-Spc
set-mark-command
???
C-x Spc
rectangle-mark-mode

M-Spc
just-one-space

M-f
forward-word
(sub)word
M-b
backward-word
M-d
kill-word

M-Del
backward-kill-word

M-t
transpose-words

M-c
capitalize-word

M-u
upcase-word

M-l
downcase-word


query-replace


dired-do-query-replace
(in dired, Q) - interactive find&replace on marked files in dired
C-x b
switch-to-buffer

SLIME

https://www.darkchestnut.com/2017/getting-started-with-common-lisp/


slime
start SLIME
C-c C-z

switch to SLIME from a Lisp buffer
C-c C-c

compile the function at the cursor
C-c M-q

indent the function at the cursor
C-up/down

move through history in SLIME buffer



CC mode

TAB
c-indent-command

C-j
newline-and-indent

C-M-q
c-indent-exp
Indents entire balanced brace or parenthesis expression. Point must be on opening brace or parenthesis of the expression you want to indent.
C-c C-q
c-indent-defun
Indents entire top-level function, class or macro definition encompassing point. It leaves point unchanged. Can't be used to reindent nested brace construct such as function. The top level construct must be complete, i.e. have both beginning and ending brace.
C-M-\
indent-region
Indents arbitrary region of code.
C-M-h
c-mark-function
mark current top-level function as current region. As with c-indent-defun, operates on top level.
C-c C-c
comment-region

M-- C-c C-c
uncomment-region
probably
C-u C-c C-c
uncomment-region
probably
M-;
comment

C-u M-;

kills any comment on current line
C-M-a
c-beginning-of-defun
C-M-e
c-end-of-defun

M-a
-of-statement

M-b

C-c C-u
up-conditional
move back to containing preprocessor conditional, does not stop at #else
C-c C-p

move across preprocessor conditional
C-c C-n

M-q
c-fill-paragraph
(alike to fill-paragraph) multiline string literals, block and line comments
M-j
c-indent-new-comment-line
C-c C-k
toggle-comment-style
C-c C-l

electric. When →off, also supresses auto-newline
C-c C-a

auto-newline. When →on, also enables electric.
C-c .
c-set-style
(use Tab)
C-c :

inserting colon for C++
C-c C-\

backslash (EOL escape) region
C-c C-e

use preprocessor to expand macros in region