I am a recent and happy user of BibTeX mode (bibtex.el
), but there is one thing I can't get to work as I wish. When I create a template, I can enforce insertion of timestamp and owner with:
(defun current-date ()
(format-time-string "%Y.%m.%d"))
(setq
bibtex-user-optional-fields '(
("timestamp" "Time the entry was created" current-date)
("owner" "Owner of the entry" user-login-name)
)
Is this possible to have the same behavior with bibtex-clean-entry
(C-c C-c
), which would automatically add the timestamp and the owner if they are not already set?
The rationale behind that is that I'm using biblio.el
for automatic download of references (e.g. via DOI), and I set it to run bibtex-clean-entry
right away with:
(setq biblio-cleanup-bibtex-function #'bibtex-clean-entry)
Being able to have the behavior described above for this function would actually save me a lot of time… and make sure I don't forget to add both fields.
(bibtex-end-of-entry)
which was actually moving out of the entry (right after to be precise). I also adapted tobibtex-add-date-owner
with a check and insertion ofuser-login-name
. – Mathieu Basille Dec 12 '18 at 04:43bibtex.el
. I just forwarded him your answer, maybe he'll be able to implement it directly inbibtex.el
. – Mathieu Basille Dec 12 '18 at 04:49bibtex-end-of-entry
as well. For me it works more consistently if I follow that with a(forward-char -1)
, which ensures thatdate_added
is the last field in the entry. – Tyler Dec 12 '18 at 15:06