Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts

Monday, December 01, 2025

Look at me, I'm an (LLM-assisted) Emacs Lisp developer now

Claude Code came out in February and I was hooked immediately. Luckily for me Anthropic introduced flat rate pricing plans very soon afterwards, or I'd have been bankrupted by pay-per-token prices by summer. I tried to channel all that newly-developed addiction to something productive, and decided to write, greenfield, some Emacs Lisp packages. I think such projects are perfectly-sized for working with Claude Code: for smaller tasks the regular chat interface worked fine (although now Claude Code handles those for me too), and for larger tasks one needs to start paying more attention to context management.

So I wrote three Emacs Lisp packages, all related to LLMs (yeah there is some infinite recursion going on here. I guess it all stops at the singularity):

All three packages have been published on MELPA (which is like npm registry, but for Elisp), and the first package (the library one) is surprisingly popular, with about 1,700 installs as of today.

Obviously I learned a lot about LLM-assisted development too but so far I am not planning to blog about that specifically, as things move faster than my ability to draft and publish and there are some very good guides out there.

Thursday, October 10, 2024

Emacs Projectile Tweaks for MySQL Development

I am using Emacs with Projectile (besides other packages) for MySQL development. Here's a couple of little tweaks to save a few keystrokes here and there:

  • Visit (which in Emacs parlance means open) the MTR test file, by its MTR name instead of file path:
;; This is a not a MySQL-specific implementation of `projectile-find-test-file'.
;; That function is meant for jumping from a source file to its test file.
;; TODO(laurynas): this is not an exhaustive implementation for all locations
;; test files can reside. Add them as the need arises.
(defun my-visit-mtr-test ()
  "Input MySQL MTR test name and visit it."
  (interactive)
  (let* ((input (read-string "MySQL MTR test name: "))
         ;; TODO(laurynas): error checking
         (parts (split-string input "\\."))
         (suite-name (car parts))
         (test-in-suite (concat "t/" (cadr parts) ".test"))
         (test-root (concat (projectile-project-root) "mysql-test/"))
         (file-path (if (string= suite-name "main")
                        (concat test-root test-in-suite)
                      (concat test-root "suite/" suite-name "/"
                              test-in-suite))))
    (find-file file-path)))

(define-key projectile-command-map "M" #'my-visit-mtr-test)

The last line binds this command to M in the Projectile command map, so if your Projectile keybinding prefix is C-c p (C is Ctrl in case non-Emacs users are still reading), you can do C-c p M to invoke it.

  • Register .test and .result files as "other file types" for each other. This way projectile-find-other-file (at e.g. C-c p a) can be used for quick jumping between tests and their results:
(add-to-list 'projectile-other-file-alist '("test" "result"))
(add-to-list 'projectile-other-file-alist '("result" "test"))

If I think of more utilities, I'll try not to forget to update this post.

Wednesday, October 28, 2020

My dotfiles

My dotfiles

I started using Emacs in 2001, and have been using it for two decades continuously, circumstances permitting (in 00s-early 10s Emacs support for Java and C++ was terrible). I have kept its configuration under source control since 2009.

All that time my Emacs knowledge was quite superficial, and the configuration was mostly copy-n-paste from various online bits. Two years ago I decided that I cannot afford not to know my main editor properly, and read its manual and Emacs Lisp reference cover to cover. I did not become an expert, but at least I got a map for the territory. This enabled me to make notes of and fix numerous long-standing annoyances instead of accepting them.

At the same time I started adding various work-related (MySQL back then, Aerospike now) utilities. Still later I started adding new system configuration notes for macOS and Linux, and untangled the whole mess with the help of GNU Stow.

Now I have added a README.md and so my dotfiles are in good enough shape to be public!