From 2052adecbcbbc62a18e9236387999be424dd8847 Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Sat, 11 Dec 2021 14:39:49 -0500 Subject: Allow forcing a key with bibtex/emacs --- .emacs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.emacs b/.emacs index 40ed9e7..3e0cd34 100644 --- a/.emacs +++ b/.emacs @@ -131,6 +131,10 @@ ("C-c C-c" . org-ref-clean-bibtex-entry) ("C-c s" . bibtex-sort-buffer)) :config + (defun my/bibtex-generate-autokey (autogenerated) + (let ((key (bibtex-autokey-get-field "_key"))) + (if (string= "" key) autogenerated key))) + (advice-add 'bibtex-generate-autokey :filter-return #'my/bibtex-generate-autokey) ;; stolen from bibtex.el and modified to handle "Mac Lane" (defun my/bibtex-autokey-demangle-name (fullname) "Get the last part from a well-formed FULLNAME and perform abbreviations." -- cgit v1.2.3