;;; .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)))