Posts

Simulating `C-u` args to lambda-wrapped functions

I build hydras for common functions in my use-pattern; sometimes it’s the C-u version that I want in my hydra. Usually this is easily done by passing a '(4) to the function. However, I have one fn that is failing at this: ("<f11>" (lambda () (interactive) (flyspell-correct-wrapper '(4))) "spell correct") ;; eval: Wrong number of arguments: (0 . 0), 1 The reason for this failure is that it turns out emacs has two ways of calling fns with prefix args.

Leveraging Clojure-power for SQL generation with HoneySQL

One of the most meaningful testaments to Clojure’s data-driven and lisp-powered design is the ability to use it to refine any of its transpiling processes, here SQL generation (elsewhere route generation, CSS generation, and of course its actual hosted languages, including Javascript or Java generation*). In this post I was tasked with refactoring a 3-arg function that reads from the database into a map-taking function that works with one, two, or three items in the map.

Quickly Creating DB namespaces with shell, emacs, and init.sql

My project design includes creating a file/namespace for each database table, with a suite of CRUD operations applying to each table. The end result is that I have functions like db.my-table/CREATE, READ, UPDATE, and DELETE available for each table. The strategy is as follows: Establish the template clj file that has all your CRUD operations Obtain all table names (e.g. from init.sql) Use a script to create a matching clj file based on template (1) customized to refer to the tables from (2) 1.

My Garden CSS has ascended

I’ve been continually seeking the answer to Garden CSS’s title question: “what’s possible when you trade a preprocessor for a programming language?” I have used Garden exclusively for years, happily wielding garden-gnome to implement hot-loading on my front-end for an excellent development experience. Writing CSS with Clojure data-structures is a hands-down win over raw css-writing, and Garden also gives useful shortcuts that some of the preprocessors also have like lighten, darken, & selectors, and more.

Scratch buffer

I have been deep in emacs for over a decade but still never utilized the scratch buffer until I saw how much it was part of the workflow of a friend. I’ve now fixed may ways and just needed a fast way to open it, optionally in a side Window. I wrote up this quick command and bound it to a convenient hydra key and now I have one-stroke scratch buffer opening.

A Gotcha: test.core/thrown?

https://clojureverse.org/t/a-gotcha-test-core-thrown/5595/1 Clojure is generally such a pristine and sensible language, it took me some debugging time to find out why this was failing: (is (let [proctorless-rmap {:tester (:id tester) :test (:id this-test)}] (thrown? Exception (xreg/register-for-exam proctorless-rmap)) "no proctor should fail")) ;; Unable to resolve symbol: thrown? in this context Trying to solve this at the repl, I was stumped for quite a while by why I couldn’t locate the thrown? function with C-c C-.

Building custom x11 cursors for Linux

I wanted to use the sort of Starcraft game cursors I enjoyed on my windows machine as a teenager, and this was my first thought of custom cursors in Linux. Note that I use EXWM as a low-level window manager, so these instructions should work for most any Linux system. Spoiler: I got it working, but it took a good deal of time that I hope you might be saved. Here is my story.

making Hugo Homepage a post listing

With a recent hugo upgrade on my machine, suddenly all my front-pages were links to my “posts” section and only one click later would you see what had correctly been my homepage previously. I received no help on Reddit or on the themes (which, some of which, unfortunately, are no longer maintained), so did some studying and got it back to working. Here is hoping this helps solve your issue.

Printing from the Command Line (and emacs)

Helpful Resource: https://www.cyberciti.biz/tips/linux-unix-sets-the-page-size-to-size.html Command Note lp print with good defaults lpc status all See printer settings lprm clear print jobs export PRINTER='Sharp-MX-2700N’ Set the target printer before printing lpoptions See available options I generally print PDFs, using the excellent pdf-tools. This provides C-c C-p which will print with the $PRINTER and settings you’ve configured, but sometimes you need more customization.

How to find the highlight face in emacs?

https://www.reddit.com/r/emacs/comments/fcernd/how_to_find_the_highlight_face_in_emacs/ The doom themes I try all have too un-obvious a background color for selected text – the text of future matches when doing an interactive search, or the highlight color of matches while I’m spell-checking, or the mark area when I am highlighting a section of text. I assume these are all the same face, because they look the same. Does anyone know which face this should be so I can customize it, and secondly, can tell me how I could figure out the answer to this question on my own without reading a lot of code?