For those who remember, the combination of AUCTeX and Eglot makes me happy.1 And those with even better memory surely recall me mentioning BibLaTeX for my footnotes. The thing with footnotes, though, is that having beautiful, automatic completion for my bibliography is only half of the story. The other half is leveraging yet another great package from the unstoppable Daniel Mendler: Tempel.2

As usual with Daniel, the README is full of details, so there is little for me to add. Following the documentation, I have M-+ bound to tempel-complete and then I have few templates for things like clojure-mode, emacs-lisp-mode, and haskell-mode in an aptly named templates file. I also have the following for latex-mode:

(footnote "\\footnote{" p ".}")
(texcite "\\textcite{" p "}")

It may look like trivial stuff, I know, but this is all it takes to insert a footnote:

  • Hit M-+
  • Pick footnote
  • If no bibliographical entry is needed, type the desired text
  • Otherwise, hit M-+ again
  • Pick textcite
  • Let Corfu powered by Digestif offer the required bibliographical entry

Trust me, it’s a quick manoeuvre once you get used to it. It’s also a bit cumbersome, if you ask me. Daniel must know me better than I know myself because Tempel already provides a simpler option, namely the tempel-key macro.

(with-eval-after-load 'tex
  (tempel-key "C-c t f" footnote TeX-mode-map)
  (tempel-key "C-c t t" texcite TeX-mode-map))

Now with few key strokes and AUCTeX doing the rest of the heavy lifting I can safely focus on the content of my document without worrying about the footnotes.

Note that tempel-key sort of fixes a small issue with tempel-complete. When I hit M-+ right after the last letter of a word, I get a message saying tempel--interactive: tempel-complete: No completions. To avoid this unpleasant behaviour either I add an extra whitespace character to be removed after the footnote is ready, or I use tempel-key. The better alternative is obvious.

A final warning: the most recent version of Digestif introduced a problem with completion-at-point and Xref, which I reported on the bug tracker.3 For now it’s possible to work around the issue by using commit f1b4202 as I wrote over there.4