My Emacs settings - updated 2025
I inherited a set of brilliant Emacs settings from Magnar Sveen in 2019. That setup was geared towards Mac and Norwegian keyboard layout, and I tweaked parts of it towards US International keys and Linux.
In early 2025 the project with .emacs-d was rebooted when I decided I wanted to learn more about what goes into the configuration, and realise that I am most likely stuck with Emacs for life, due to Clojure being my main focus and Org-mode is my primary way of organizing myself.
This second time over I have also consulted and copied from Christian Johansen .emacs.d repo, according to what has been stated in the README.md
"I recommend starting with a blank emacs + Technomancy's better-defaults package, and then dig through this repo for useful nuggets, instead of forking it directly."
Feel free to clone or copy. Emacs is most recommendable, even though it can be very intrusive and dangerously addictive.
The first time you start emacs, it will install some additional packages that are best handled by the package manager.
- diminish
- dash
- datomic-snippets
- find-file-in-project
- browse-kill-ring
- expand-region
- jump-char
- smart-forward
- change-inner
- multifiles
- smex
In addition, make sure you have:
- cloned Technomancy's better-defaults
- Created a custom.el file
I have installed Emacs from source, using this guide Installing Emacs 29.1 on Ubuntu 22.04 LTS by Erik L. Arneson.
-
Quit emacs with
C-x r q
, mnemonic Really Quit is easier that Googling how to quit Vim. -
Find file in project with
C-x o
, in dir withC-x C-f
, recent withC-x f
-
Add your user- and project-specific stuff in .emacs.d/users/[machine name]/*.el
-
C-h
is rebound to backspace, like in the shell. Get help onF1
instead. -
Autocomplete with
C-.
(autocomplete entire lines withC-:
) -
expand-region: Find its bound key by doing
F1 f er/expand-region
-
Undo with
C-_
and redo withM-_
. Watch the undo-tree withC-x u
-
Quickly jump anywhere in the buffer withC-ø
then the starting letter of a word. -
Indent and clean up white space in the entire buffer with
C-c n
-
We recommend rebinding Caps Lock to Ctrl and use that instead of the often badly placed Ctrl-key.
C
Shorthand for the ctrl-keyM
Shorthand for the meta-key (bound to cmd on my mac settings)S
Shorthand for the shift-key
C-x C-f
Open a file. Starts in the current directoryC-x f
Open a recently visited fileC-x o
Open a file in the current project (based on .git ++)C-x C-s
Save this fileC-x C-w
Save as ...C-x C-j
Jump to this files' current directoryC-x b
Switch to another open file (buffer)C-x C-b
List all open files (buffers)
C-space
Start marking stuff. C-g to cancel.C-w
Cut (aka kill)C-k
Cut till end of lineM-w
CopyC-y
Paste (aka yank)M-y
Cycle last paste through previous killsC-x C-y
Choose what to paste from previous killsC-@
Mark stuff quickly. Press multiple times
C-g
Quit out of whatever mess you've gotten yourself intoM-x
Run a command by nameC-.
AutocompleteC-_
UndoM-_
RedoC-x u
Show the undo-treeC-x m
Open magit. It's a magical git interface for emacs
C-arrow
Move past words/paragraphsC-a
Go to start of lineC-e
Go to end of lineM-g M-g
Go to line numberC-x C-i
Go to symbolC-s
Search forward. PressC-s
again to go further.C-r
Search backward. PressC-r
again to go further.
C-x 0
Close this windowC-x 1
Close other windowsC-x 2
Split window horizontallyC-x 3
Split window verticallyS-arrow
Jump to window to the left/right/up/down
F1 t
Basic tutorialF1 k
Help for a keybindingF1 r
Emacs' extensive documentation
C-c j e j
copy-edn-as-jsonC-c j j e
copy-json-as-edn
- Warning (comp): perspective.el:2219:6: Warning: ‘ibuffer-awhen’ is an obsolete macro (as of 29.1); use ‘when-let’ instead.
- Warning (comp): paredit.el:714:33: Warning: ‘point-at-eol’ is an obsolete function (as of 29.1); use ‘line-end-position’ or ‘pos-eol’ instead.
- Warning (comp): paredit.el:723:42: Warning: ‘point-at-bol’ is an obsolete function (as of 29.1); use ‘line-beginning-position’ or ‘pos-bol’ instead.
- Warning (comp): datomic-snippets.el:87:48: Warning: reference to free variable ‘datomic-snippets-root’
- Warning (comp): datomic-snippets.el:90:6: Warning: ‘yas/load-directory’ is an obsolete function (as of yasnippet 0.8); use ‘yas-load-directory’ instead.