aboutsummaryrefslogtreecommitdiff

Table of Contents

#+AUTHOR Shoshin Shangreaux

1 A New Start

To welcome in Emacs 28 I intend to re-aquaint myself with the application and its ecosystem. I've been perusing the packages available through the default ELPA and non-gnu ELPA repos and trying to put together the various things that I've grown accustomed to.

However, with a beginner's mind, I've been trying to avoid going down the same old idiosyncratic paths. Courting a bit of discomfort in order to learn what newcomers might experience coming to Emacs in this current version.

1.1 Overview

This document is a journal, manual, and a program at once. I'm no expert at writing a document like this. If you happen to be reading it, the journal nature may be confusing. Over time, the journal will be incorporated into the bits that are a manual, solidified knowledge gained through the experience.

The program bits will be tangled into ./shoshimacs.el. As a program, it requires a certain structure from top to bottom. Here, the snippets may be scattered around. I'll attempt to have a system to keep them organized, but this is all an experiment.

The following code block is the "table of contents" that determines what is "tangled" into the resulting elisp file:

;;; shoshimacs.el --- Beginner's Mind Config -*- lexical-binding:t -*-
;;; Commentary:
;;; Personal configuration rewritten from basics.

;;; Code:

<<preamble>>

<<defvars>>

<<user-info>>

;;; Package Management
<<package-management>>

;;; Major Keybinding
<<keybinding>>

;;; Completion
<<completion>>

;;; Editing
<<editing>>

;;; Programming
<<programming>>

;;; Projects
<<projects>>

;; Applications
<<applications>>

;;; External Services
<<external-services>>

;;; User Interface
<<user-interface>>

(provide 'shoshimacs)
;;; shoshimacs.el ends here

1.2 User Info

(setq user-mail-address "shoshin@cicadas.surf")

1.3 Preamble

This section covers initialization that works best before anything else is configured. For example, it is much easier to manage the "custom variables" if they are not automatically tacked onto your initialization file. You can set and load a separate file to keep it clean:

(let ((my-custom-file (expand-file-name
                       "shoshimacs-custom.el" user-emacs-directory)))
  (unless (file-exists-p my-custom-file)
    (make-empty-file my-custom-file))
  (setq custom-file my-custom-file)
  (load custom-file))

1.3.1 shortcuts to this configuration document

I use a special variable to hold the path to this org file in its project directory (under version control), then two functions to quickly jump to it and reload it.

(defvar *my-config* "~/projects/shoshimacs/shoshimacs.org"
  "Path to my main configuration file.")

(defun my-configuration ()
  "Opens my configuration file in buffer."
  (interactive)
  (find-file *my-config*))

(defun my-reload-config ()
  "Tangles and reloads a literate config with `org-babel-load-file'."
  (interactive)
  (org-babel-load-file *my-config*))

1.3.2 using a hostname to tweak the config for different machines

I use this config on several machines. Using their individual hostnames, I can add conditional configuration for each of them as needed. As an example, I use a smaller font size on an older low-resolution laptop.

Turns out Emacs has the function system-name to do this. Unclear why I couldn't find it at the time I wrote the following function. I'm leaving it as a historical example of foolish Elisp hackery. I couldn't quickly figure out how to do it via Emacs itself, so I just shelled out to the hostname command (which is probably not going to work on every system)

(defun my-hostname ()
  "Helper function to determine on which host Emacs is starting."
  (string-trim (with-temp-buffer (shell-command "hostname" t) (buffer-string))))

2 Package Management

I've been using straight.el as my package manager since 2019 when I moved away from Spacemacs as my main configuration for day-to-day work. While I definitely recommend it as a flexible yet minimal package manager, it is targeted more to experienced Emacs users. In my opinion, the main benefit of something like straight is having all of the packages' source code cloned into local repos on your machine. This makes it easier to fix bugs and make contributions to the packages you're using.

(require 'package)

2.1 MELPA

This is one of the primary community archives. It is very exhaustive, primarily because it has been the easiest place to add packages. On the other hand, it is not hosted on a libre platform, though that could change in the future. Ever since I've started using Emacs over a decade ago, adding MELPA to the package archive list was one of the very first things to do. I'm coming back "full-circle" to use it again in this config after finally getting tired of needing to add/manage certain libraries manually that I could just get through the package manager.

(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)

2.2 Installing Packages

package.el provides the package-install command which can be used interactively or from Lisp code like this configuration. If a package is already installed, it won't try to install it again. When you install a package this way, Emacs will add its name to package-selected-packages. Packages will also not be upgraded when running a configuration that calls package-install.

M-x list-packages provides an interface to browse, install and upgrade packages as well. Often, I will try something out by installing it through this UI, and then add it to my config with package-install if I intend to keep it around.

I'll initialize the package functionality and refresh the contents to look for updates, and ensure any additional archives are fetched. this may have a startup impact, but i'm not concerned about that.

(package-initialize)
(package-refresh-contents)  ;; this will make internet requests on start up

2.3 Emacs 28 native compilation

elisp#Native Compilation

This is a new feature in Emacs 28 that will compile all of the Elisp as native machine code, rather than byte-code, which can result in major performance boosts. Compilation will happen in the background and is logged to the *Async-native-compile-log* buffer if you are curious. Mostly you shouldn't have to worry about it, though you may see some compilation warnings at times.

(require 'comp)
(setq native-comp-always-compile t
      package-native-compile t)

3 Keybinding

Keybindings are the key to playing Emacs like an instrument. no matter what you choose, keep in mind that you can always bind keys to your most commonly used commands to make things convienient.

I highly recommend creating a personal key map bound to a "leader key". You initiate it with the leader, and then bind following key sequences to commands you use. creating your own will make it easier to remember and keep organized.

3.1 xah-fly-keys

This is what I adopted to combat RSI. my muscle memory is tied into it tightly right now. you may have other opinions about keybindings

There's some oddity with some of the variables in the package when trying to lint/compile my init, so i'm declaring some of the special vars here too.

;; these need to be set before requiring the package
(defvar xah-fly-use-control-key)
(defvar xah-fly-use-meta-key)
(defvar xah-fly-leader-key-map)
(defvar xah-fly-command-map)
(setq xah-fly-use-control-key nil
      xah-fly-use-meta-key nil)
(package-install 'xah-fly-keys)
(require 'xah-fly-keys)
(xah-fly-keys-set-layout "qwerty")
(xah-fly-keys t)

i'm setting it up early in the config so that its keymaps are available to modify / integrate with other packages.

3.1.1 adding some custom commands to xah maps

  1. SPC 1 delete-other-windows

    i want this often, feels as if i'm constantly wanting that other window to go away.

    (define-key 'xah-fly-leader-key-map (kbd "1") #'delete-other-windows)
    

3.2 with-map-defkey

This is an experiment in learning to write Elisp macros, all with the result of being able to have a mini "dsl" to define keybindings in my personal (or any given) keymap. The only thing being a macro really does in this case is to avoid evaluating the pairs arguments. A tiny bit of ergonomics essentially avoiding some parens and quotes 😂

(defmacro with-map-defkey (keymap leader &rest pairs)
  "Define a new KEYMAP with prefix key LEADER and list of bindings PAIRS in it."
  (declare (indent 2))
  `(progn
     (defvar ,keymap (make-sparse-keymap))
     (define-prefix-command (quote ,keymap))
     (global-set-key (kbd ,leader) ,keymap)
     (mapc (lambda (pair)
             (define-key ,keymap
               (kbd (if (numberp (car pair)) (number-to-string (car pair))
                      (symbol-name (car pair))))
               (cadr pair)))
           (quote ,(seq-partition pairs 2)))))

(with-map-defkey my-key-map "M-m"
  1 delete-other-windows
  a apropos
  b consult-buffer
  c my-configuration
  d embark-act
  e eshell
  f find-file
  g magit
  h info
  i consult-imenu
  j helpful-function
  k helpful-variable
  n tab-next
  p project-prefix-map
  s consult-git-grep
  t consult-theme
  w which-key-mode
  z my-start-repl
  <f1> my-reload-config)

4 Completion

Completion is a huge part of my experience using Emacs. I have been on an evolving journey from the basic type of terminal tab completion to spaceship level UI implemented as a sub-application in Emacs.

This configuration is aiming at using a new crop of completion enhancements that tie into Emacs's native completion API. This is a more modular approach that allows a sort of composition of extensions to completion behavior and its appearance in the user interface.

4.1 Two kinds of completion

I want to point out that there are two distinct but similar features both grouped under the concept of "completion". The first is Minibuffer completion. Any time you use the minibuffer to enter commands or arguments, there is a completion system available to help you enter text there. The second is Buffer completion, offering candidates for text you are typing in any buffer. Code completion provided by a language server is one example. In vanilla Emacs, you get Symbol Completion for free, since Emacs itself is a running Lisp process with knowledge of all the defined symbols in the system.

I've been confused by this in the past, because the features are so similar. However, completing text in an arbitrary buffer really depends on context, and it is much more complex than completing commands and arguments that are appropriate to a specific situation.

4.2 Emacs completion styles

Emacs has a quite sophisticated way of selecting candidates for completion. You can read about them here: emacs#Completion Styles

I've grown used to the flex style of completion where typing pr/s/sho.o at the find file prompt expands to projects/shoshimacs/shoshin-config.org. There are other alternatives and you can even write your own. The completion-styles is a list of all the styles you'd like to use. It starts at the front, and if no matches are found, moves to the next style of completion. In this config, I just added flex to the front of the default completion styles.

4.2.1 Orderless

Orderless Manual

This package provides an ‘orderless’ completion style that divides the pattern into space-separated components, and matches candidates that match all of the components in any order. Each component can match in any one of several ways: literally, as a regexp, as an initialism, in the flex style, or as multiple word prefixes. By default, regexp and literal matches are enabled.

(package-install 'orderless)
(setq completion-styles '(orderless basic)
      completion-category-overrides '((file (styles basic partial-completion))))

4.2.2 Additional config

completion-cycle-threshold defines when you want to just cycle through alternatives on each <TAB> (or whatever key you use) rather than presenting options. Setting it to 3 means if my options are "FOO, FOP, FOR" or less, hitting complete will change FOO->FOP, FOP->FOR, FOR->FOO.

tab-always-indent changes the behavior of the TAB key:

If ‘complete’, TAB first tries to indent the current line, and if the line was already indented, then try to complete the thing at point.

(setq completion-cycle-threshold 3
      tab-always-indent 'complete)

4.3 consult - Consulting completing-read

consult offers enhanced completion similar to ivy and helm, but with the built in completing read functionality of the minibuffer.

(package-install 'consult)
(require 'consult)

main entry point would be consult-buffer. however, there are many consult commands that can enhance any completing read function.

4.3.1 "Virtual Buffers"

it introduces this concept of "Virtual Buffers", but i'm not certain what it means. consult "supports … narrowing to the virtual buffer types".

perhaps a Virtual Buffer is a "grouping" of actual Emacs buffers or "things" that can be materialized in a buffer. For example, I can consult-buffer and press m SPC to narrow the "buffer list" to any bookmarks.

4.3.2 consult keybindings

(global-set-key (kbd "C-x b") #'consult-buffer)
(define-key xah-fly-leader-key-map (kbd "f") #'consult-buffer)
(define-key xah-fly-command-map (kbd "n") #'consult-line)

4.3.3 consult-themes

i had a bit of a mess with it at first, because i'd implemented my own solution to a quirk of theme loading. enabling themes is additive, and can cause unexpected results. so i added advice to load-theme to automatically disable the old one before enabling the new.

it seems like consult-theme does this as well. additionally, as it will preview the theme as you are narrowing the selection. i did not expect this behavior and it got all kinds of wonky. the manual has a nice example of delaying the theme-switch-preview since it is slow. this way you can scroll / narrow your list of themes without the colors changing with every keypress.

(with-eval-after-load 'consult
  (consult-customize consult-theme :preview-key '(:debounce 0.5 any))
  (setq consult-themes my-chosen-themes))

I set a special list of my-chosen-themes but sometimes I want to turn it off. Its nice to have a filtered list most times, but sometimes I just want all of them in the consult-themes list.

(defun my-show-all-themes ()
  "Remove the selected themes from `consult-themes` so all installed themes will show."
  (interactive)
  (setq consult-themes nil))

4.3.4 TODO consult-project-buffer

how do project buffers get filtered? i'm seeing buffers assigned to a project that in my mind, shouldn't be.

looks like it interfaces with project-switch-to-buffer which has its own logic about which project a buffer belongs to. some of the mistakes i was seeing earlier were simply due to starting a repl in a particular directory.

it appears that "special" buffers may get assigned to a particular project as well. for example the EWW buffer is part of a project, but it is unclear as to why. appears likely to have to do with the behavior of the default-directory variable which is buffer-local.

i may want to figure out ways to mark "special" buffers as having a non-project default-directory set so they don't show up, or just filter them out if it becomes annoying. i'm accustomed to perspectives provided by a MELPA package that hooked into projectile's project definitions. it would keep a list of perspective-local buffers where the perspective was tied to a project.

4.4 embark

(package-install 'embark)
(package-install 'embark-consult)
(global-set-key (kbd "C-;") #'embark-act)
(setq prefix-help-command #'embark-prefix-help-command)

4.5 marginalia

(package-install 'marginalia)
(marginalia-mode)

4.6 vertico

(package-install 'vertico)
(setq minibuffer-prompt-properties
      '(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
(setq read-extended-command-predicate
      #'command-completion-default-include-p)
(setq enable-recursive-minibuffers t)
(vertico-mode)

4.6.1 vertico-directory

i'd like to emulate the behavior in find-file that i'm used to from Ivy. basically, when i press DEL it should act normally until i hit a directory boundary, then it should jump up a dir with the following press.

this is implemented with the vertico-directory extension.

(require 'vertico-directory)
(define-key vertico-map (kbd "RET") #'vertico-directory-enter)
(define-key vertico-map (kbd "DEL") #'vertico-directory-delete-char)
(define-key vertico-map (kbd "M-DEL") #'vertico-directory-delete-word)
(define-key vertico-map (kbd "M-j") #'vertico-quick-insert)

4.7 corfu

(package-install 'corfu)
(setq corfu-auto t
      corfu-cycle t
      corfu-quit-no-match t)
(global-corfu-mode t)

4.7.1 corfu-terminal enables in terminal interface

(package-install 'corfu-terminal)
(unless (display-graphic-p)
    (corfu-terminal-mode +1))

4.8 which-key

which-key is an excellent package that helps provide guide posts for command discoverability. many key commands in Emacs are in sequences. for example, org-babel-tangle is C-c C-v t. as a user, the commands you use often become muscle memory, or you map them to something more convienient. but sometimes you know there is some command to do what you want but you don't quite remember what the sequence is. or perhaps you're in a new major-mode and you know there must be several handy commands under C-c. which-key pops up a buffer with a listing of all the possible continuations from where you are in a key sequence. for that reason, it can be useful at times even for experienced users.

this config installs which-key, but does not activate it automatically. some advice from Daniel Mendler (consult author) suggested that limiting the amount Emacs pops things up automatically is a better user experience. which-key is just a toggle away when needed, and there is also embark which has a command to show prefix key continuations.

(package-install 'which-key)
(which-key-mode)

5 Editing

5.1 smartparens

Going back to smartparens for some of the paredit behavior I want, plus the paren balancing. We'll see how it goes

(package-install 'smartparens)
(require 'smartparens-config)
(smartparens-global-mode 1)
;(sp-local-pair 'sly-mrepl-mode "'" nil :actions nil)
(sp-local-pair 'slime-repl-mode "'" nil :actions nil)

5.2 markdown mode

(package-install 'markdown-mode)

5.3 org mode

5.3.1 capture

Org capture is a way to quickly get entries from various places into one of your org files.

(setq org-directory (expand-file-name "~/Nextcloud/org"))
(setq org-default-notes-file (concat org-directory "/notes.org"))

(setq org-capture-templates
    `(("p" "Protocol" entry (file+headline ,org-default-notes-file "Inbox")
       "* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
      ("L" "Protocol Link" entry (file+headline ,org-default-notes-file "Inbox")
       "* %? [[%:link][%:description]] \nCaptured On: %U")))

5.3.2 refile

(setq org-refile-use-outline-path t
      org-refile-allow-creating-parent-nodes t
      org-refile-targets '((nil . (:maxlevel . 2))))

5.3.3 jump to top level parent heading

a friend was wanting this functionality, so i dug around in the org functions to find one i could build a command out of:

(defun my-org-top-level-heading ()
  "Jump to the top level parent of an org subtree."
  (interactive)
  (let ((moo 1))
    (while moo (setq moo (org-up-heading-safe)))))

org-up-heading-safe is designed not to throw an error and returns the level of the headline found (as it goes up) or nil if no higher level is found. this just uses a dumb while loop to call it until it returns nil, which should get us where we are looking to go 😃

5.3.4 exporting

(with-eval-after-load 'org (require 'ox-md))
  1. htmilze

    this seems to be required to fontify source blocks

    (package-install 'htmlize)
    

5.3.5 babel

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (lisp . t)
   (org . t)
   (plantuml . t)
   (ruby . t)
   (shell . t)))

5.3.6 org-tree-slide

This is a simple presentation mode for org documents that uses narrowing to turn an org tree into slides. I've used it for many presentations, including some at EmacsConf. Its great for doing presentation run throughs, since you can edit at the same time you're using the slides.

(package-install 'org-tree-slide)

There are many settings for how it presents available, but I usually just set them on the fly, depending on the presentation, rather than in my main config.

5.3.7 Structure Templates

(add-to-list 'org-structure-template-alist '("se" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("sr" . "src ruby"))
(add-to-list 'org-structure-template-alist '("ss" . "src shell"))

5.4 recentf-mode

this tracks recently operated on files (by default) and enables quick selection from them in various Emacs menus. [BROKEN LINK: *\[\[info:consult#Top\]\[consult\]\] - Consulting \[\[info:elisp#Minibuffer Completion\]\[completing-read\]]] hooks into it as well.

(recentf-mode)

5.5 whitespace, tabs, and spaces

(setq-default indent-tabs-mode nil
            show-trailing-whitespace t)

5.6 crdt - buffer sharing

(package-install 'crdt)

6 Programming

6.1 Utilities

Adding a key binding to start an appropriate REPL for the current major mode.

(defun my-start-repl ()
  (interactive)
  (let ((mode-name (symbol-name major-mode)))
    (funcall
     (cond
      ((string-search "ruby" (print mode-name)) #'inf-ruby-console-auto)
      (t #'ielm)))))

6.2 Tree-sitter   emacs29

Mickey Peterson has a great article about getting started here.

https://www.masteringemacs.org/article/how-to-get-started-tree-sitter

6.2.1 Language grammars

(setq treesit-language-source-alist
 '((bash "https://github.com/tree-sitter/tree-sitter-bash")
   (css "https://github.com/tree-sitter/tree-sitter-css")
   (elisp "https://github.com/Wilfred/tree-sitter-elisp")
   (html "https://github.com/tree-sitter/tree-sitter-html")
   (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
   (json "https://github.com/tree-sitter/tree-sitter-json")
   (make "https://github.com/alemuller/tree-sitter-make")
   (markdown "https://github.com/ikatyang/tree-sitter-markdown")
   (yaml "https://github.com/ikatyang/tree-sitter-yaml")))

Run the following to install all the grammars in the list:

(mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist))

6.2.2 TODO TS-Modes

This is the quickest way to use the specific tree-sitter modes, though it is a bit of a hack. It would be nice to have a toggle back and forth in case something causes a problem.

(setq major-mode-remap-alist
 '((yaml-mode . yaml-ts-mode)
   (bash-mode . bash-ts-mode)
   (js2-mode . js-ts-mode)
   (json-mode . json-ts-mode)
   (css-mode . css-ts-mode)
   (ruby-mode . ruby-ts-mode)))

When adding hooks in this config, I will try to use the <lang>-base-mode which both inherit from. This way the hooks will apply either way.

6.3 Common Lisp

I primarily use SBCL, so I set it as the inferior-lisp-program

(setq inferior-lisp-program "sbcl")

6.3.1 SLY

(package-install 'sly)
  1. Sly Contribs
    (package-install 'sly-quicklisp)
    

6.4 Javascript

(package-install 'json-mode)

6.5 Ruby

6.5.1 Linting

The Emacs ruby-mode defines a backend for flymake, which use rubocop by default if it is available. If it isn't, it will try ruby -wc which will check syntax and warnings in the file. If a project is NOT using rubocop, or if it is say… running in a container, the flymake backend function will need to be hacked on a bit. A few config variables are available, primarily for rubocop.

ruby-flymake-use-rubocop-if-available t ruby-rubocop-config ".rubocop.yml"

(add-hook 'ruby-base-mode-hook #'flymake-mode)
  1. ERB Lint
    (package-install 'erblint)
    

6.5.2 inf-ruby

inf-ruby provides an interface to the various REPLs available in the Ruby-verse its currently provided by non-gnu ELPA:

(package-install 'inf-ruby)

(eval-after-load 'inf-ruby
  '(define-key inf-ruby-minor-mode-map
             (kbd "C-c C-s") 'inf-ruby-console-auto))

6.5.3 TODO minitest

this is a package i happen to maintain, and i would like to get it into non-gnu elpa.

(package-install 'minitest)

6.5.4 haml mode

(package-install 'haml-mode)

6.6 Dev Docs

(package-install 'devdocs)

6.7 Flymake

(with-eval-after-load 'flymake
  (define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
  (define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error))

6.8 PlantUML

(package-install 'plantuml-mode)
(customize-set-value 'plantuml-default-exec-mode 'executable)

6.9 Web mode

For mixed templates like ERB, HTML + CSS etc

(package-install 'web-mode)
(setq web-mode-code-indent-offset 2
      web-mode-indent-style 2
      web-mode-css-indent-offset 2
      web-mode-sql-indent-offset 2
      web-mode-markup-indent-offset 2)

7 Projects

7.1 project.el

project.el is the built in project management tool. previously, I've used projectile, which is great, but some of the more recent tools (like eglot) use the built in project.el api for their features.

I've got the project-prefix-map on the key p in my-key-map. Interestingly, in order to refer to a a prefix map with a quoted symbol like you would a command, the keymap must be in the symbol's function definition place. The project.el package doesn't do this, which is normally done with define-prefix-command (in my experience). In order to make this prefix map work correctly with the with-map-defkey macro, we set the symbol-function place on the project-prefix-map to be the value, the actual keymap structure, of the project-prefix-map symbol. 😵

(fset 'project-prefix-map project-prefix-map)

7.2 version control

7.2.1 magit

its the best! 🪄

(package-install 'magit)

8 Applications

8.1 Email / Mu & Mu4e

https://djcbsoftware.nl/code/mu/mu4e/index.html

  • Install mu from source
    • requires dependencies with package manager
  • install a program to get IMAP mail
    • isync / mbsync
  • install something to send mail SMTP
  • sync mail down
  • initialize mu index
  • configure emacs to use mu4e to read and send

8.1.1 With Homebrew on Macos / isync / mbsync / msmtp

homebrew will install it here in 2025

(add-to-list 'load-path "/opt/homebrew/share/emacs/site-lisp/mu4e")
(require 'mu4e)
(setq mu4e-get-mail-command "mbsync -a")

adding passwords to keychain

run something like this in the terminal on macos and enter the password to have it stored in the keychain for unlocking with the os.

security add-generic-password -s mu4e-migadu -a shoshin@cicadas.surf -w

sending mail with msmtp

(setq send-mail-function 'sendmail-send-it
      message-send-mail-function 'sendmail-send-it
      sendmail-program (executable-find "msmtp"))

8.2 EMMS

Emacs MultiMedia System.

(package-install 'emms)
(require 'emms-setup)
(emms-all)
(setq emms-player-list '(emms-player-mpv))
(setq emms-source-file-default-directory "~/Music/")
(add-to-list 'emms-tag-editor-tagfile-functions '("wav" . emms-tag-tracktag-file))
(add-to-list 'emms-player-mpv-parameters "--no-video")

8.3 erc

(setq erc-server "irc.libera.chat"
      erc-nick "shoshin"
      erc-autojoin-channels-alist '(("libera.chat" "#emacs" "#emacsconf" "#lispgames"))
      erc-interpret-mirc-color t
      erc-hide-list '("JOIN" "PART" "QUIT"))

8.4 dired

8.4.1 dirvish

(package-install 'dirvish)
(dirvish-override-dired-mode)

9 External Services

Packages that enable communication via HTTP or connect with external APIs or other resources outside of Emacs and/or the local machine.

9.1 Cicadas

Load the script that lets me connect to the cicadas.surf infrastructure

(setq cicadas-project-dir "~/code/projects/cicadas.org/")
(mapc (lambda (p) (load (concat cicadas-project-dir p)))
      '("cicadas-config.el" "foghorn.el" "cicatasks.el"))

9.2 plz - http library

this is an http library that intends to solve some of the "pain points" of url.el. i ran into some of them trying to download and install the Victor Mono font used by my configuration. the downside of plz is that it is dependent on curl, rather than being pure elisp. however, this is a non-issue for me, especially since my use case had devolved into using make-process to call wget and then implement a "callback" with a process sentinel. kinda neat, but maybe too much.

(package-install 'plz)

the sourcehut package in this config also depends on plz

9.3 sourcehut

there's a new package in GNU ELPA for some basic interaction with the sr.ht http api. i'm interested to try it out since i still pay for the account, plus the forge is free software and could be self-hosted if it comes to it.

it also depends on plz which is another new package providing a nicer API for HTTP requests.

(package-install 'srht)
(setq srht-username "shoshin")

an API token is stored in my .authinfo file.

9.3.1 email based commands - requires at least sendmail setup

(defun my-minitest-todo ()
  (interactive)
  (mu4e-compose-new "~shoshin/minitest-emacs@todo.sr.ht"))

9.4 restclient

(package-install 'restclient)

10 UI/UX

10.1 basic Emacs UI tweaks

(when (display-graphic-p)
  (scroll-bar-mode -1)
  (fringe-mode '(8 . 0))
  (menu-bar-mode -1)
  (tool-bar-mode -1))

10.2 darkroom - distraction free writing

the notes suggest using darkroom-tentative-mode which auto switches depending on the window layout currently in use.

(package-install 'darkroom)

10.3 Fonts

For code, I've grown fond of Victor Mono.

(defun my-use-large-font? ()
  (or (equal (system-name) "zebes")
      (equal (system-name) "ridley")
      (equal (system-name) "chozo.local")))

(let* ((size (if (my-use-large-font?) 16 12))
       (font (format "Victor Mono-%s" size)))
  (add-to-list 'default-frame-alist
               `(font . ,font)))

10.4 Highlights

10.4.1 global-hl-mode

i enjoy having the current line highighted as a visual cue.

(global-hl-line-mode t)

can be toggled with <leader> l 2

10.5 Themes

10.5.1 theme packages / installation

to keep it concise, i'll define a special variable to hold the theme packages i'd like to install anytime this config is loaded on a system where they are not there. then i can mapc #'package-install over the list of themes.

(defvar my-themes-to-install
  '(cyberpunk-theme dracula-theme ef-themes kaolin-themes modus-themes)
  "List of themes to install when loading shoshimacs config.")
(mapc #'package-install my-themes-to-install)

10.5.2 chosen theme list and random loading on init

i generally haven't used built-in themes much, but there's a few i like, and the ones i specifically install i'd like to keep in a list of "chosen" ones. i can load one at random if i please, and perhaps provide it as candidates to consult-themes.

(defvar my-chosen-themes
  '(cyberpunk dichromacy dracula leuven modus-operandi modus-vivendi
              nano-dark nano-light tango tango-dark
              ef-day ef-dark ef-light ef-night
              ef-autumn ef-spring ef-summer ef-winter
              ef-deuteranopia-dark ef-deuteranopia-light)
  "List of themes I prefer for narrowing and random selection.")

base16-still-alive

10.5.3 autothemer

autothemer is a dependency of some nice themes, and a great tool for theme development.

(package-install 'autothemer)

10.6 modeline

10.6.1 telephone line

(package-install 'telephone-line)
(setq telephone-line-lhs
      '((evil   . (telephone-line-evil-tag-segment))
        (accent . (telephone-line-vc-segment
                   telephone-line-erc-modified-channels-segment
                   telephone-line-process-segment))
        (nil    . (
                   ;; telephone-line-minor-mode-segment
                   telephone-line-buffer-segment))))
(setq telephone-line-rhs
      '((nil    . (telephone-line-misc-info-segment
                   telephone-line-flymake-segment))
        (accent . (telephone-line-major-mode-segment))
        (evil   . (telephone-line-airline-position-segment))))

(telephone-line-mode t)
(set-face-background 'telephone-line-evil-normal "deep pink")
(set-face-background 'telephone-line-evil-insert "Dark Turquoise")

10.7 SVG Screenshot

(defun screenshot-svg ()
  "Save a screenshot of the current frame as an SVG image.
Saves to a temp file and puts the filename in the kill ring."
  (interactive)
  (let* ((filename (make-temp-file "Emacs" nil ".svg"))
         (data (x-export-frames nil 'svg)))
    (with-temp-file filename
      (insert data))
    (kill-new filename)
    (message filename)))

10.8 windresize

(package-install 'windresize)

10.9 helpful

Helpful is a package that enhances the default Emacs help buffers. I'm remapping the xah fly keys that point at the corresponding describe- commands.

(package-install 'helpful)

(xah-fly--define-keys
 xah-fly-leader-key-map
 '(("h h" . helpful-callable)
   ("h k" . helpful-key)
   ("h n" . helpful-variable)
   ("h x" . helpful-command)))

10.10 sideline

This library provides the frontend UI to display information either on the left/right side of the buffer window.

  1. You would need to first set up the backends,

    (setq sideline-backends-left '(sideline-flycheck))

  2. Then enable the sideline in the target buffer,

    M-x sideline-mode

(package-install 'sideline)
(setq sideline-backends-left '(sideline-flymake))

10.10.1 sideline-flymake

Adds flymake messages to the sideline UI.

(package-install 'sideline-flymake)
(setq sideline-backends-left '(sideline-flymake))

Created: 2025-12-18 Thu 10:51

Validate