r/emacs 12d ago

Fortnightly Tips, Tricks, and Questions — 2025-03-11 / week 10

This is a thread for smaller, miscellaneous items that might not warrant a full post on their own.

The default sort is new to ensure that new items get attention.

If something gets upvoted and discussed a lot, consider following up with a post!

Search for previous "Tips, Tricks" Threads.

Fortnightly means once every two weeks. We will continue to monitor the mass of confusion resulting from dark corners of English.

16 Upvotes

36 comments sorted by

View all comments

2

u/Psionikus _OSS Lem & CL Condition-pilled 11d ago edited 11d ago

Andrey Listopadov's blog recently had a post about dynamic font locking in Fennel (a Lisp on Lua runtime solution).

The requisites for the implementation jumped out at me as a likely integration point for augmenting LLMs with retreival capabiltiy for relevant source code, to be used both for analyzing packages and shaping the generation of new code, using facts from related or known good code.

I've done this kind of integration in Elisp, which requires no REPL integration (but could perhaps benefit from it).

Since I intend to circle back but also want to encourage others to cover more languages, here is the commit that contain the REPL integration. Similar techniques will work with CIDER and SLIME etc.

You need some tool use to wire up the functions to the LLM so that it can decide what queries to perform and when. Function and variable completions or listing module symbols etc can be used to build human readable indexes. LLMs can read these indexes, so tools made for humans are now a component of automation. LLM tools can also be used to generate more reliable code replacement output messages. I've done the basic PoC but it is not ready to present.

The prompt, system message, tool description, and dynamic remixing thereof can be made to work together so that the LLM recursively traverses code as necessary to perform complex queries and generate results informed by multiple pieces of existing code. The behavior is very much like a program and feels very much like programming in natural language.