John Kitchin has a new video up on his Scimax Channel. The video’s theme is Ivy’s completion mechanism. It doesn’t seem like there would be a lot to say but, of course, there’s plenty. Kitchin begins by explaining completing-read
, a way of choosing among several alternatives for, say, a file to open. The completing read
function is built into Emacs and is always available but you can substitute your own function for the built-in one to provide more or better functionality. That’s what Ido, Helm, and Ivy, for example, do.
Kitchin compares the default completing read action to that of Ivy’s. Ivy’s is much more convenient and you get it just by installing and enabling Ivy. But wait! There’s more. With Ivy, you can specify one or more actions to be performed on the choice. You can, of course, do that outside of Ivy but Ivy’s mechanism is simpler and abstracts away much of the boilerplate that you’d otherwise need.
Kitchin spends much of the video considering implementations of one of his important use cases. As you doubtless know, Kitchin is a researcher and academic so he has a huge bibliographic database. Each entry has a keyword to be used in the citation. The problem is it’s hard to remember the correct keyword—they’re long and complicated and may not offer a hint to the citation you’re looking for.
The video offers a series of implementations of Kitchin’s “choose citation” function that iterates towards a solution that meets his needs. Along the way, you learn a lot about Ivy’s completing read and how to use it.
The video is just short of 36 minutes so you’ll definitely need to schedule some time but it’s very worthwhile. It will teach you a lot about Ivy’s completing read implementation.