I started using Emacs for the mu4e mail client after using and liking the mu mail indexer on the command line (read more about my mail client setup). Then I got curious about Org Mode and started using it for note taking and task management. I realised that configuring Emacs to my liking would be like second job, which I didn’t have the bandwidth for, so I started using the ‘distribution’ Doom Emacs. It enables Vim bindings everywhere with Evil Mode which, coming from Vim, made it much easier to get up to speed.
The Emacs philosophy is different from Vim‘s, it aims to be the ’everything program’. It is
it’s own operating system: a big Lisp machine distinct from the Unix
shell I’m used to working in. It’s much more configurable and extensible
than Vim – plugins are written in the same language that most of the
Editor is itself, Emacs Lisp. A small example of how this results in a
seamless experience; in Emacs I have vertico providing fuzzy
finding capabilities, which extends to built-in UI elements. For
example, M-x
will fuzzy match on commands
I can execute. In contrast, in Neovim I use telescope to
provide fuzzy searching which I have to invoke separately – I still have
the normal command prompt with :
but I can
fuzzy search commands with <leader>fq
with this binding:
vim.keymap.set('n', '<leader>fq', require('telescope.builtin').commands)
Neovim might be adding similar extensibility for fuzzy searching. It seems like with things like Evil mode and Neovim’s Lua-focused extensibility the two editors are moving towards each other somewhat.
Emacs can be slow and a bit unwieldy however, so I still use Vim sometimes, like for small edits on remote servers.
You can find my Doom Emacs configuration here.
Below are my working notes on learning and using Emacs. At the top are some open questions – please get in touch if you have an answer!
§TODO LSP from devshells
get lsp environment from nix devshell
§TODO how
§general
- C-b C-x list buffers
- C-b x open buffer
- help:
- variable C-h v
- function C-h f
- key C-h k
M-x
commandC-x C-e
/ (gr
in evil) evaluate expression selectedM-:
/ (SPC ;
in doom) evaluate expression from minibuffer- key binding conventions
kmacro-edit-macro
to edit recorded macro
§email / mu4e
m
move maila v
open in firefoxC
composeR/W/F/C/E
reply/reply-to-all/forward/compose/edit(draft)Pr
toggle property- Ptr mu4e-include-related
e
extract attachments- ~/.mailcap for external openers
A
for more options
- blue/yellow in header view mu4e-unread-face mu4e-flagged-face
- exit composer
ZZ / C-c C-c
send messageZD / C-c C-d
save to drafts and leaveZF attach
ZQ / C-c C-k
kill the message buffer (the message remains in the draft folder)ZA / C-c C-a
attach a file (pro-tip: drag & drop works as well in graphical context)C-c C-;
switch the context
- disable include relevant by default
- how to add a filter to a maildir
- mu4e-search-narrow
/
with evil-collection, and\
to undo - similarly mark pattern
- mu4e-search-narrow
- how to open URL with keyboard shortcut?
shr-browse-url
RET
browse-url-at-point
M-RET
mu4e--view-browse-url-from-binding
gx
cw
wide reply in message view with evil modeM-q
format paragraph.
view headers- how to switch message from plaintext to html with a keyboard shortcut?
- custom account completition?
§doom macs
SPC h b t
which key show all bindingsC-h
in which key to search bindingsSPC h v
help variablesSPC h o
help symbolK
helpgd
go to definition- map!
SPC f s
save fileSPC TAB
workspacesSPC b
buffersSPC s
searchgr
evaluate lispSPC g g
magitSPC o m
mu4eSPC o t
terminalSPC q s
/SPC q l
save / load sessionSPC p f
file in project- in minibuffer
C-s
searches history SPC p p
opens project in new workspace- jumplist
C-i
/C-o
not working in terminal?- terminal can’t distinguish between Tab and C-i
- https://github.com/doomemacs/doomemacs/issues/8101
- Why does the help menu not stay opening when switching windows?
- Doom’s popup window implementation
- How to get into normal mode in emacs minibuffers?
(setq evil-collection-setup-minibuffer t)
- how to edit properties in org mode?
SPC m o
- how to see org mode agenda?
SPC o a
- query-replace / query-replace-regex?
M-`
does menu barC-~
make popup real windowSPC h w
where-is commandS
evil-surround- spell checker
§org-mode
§time prompt
-
to look at past day, e.g.-sun
§bindings
org mode key bindings
M-ret
add entryM-S-ret
todo entryTAB
/S-TAB
- NB
S-TAB
is bound toorg-shifttab
instead oforg-global-cycle
- NB
M-LEFT
/M-RIGHT
/M-UP
/M-DOWN
/M-S-LEFT
/M-S-RIGHT
org-metaRET
open link
-
<<
/>>
org-metavae
/vaR
[ h
/] h
gj
/gk
/gh
/gl
S-UP
/S-DOWN
prev / next item in list
-
zc
/zo
/zO
SPC m h
(SPC m *
) /SPC m i
toggle heading / itemSPC m d t
/ org-time-stampSPC m s S
subtree sortSPC m s s
subtree sparseSPC m x
toggle checkboxSPC u SPC m x
add checkboxSPC m +
/S-LEFT
/S-RIGHT
cycle checkboxesSPC n l
store link e.g. in email / mu4eSPC m l l
insert linkC-c RET
insert headingC-M-RET
insert subheading https://github.com/doomemacs/doomemacs/issues/3306M-S-RET
insert todo headingSPC m t
/S-LEFT
/S-RIGHT
TODOSPC m q
/C-c C-c
(on heading) set tagC-c \
org-match-sparse-tree on tagsSPC m o
set propertyC-c C-c
on property property actionC-c .
/SPC m d t
/SPC m d T
org timestampSPC u SPC m d t
for date time
SPC m c
clock commandsTAB
see drawerSPC m s r
refileSPC m r R
refile reverseSPC X
captureSPC m A
archiveSPC m s a
archive tagSPC m a
attachmentSPC u 3 TAB
show 3 level deep headings
§scripting
#+begin_src python
a = [ 1, 2, 3 ]
return a
#+end_src
#+RESULTS:
| 1 | 2 | 3 |
evaluate with RET
§agenda
- how to exclude LOOP todo items from the todo list?
org-agenda-filter-by-category
/sc
/\
on line - how to filter by tag?
org-agenda-filter-by-tag
/st
/<
gD
select time range
§how to do bibtex citations?
- biblio doom module
org-cite-insert
citar-open-notes
§HOLD org-caldav
- https://github.com/dengste/org-caldav/issues/322
- basically, we need a good CLI caldav client
- the mu to mu4e
- but I don’t want to do it
- maybe https://github.com/BartSte/khalorg is promising
§latex
- got a project compiling using doom emacs latex module which pulls in AUCTeX)
- even got a synctex working back and forth with SPC m v and Ctrl+click in evince
- TODO figure out how to use internal pdf viewer (seems like +latex/viewers isn’t respected)
- TODO figure out how to get SPC m v working from another tex file (seems like the master file detection is off)
- may find answers in https://elpa.gnu.org/packages/doc/auctex.html or https://github.com/doomemacs/doomemacs/tree/master/modules/lang/latex
- pdf viewer search highlight https://github.com/vedang/pdf-tools/issues/162
§android
Using doom-emacs in Android Emacs
§ledger-mode
[[
/]]
next / prev transactionSPC m a
xactTAB
completionSPC m t
clearSPC m R
reconciliationTAB
mark transaction cleared (in reconciliation)
§magit
SPC g C
git clone
§how to act on all search matches
- embark-collect (SPC a S)