Posts

  • Tree-sitter Modes Still Need a Syntax Table

    When you write a tree-sitter major mode, it’s tempting to think the parser handles everything. It doesn’t. Tree-sitter drives font-lock, indentation, and structural navigation, but a whole layer of everyday Emacs behavior still runs on the humble syntax table: forward-sexp and friends, electric-pair-mode, delete-pair, forward-word, and anything built on syntax-ppss. (I wrote about that structural layer in Essential Structured Navigation and Editing Commands.)

    I got a sharp reminder of this while building neocaml, my tree-sitter mode for OCaml. The grammar parsed everything beautifully, yet delete-pair and sexp motion kept misbehaving around a couple of OCaml constructs. The fix turned out to be a classic tool that long predates tree-sitter: syntax-propertize-function. Here’s the story, since it’s useful knowledge for anyone writing a mode.

    Read More
  • Inline Completion with completion-preview-mode

    As part of the ongoing overhaul of my Emacs setup I’ve been trying to make the most of the built-in functionality that recent Emacs releases keep quietly shipping. My in-buffer completion setup is based on corfu and cape these days, but it turns out I had overlooked a nice Emacs 30 addition in the same area - completion-preview-mode. It gives you inline completion suggestions - the “ghost text” UI that GitHub Copilot and friends made famous1 - except here it’s powered by plain old Emacs completions.

    1. Unlike the AI assistants, the suggestions here come straight from your 

    Read More
  • All Aboard Embark!

    Yesterday I published a post about Jinx, where I mentioned in passing that dropping Flyspell freed up C-. and C-; for embark, and that this would be a topic for another article. Well, here it is!

    Embark has been around for quite a few years, and pretty much everyone in the vertico/consult crowd swears by it. Somehow I never got around to adopting it until my recent config overhaul, and now I keep asking myself why I waited so long.

    Read More
  • Cape: Corfu's Best Friend

    I’ve been using corfu for in-buffer completion for a while now and I’m quite happy with it. There was one thing that kept bugging me, though - the completion popup would only ever show whatever the current major mode’s completion function had to offer. No plain word completion, no file name completion - if the major mode (or your LSP server) didn’t know about something, neither did the popup.

    Turns out I was simply missing one piece of the puzzle, namely cape.

    Read More
  • Replacing Flyspell with Jinx

    I’ve been using flyspell-mode for the better part of two decades, and I’ve written about it a couple of times before. It gets the job done, but it has always felt a bit creaky to me - it checks words one at a time as you type, flyspell-buffer is painfully slow in big buffers, and you have to remember to enable flyspell-prog-mode in your programming modes, so it would check only comments and strings there.

    Recently, as part of the ongoing overhaul of my personal Emacs config, I finally replaced it with jinx and I can already tell you that I’m not going back.

    Read More

Subscribe via RSS | View Older Posts