Emacs Notes
August 2026
-- h2
Custom Config
I'm using emacs with a custom, hand-rolled
config. It's based mainly off
[these videos from the System Crafters
YouTube Channel](https://www.youtube.com/watch?v=74zOY-vgkyw&list=PLEoMzSkcN8oPH1au7H6B7bBJ4ZO7BXjSZ&index=1).
I used [Spacemacs](https://www.spacemacs.org/)
the first time I tried emacs. I started this run
with [Doom](https://en.wikipedia.org/wiki/Doom_Emacs),
but got frustrated with
some plugins fighing with each other.
So, I've jumped out to making my
own config.
These are the notes for how I've
got the environment set up. There's
also a bunch of notes in my config
files. I'll include them when
I figure out how I'm going to do
file inclusing from emacs.
-- list
-- h2: Evil Mode
- I'm using Evil mode to get Vim
keybindings for movement.
- My caps lock key is remapped
to escape so that it works the
way I'm used to in Vim mode.
- My Enter key (which is under
my left thumb on my moonlander)
is set to switch to a control
key when I hold it. That way
I don't have to stretch to use
my pinky for the control key
and can keep my caps lock
as escape for swithing vim modes.
-- list
-- h2: Cheatsheet
-- prelude: The main things to
remember to move around.
- {{SPC}}{{o}} - Search for an open a file in the
current project (via projectile).
- {{SPC}}{{p}}{{p}} - Switch projects
(via projectile).
- {{M-x}} - Type a function to execute.
- {{C-x}} - Open main function map.
- {{C-c}} - Open current user function map.
- {{C-h}} - Open help map.
- {{C+x}}{{C+e}} - Execute the current elisp function
in elisp files (e.g. ``init.el``).
- {{M-x}} ``check-parens`` -
Check that elisp parens are balanceed
-- list
-- h2: Leader Key
The leader key is set to {{SPC}}.
Basic things set up are:
- TBD
-- list
-- h2: Control Keys (via Enter)
-- prelude: These are control keys
that can be triggered by holding down
the Enter key on the moonlander.
- {{C-q}} - TBD (should not quit
since emacs will bascially be open
all the time.
- {{C+w}} - TODO: Save all files and
close the current buffer.
- {{C+e}} - TODO: Open the file explorer
tree.
- {{C+r}} - TODO: Run current block.
- {{C+t}} - TBD
- {{C-a}} - TBD
- {{C-s}} - Save all buffers
- {{C-d}} - Move one tab to the left
- {{C-f}} - Move one tab to the right
- {{C-g}} - TODO: Open grimoire
in whatever format that takes in emacs.
- {{C-z}} - TBD
- {{C-x}} - Main control key launch
- {{C-c}} - User control key launch
- {{C-v}} - TBD
- {{C-b}} - TBD
-- list
-- h2: Contorl Key (non-enter)
-- prelude: These are control keys
that require hitting the actual control
key since the hold-enter-for-control
only works on the left side
of the moonlander.
- {{C-h}} - Help
-- h2
Windows
-- details
-- label: Create a new horizontal (stacked) window
{{SPC}}{{w}}{{s}}
-- details
-- label: Cycle between windows
{{SPC}}{{w}}{{w}}
-- details
-- label: Navigate to window
{{C-w}}{{h}}
{{C-w}}{{j}}
{{C-w}}{{k}}
{{C-w}}{{l}}
-- h2
Fundamentals
-- details
-- label: Abort partially typed or executing command
{{C+x}}{{g}}
-- details
-- lable: Browser themes
{{C+h}}{{t}}
-- h2
File Operations
-- list
- Open a specific file:
{{C+x}}{{C-f}}
- Safe current file:
{{C-x}}{{C-s}}
- Save all files:
{{C-x}}{{s}}
- Undo
{{C-x}}{{u}}
{{C-/}}
- Change the current buffer
{{C+x}}{{b}}
- Kill a buffer
{{C+x}}{{k}}
- Write buffer to a specific file
{{C+x}}{{C+w}}
-- list
-- h2: Cursor Movement
- Looks like this jumps between
parts of the window if more than
one are opened:
{{C+x}}{{o}}
-- h2
Project Stuff
-- details
-- label: Add a new project to the list of known projects
{{Spc}}{{p}}{{a}}
NOTE: I'm curreing having to
restart emacs to pick up the
new project. I'm sure there's
a way to not have to do that.
I haven't looked into it yet.
-- details
-- label: Open a known project
{{Spc}}{{p}}{{p}}
-- details
-- label: Find a file in the current project
{{Spc}}{{Spc}}
-- details
-- label: Remove a known project from the list
{{Spc}}{{p}}{{r}}
-- h2
Treemacs
-- details
-- label: Open/Close Treemacs
TBD
-- details
-- label: Switch to Treemacs from open file
TBD
-- details
-- label: Open selected file
{{RET}}
-- details
-- label: Create a new file
{{c}}{{f}}
-- details
-- label: Create a new directory
{{c}}{{d}}
-- details
-- label: Delete selection (recursively)
{{d}}
-- details
-- label: Renmae the selected item
{{r}}
-- h2
Miscellaneous
-- details
-- label: Figure out what things set a particular variable
Get the details aboute variable with:
{{C-h}}{{v}} variable-name {{RET}}
This includes a list of triggers
when the varaible is set. (not sure
this covers everything or not)
-- details
-- label: Don't use Customize
The general guideline it to avoid using
the Customize package to manage things
and do things directly in the `config.el`
file. (This is from the [System Crafters
videos](https://www.youtube.com/@SystemCrafters)
and some other notes I've seen.)
-- details
-- label: Window management via evil
Look at {{C-w}}
in evil more for window controls.
-- details
-- label: Set up a hotkey
- Look at general.el
https://github.com/noctuid/general.el
see: https://www.youtube.com/live/xaZMwNELaJY?si=34Zt8-Nosnh-MfSZ&t=1108
OLDNOTES:
use ``global-set-key`` for global
stuff
and
``define-key`` for setting things
for a specific mode
For example:
(define-key emacs-lisp-mode-map (kbd "C-x M-t") 'load-theme)
You can then use
``global-unset-key`` to remove it if you're
just playing around.
-- details
-- label: List key bindings for a mode
Do:
{{C-h}}{v} MAP_NAME
e.g.
{{C-h}}{{v}} emacs-list-mode-map
-- details
-- label: Evaluate the current buffers
{{M-x}} eval-buffer
-- details
-- label: Evaluate a specific function
Go to the last paren of the function and do:
{{C-x}}{{C-e}}
-- details
-- label: Display the value of a variable
Use Eval:
{{M-:}} aka {{S-M-;}}
-- details
-- label: Remap a function to a new function
TODO: Look at this and check the syntax
([remap describe-function] . counsel-describe-function)
-- details
-- label: Turn on default emacs tabs
{{M-x}} global-tab-line-mode
-- details
-- label: Run a command
{{M-x}} COMMAND_NAME
If you want to see every command you can run, do
{{M-x}}{{TAB}}
-- details
-- label: Get a list of key bindings
{{M-x}} describe-bindings
-- details
-- label: Learn what a key combo does
{{M-x}} describe-key
-- details
-- label: Look up the state of a variable
{{C-h}}{{v}}
-- details
-- label: Find parenthesis issues
{{M-x}} check-parens
-- list
-- h2: Notes
- {{C-x}} is the prefix for all primary Emacs
bindings
- {{C-c}} generally bindings from the active
major mode, minor modes, and user bindings
- Basic open file {{C-x}}{{C-f}} for finding
a file
- Save the current buffer you're looking at
{{C-x}}{{C-s}}
- Save As (to write a buffer to a different
file location): {{C-x}}{{C-w}}
- {{C-x}}{{b}} is the basic way to switch
between buffers.
- {{C-x}}{{C-b}} opens list of open
buffers
- {{C-x}}{{left arrow}} and {{C-x}}{{right arrow}}
switch between buffers
- In the docs, "kill" is effectively "cut"
- {{C-SPC}} is how you mark regions (e.g. for
killing)
- {{C-w}} kills (cuts) the current selection
that can be pasted elsewhere. The killed
contents are put on the __kill ring__ which
contains all the stuff that has been
killed previous. (TODO: Figure out how
to keep passwords from being included
in this if necessary)
- {{C-y}} is for "yank" which is effectively
"paste" (it yanks from the kill ring)
- {{C-_}} is the default undo key combo
{{C-/}} is an alternate one.
- To redo, use {{C-g}} to reverse the
direction of the undo list and then
do {{C-_}} or {{C-/}} again. This will
keep working until you hit the end
of the undo chain, then it will
go back to undoing. (TODO: probably
find something that doesn't require
as much mental overhead for this)
- {{C-g}} is also how you stop
commands that are in progress
- You can do customization with
{{M-x}} customize. Or, do
it in your <> file.
- If emacs crashes there's a
{{M-x}} recover-this-file that you can
run on the file to get the unsaved
changes
- TODO: Look at command-log-mode for showing what
keys your pressing and what they run. Useful
for streaming but also maybe for figuring out
what you hit accidentally?
- You can use things like `doom-mode-line`
without having to do the rest of doom.
- Use `evil-commentary` for comment
functionality in evil mode
-- todo
[] Look at: https://www.youtube.com/live/INTu30BHZGk?si=ENcjLAXlZBJJG2pw&t=1151
for setting variables at a per directory level
and for doing things like setting up run commands