Notes on Emacs
While every now and then I try out other text editors, GNU Emacs is where my home appears to be. This page marks the entrypoint of my collection of notes on it.
Table of Contents
init.el
I like to configure my init.el with use-package. It
consists of a bunch of use-package declarations such as the following:
(use-package org
:ensure nil
:bind
("C-c a" . org-agenda)
("C-c c" . org-capture)
:config
(setopt
org-startup-indented nil
org-pretty-entities t
org-use-sub-superscripts nil
;; ... more options
)
:hook
;; (org-mode . variable-pitch-mode)
(org-mode . visual-line-mode)
(org-capture-mode . delete-other-windows))
A couple of notes
:ensure nilis for packages coming with emacs, so these don't need to be pulled from the elpa or melpa archives.- I use
setoptinstead ofsetq.setoptvalidates types and ensures setter functions associated to the option are executed. This makessetoptslower, but safer. Your mileage may vary.setopthas been available since Emacs 29.
org-mode
Prevent accidental deletions of folded text
I often use Ctrl-k, excuse me, C-k, to delete lines. When doing that
on folded text, org-mode by default removes all text in the fold.
So, after a couple of times of having deleted more text than I'd like
to admit, I came across these protective options that work like a boss:
(setopt
;; prevent edits of collapsed text
org-fold-catch-invisible-edits 'smart
;; prevent accidental deletion of collapsed tree with C-k
org-ctrl-k-protect-subtree t)
Some less destructive options
(setopt
org-pretty-entities t ;; render UTF-8 character instead of showing the character code
org-startup-with-inline-images t ;; show images by default
org-image-actual-width t ;; don't scale an inlined image by default
org-image-max-width 'window ;; but do cap the scale at the size of the window
org-image-align 'center ;; show images in the center of the window
)
visual-line-mode
See https://www.gnu.org/software/emacs/manual/html_node/emacs/Visual-Line-Mode.html
(use-package org
;; ...
:hook
(org-mode . visual-line-mode))
mu4e
When replying to a message sent to one of my alternative e-mail
addresses, I noticed mu4e set the From address to my
default e-mail address.
Turns out you need to let mu know about your alternative
addresses by specifying the --my-address option for each of your
e-mail addresses:
jochem@xiug ~ % mu init --maildir=~/Maildir.personal --my-address=primary@jkossen.nl --my-address=alternative1@jkossen.nl --my-address=alternative2@jkossen.nl
jochem@xiug ~ % mu index
indexing maildir /Users/jochem/Maildir.personal -> store /Users/jochem/.cache/mu/xapian
/ indexing messages; checked: 2019; updated/new: 2019; cleaned-up: 0
jochem@xiug ~ %