Emacs and shellcheck #
Julia Evans had a great talk called Making Hard Things Easy. One of the takeaways for me was that I should be using tools for parts of a system I find hard to remember. In particular, when writing bash
scripts I should be using shellcheck
.
It turns out Emacs 29 has support for shellcheck
, and older versions of Emacs can use the flymake-shellcheck page.
To set it up in Emacs 29:
(use-package flymake :bind (("H-e" . flymake-show-project-diagnostics)) (use-package sh-script :hook (sh-mode . flymake-mode))
I use consult for navigating my errors, and I want to make errors more noticable in the mode line, so my flymake configuration is:
(use-package flymake :bind (("H-e" . my/consult-flymake-project)) :preface (defun my/consult-flymake-project () (interactive) (consult-flymake t)) :custom (flymake-suppress-zero-counters t) :config (defface my/flymake-modeline-error-echo '((t :inherit 'flymake-error-echo :background "red")) "Mode line flymake errors") (put 'flymake-error 'mode-line-face 'my/flymake-modeline-error-echo) (defface my/flymake-modeline-warning-echo '((t :inherit 'flymake-warning-echo :background "orange")) "Mode line flymake warnings") (put 'flymake-warning 'mode-line-face 'my/flymake-modeline-warning-echo))
It's too early to know what other tweaks I might want, but so far it's alerted me to several errors in my shell scripts.
Update: [2023-10-07] Comments on HN pointed to bash-language-server which works with emacs lsp or eglot.
Labels: emacs
Road Archaeology, part 2 #
In a previous post I showed some examples of how railroads influenced the shape of Interstate 5 in California. In this post I have some more examples of what I call "road archaeology". Looking at the present roads, we can make guesses about the past.
In Las Vegas the major casinos are along "The Strip". Just to the west of this is the interstate highway, I-15. What is the history here? My guess, following the patterns from the previous blog post, would be that "The Strip" was the original highway, and I-15 was built parallel to it. If you look through Historial Aerials you can see that this is indeed what happened. Here's the interactive map to browse:
Labels: transportation
Mac keyboard with hidutil #
[Updated 13-Apr-2023 with some of the background context and some things I learned from hackernews]
On my Mac, I've used KeyRemap4Macbook, Karabiner, Karabiner Elements, and FunctionFlip for some of my key remapping needs. The main things I want:
- On the laptop keyboard, some media keys should be function keys but other media keys should stay media keys. When using fn I want to get the other version of the key.
- On external keyboards, make the function keys act like the laptop keyboard.
- On external keyboards, the numpad should act like "numlock off". For example, 4 should be Left Arrow.
- On external keyboards, the Windows key should act as Option, and the Alt key should act as Command. This can usually be set in the System Preferences. (Except it doesn't work on one of my keyboards)
- I also use those same external keyboards with my Windows and Linux machines, so I prefer to make these changes through software rather than firmware.
Road Archaeology, part 1 #
While on road trips I notice sometimes there are places where a road will deviate from the path I expect it to take. I take a note of it and then investigate what happened there. Usually there's some geography or history involved. Take I-5 in Northern California for example. There's a straight segment from Dunnigan CA to Williams CA:
Labels: transportation
Emacs: marking text #
Although I primarily use Emacs, I love the idea of vim text objects, and wanted to incorporate them into my editing. The Kakoune introduction explains that vim uses verb first, noun second for its commands, whereas Kakoune uses noun first, verb second. I wrote a blog post about why I prefer noun-verb over verb-noun, not only in text editors but also in games and other applications.
Labels: emacs