This commit is contained in:
Madeleine Sydney
2025-03-23 23:16:03 -06:00
parent c3c1359b4f
commit ef9943b707
22 changed files with 300 additions and 106 deletions

View File

@@ -0,0 +1,27 @@
;;; .yas-setup.el -*- lexical-binding: t; -*-
(require 'dash)
(require 's)
(defun snippet-bibtex--make-id ()
(let ((surname (--> (or (yas-field-value 2)
"surname")
(s-downcase it)
(string-to-list it)
(-take-while (lambda (x) (/= x ?,)) it)
(-filter (lambda (x) (not (memq x '(?- ?\s)))) it)
(apply #'string it)))
(year (--> (or (yas-field-value 3)
"1234")
(string-to-list it)
(-take-while (lambda (x) (<= ?0 x ?9)) it)
(apply #'string it)))
(keyword (or (-some--> (or (yas-field-value 1)
"keyword")
(s-downcase it)
(s-split-words it)
(-find (lambda (x)
(not (member x '("the" "on" "of" "a" "when"))))
it))
"keyword")))
(concat surname year keyword)))