Skip to main content

Baty.net

A blog about everything by Jack Baty đź‘‹

Tag: Emacs

The Spark File

Ten years ago, Steven Johnson wrote The Spark File, in which he describes his process for keeping track of hunches, ideas, etc. in a single text file.

I, of course, thought this was a great idea and immediately started keeping my own spark file. It began in 2012 and I was reasonably consistent with it until 2016. After that, there was a lull, but it picked up again for a short time in 2021, after which I sort of forgot about it.

A fix for backlink display with Org-roam and Doom Emacs

I’ve been tracking an issue with the way backlinks are displayed that affects my use of Org-roam. Someone (hwiorn) finally discovered a workaround when using Doom Emacs: delete the compiled version of org-roam-utils. Like this:

rm .config/emacs/.local/straight/build-*/org-roam/org-roam-utils.elc

Now my links show up correctly. Finally! I’ll probably need to delete the file every time I sync or update but I don’t care as long as there’s a fix. It was driving me nuts.

Things I can’t quit, Film photography and Emacs

I know that film photography and Emacs are completely unrelated, but I have been thinking about both of them quite a lot recently.

Since moving back to shooting film in 2003, I have regular thoughts of switching to all-digital again. It’s just easier. I have rooms full of “stuff” in support of film photography, and things would become so much faster and easier without all of that. A nice digital camera, a good RAW editor, an inkjet printer, and some hard drives, and I’m all set.

Everything is in ~/org

The more notes I put into Org-roam, the more I want to put there.

My Org-roam directory has always been in ~/org/roam, meaning that my database was limited to files I put in that directory. The rest of my org files have been in ~/org, so they’re out of “reach” of Org-roam. Sometimes, though, I wanted link from, say, my Daybook.org file to one of my Org-roam files, thereby making that daybook entry part of my org-roam database.

Tagging deleted messages in Notmuch

I use Notmuch in Emacs for managing my email. It’s fast, powerful, and (once used to it) easy to use.

There are a few oddities I’ve learned to work around. The first is with deleting messages. The manual for Notmuch states:

Notmuch does not support, nor ever will, the deleting of messages

Notmuch manual

I’m ok with this, since Notmuch provides a way to essentially bury deleted messages using tags. I don’t necessarily need to actually delete the message file. Any message tagged with +deleted is hidden from searches unless explicitly included. Ignored tags are set in ~/.notmuch-config like so:

iA Writer vs Emacs

Emacs can be ugly, but it doesn’t have to be. Above we have the highly-polished and thoughtful iA Writer on the left and Emacs on the right.

I’m using Doom Emacs in “Zen” mode, which is basically a tweaked version of Writeroom-mode. My tweaks include using iA’s Quattro font as a variable-pitch font and a little spacing via line-spacing.

(add-hook 'writeroom-mode-hook (lambda () (setq line-spacing 0.5)))

iA Writer is wonderful for editing Markdown files. Might even be “nicer” overall than Emacs for that purpose. It’s just so smooth, you know? But, Emacs is Emacs and that’s tough to beat. I alternate between them. It helps that I’ve made them look similar.

Hiding File Permissions in Dired

Dired mode in Emacs is fantastic, but one little thing that annoyed me was that the directory listings show file ownership and permissions, taking up space with information I almost never care about.

I started down a rabbit hole of figuring out how to hide those columns. I spent wasted an hour on my way to discovering that, of course, there’s a built-in way to do it: dired-hide-details-mode.

Well, that was easy.

Publishing portions of my Org-roam database

I’m trying something new.

I’ve become a pretty heavy user of Org-roam for personal notes. I put nearly everything there now; technical notes, contact information, project notes, vendor info, etc. These notes are all nicely linked and backlinked and live in my main ~/org directory so I can easily find things right within Emacs.

A portion of these notes might be useful to other people. So I’m exporting the shareable notes from Org-roam as Hugo-compatible Markdown files. This turned out to be surprisingly easy. You can see the results at https://notes.baty.net and the details of how it works makes a good example.

Aligning comments in Emacs

I want my per-line code comments to line up nicely, so I’ll often add a bunch of spaces by hand to make things just so. I realized that, being Emacs, there must be an easier way to handle this. Of course there is.

Two minutes of searching revealed a short bit of lisp that does the job nicely:

;; Align comments in marked region
;; Via https://stackoverflow.com/a/20278032
(defun jab/align-comments (beginning end)
  "Align comments within marked region."
  (interactive "*r")
  (let (indent-tabs-mode align-to-tab-stop)
    (align-regexp beginning end (concat "\\(\\s-*\\)"
                                        (regexp-quote comment-start)))))

Here’s an example of what I was working on, with horribly un-aligned comments.