summaryrefslogtreecommitdiff
path: root/site/emacs.md
diff options
context:
space:
mode:
Diffstat (limited to 'site/emacs.md')
-rw-r--r--site/emacs.md77
1 files changed, 55 insertions, 22 deletions
diff --git a/site/emacs.md b/site/emacs.md
index 53c3999..ca8ad05 100644
--- a/site/emacs.md
+++ b/site/emacs.md
@@ -8,14 +8,17 @@
<p id="post-excerpt">
You know what the world needs more of? Random internet pages where
-some dude explains his Emacs setup. So here's another one!
+some dude writes about Emacs. So here's another one!
</p>
This is not so much about my Emacs setup. This is more about how I use
Emacs that happens to include some of my configuration as
well.<sidenote
name="init.el">[init.el](https://git.sr.ht/~laumann/dotfiles/tree/master/item/emacs.d/init.el)</sidenote>
-Generally, I try to keep my Emacs configuration as small as possible.
+
+Generally, I try to keep my Emacs configuration as small as possible
+and leverage all the built-in functionality and this write-up is about
+recording all the things I find really useful in Emacs.
</section><section>
@@ -25,25 +28,33 @@ I have written about writing code in a variable-with font
before<sidenote name="acme-update">[Taking Acme for a spin
(update)](/acme-editor-update.html)</sidenote> and this is still the
default setup. I used the Go fonts, but have switched to the
-Liberation Sans fonts. Sometimes, I switch to a monospace font and now
-I roll with Fira Code.<sidenote
+Liberation Sans fonts. Sometimes, I switch to a monospace font and
+when I do I roll with Fira Code.<sidenote
name="fira-code"><https://github.com/tonsky/FiraCode></sidenote>
+In terms of styling I now use the default Emacs theme. In the past I
+had settled on a slightly modified version of nofrils-acme<sidenote
+name="nofrils-acme"><https://gitlab.com/esessoms/nofrils-theme></sidenote>
+I also have nyan-mode<sidenote
+name="nyan-mode"><https://github.com/TeMPOraL/nyan-mode/></sidenote>
+just because it's cute. Aside from a handful of other minor UI
+modifications I use the defaults.
+
## Compilation mode
In short: compilation mode<sidenote
name="compilation-mode"><https://www.gnu.org/software/emacs/manual/html_node/emacs/Compilation-Mode.html></sidenote>
rules! During development, I tend to follow this pattern:
- 1. Set up a command with M-x compile. For example `make` or "dune
-build" or "dune build && ./run-tests"
+ 1. Set up a command with <kbd>M-x compile</kbd>. For example `make` or `dune
+build` or `dune build && ./run-tests`
2. <marginnote name="good-output">this only works if the compiler
produces error output with file names and line numbers</marginnote>If
-there is an error in the output, it's nicely highlighted and "M-g n"
+there is an error in the output, it's nicely highlighted and <kbd>M-g n</kbd>
takes me directly to the file and line with an error.
- 3. F9 is set up as a shortcut for M-x recompile, so repeating the
+ 3. <kbd>F9</kbd> is set up as a shortcut for <kbd>M-x recompile</kbd>, so repeating the
command is just one keystroke
The ability to jump from directly to file that needs attention without
@@ -66,10 +77,11 @@ happens works much better for me.
## Shells
-I also run shells in Emacs. I started with M-x shell, and have slowly
-graduated to invoking C-x p s, to get a shell for the current project
-(which tends to be a git repo). I have experimented with using Emacs
-shell but haven't so far found a compelling reason to use it.
+I also run shells in Emacs. I started with <kbd>M-x shell</kbd>, and
+have slowly graduated to invoking <kbd>C-x p s</kbd>, to get a shell
+for the current project (which tends to be a git repo). I have
+experimented with using Emacs' eshell but haven't so far found a
+compelling reason to use it.
Using a shell within Emacs has a couple of side effects: I tend not to
repeat commands when I need to inspect its output because I can just
@@ -116,13 +128,14 @@ environment.
I have settled on mu4e<sidenote
name="mu4e"><https://www.djcbsoftware.nl/code/mu/mu4e.html></sidenote>. It
-just works.
+just works. Fetching and indexing mail is done with isync<sidenote
+name="isync"><https://isync.sourceforge.io/></sidenote>
With mu4e I rely on the menu items for actions that I can never
remember the keybindings for. Attaching a file to an email is not
something I do often, so I don't have the shortcut memorised.
-## Package manager
+## Package management
Gentoo has a lot of app-emacs/ packages. I decided to use those
instead of the built-in package manager. Whether this is a good or bad
@@ -139,19 +152,39 @@ which is specific to writing Gentoo ebuilds.
## Man pages
Especially writing C code (also Hare), I've found that having man
-pages directly available in an Emacs buffer to be a big
-help. Recently, I've found that if the cursor is placed on a word,
-that word becomes the default suggestion: for example memcpy, then M-x
-man will suggest memcpy and all I have to do is hit Enter.
+pages directly available in an Emacs buffer to be a big help. If the
+cursor is placed on a word, that word becomes the default suggestion:
+for example memcpy, then <kbd>M-x man</kbd> will suggest memcpy and
+all I have to do is hit <kbd>RET</kbd>.
+
+## Window management
+
+I use tab bars<sidenote
+name="emacs-tabbars"><https://www.gnu.org/software/emacs/manual/html_node/emacs/Tab-Bars.html></sidenote>
+and generally have two tabs active - one for development and another
+for email. I have tried using multiple frames but found it difficult
+to manage.
+
+I create windows in the current tab with <kbd>C-x 3</kbd>
+(split-window-right) and <kbd>C-x 2</kbd>
+(split-window-below). Getting rid of windows in the current tab is
+either with <kbd>C-x 0</kbd> or <kbd/>C-x 1</kbd>
+I switch between windows with <kbd>C-x o</kbd> or just use the
+mouse to select a window. I have tried other packages that implement
+different ways of navigating windows and tabs, like ace-window, but
+none of them have stuck.
## Other tools
-I like browse-url and use it frequently (M-x br-u). I like ffap as
-well. I am _almost_ ready to rebind C-x C-f to ffap.
+I like browse-url and use it frequently (<kbd>M-x br-u</kbd>). I like ffap as
+well. I am _almost_ ready to rebind <kbd>C-x C-f</kbd> to ffap.
-I started using C-x p g to grep for words in the current project. I
+I started using <kbd>C-x p g</kbd> to grep for words in the current project. I
grep around in codebases quite frequently and xref provides a nice
-interface.
+interface. Emacs' builtin project awareness<sidenote
+name="emacs-projects"><https://www.gnu.org/software/emacs/manual/html_node/emacs/Projects.html></sidenote>
+provides a few other useful shortcuts that I don't use frequently, but
+I really should.
I try to use dired as much as I can, but often revert to browsing the
file system in the shell.