summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil clingman <>2020-12-06 17:31:38 -0500
committertslil clingman <>2020-12-06 17:31:38 -0500
commit4862ce99b214d203bf4f883b84951529eba69e49 (patch)
treee45ccd7cf5354da61a7aac5dea93097761fb189d
parentc40b3f85906dd606ea25b19ece8712078abb594d (diff)
Quick entry about footnotes
-rw-r--r--log-201206-1.gmi30
1 files changed, 30 insertions, 0 deletions
diff --git a/log-201206-1.gmi b/log-201206-1.gmi
new file mode 100644
index 0000000..6904eaf
--- /dev/null
+++ b/log-201206-1.gmi
@@ -0,0 +1,30 @@
+Time-stamp: <2020-12-06 22h30 UTC>
+
+# Emacs + gemini ==> automatic footnotes
+
+Here's a snippet i found i needed to write after laboriously using `C-x 8 RET' for the umpteenth time to insert footnote markers. Throw it in your config, bind it to a something⁰ and enjoy! The code should more-or-less speak for itself, but to be sure:
+
+* it searches for the next free footnote symbol (as defined in `gemini-footnote-symbols')
+* it inserts that symbol at point (the cursor)
+* it goes to the end of the buffer and inserts the symbol, a space, and leaves you ready to write the footnote
+
+Actually, in the process of writing this article, i noticed a possibly unfortunate gap in the logic: it doesn't distinguish between verbatim blocks (```) and the rest of the body. I can't tell how i feel about this, for now though, WONTFIX :)
+
+```
+(defvar gemini-footnote-symbols '("⁰" "¹" "²" "³" "⁴" "⁵" "⁶" "⁷" "⁸" "⁹" "ᵃ" "ᵇ" "ᶜ" "ᵈ" "ᵉ" "ᶠ"))
+
+(defun gemini-insert-footnote ()
+ (interactive)
+ (let ((symb (car gemini-footnote-symbols))
+ (n 0))
+ (while (and symb (save-excursion (beginning-of-buffer) (search-forward symb nil t)))
+ (setq n (1+ n)
+ symb (nth n gemini-footnote-symbols)))
+ (if (not symb) (message "Ran out of footnote symbols. Customise `gemini-footnote-symbols'.")
+ (insert symb)
+ (end-of-buffer)
+ (unless (= (point) (point-at-bol)) (newline))
+ (insert symb " "))))
+```
+
+⁰ I have it bound to `C-c C-f' in gemini-mode.