Thanks. The attached patch for tex-fold.el does the trick, I believe.
>From f17134e2baaa385ed10c49436a73a636624b83a4 Mon Sep 17 00:00:00 2001
From: Paul Nelson <[email protected]>
Date: Sat, 26 Jul 2025 17:31:33 +0200
Subject: [PATCH] tex-fold: Generalize citation year folding
* tex-fold.el (TeX-fold--bib-abbrev-entry-at-point): Check both
"year" and "date" fields when extracting publication
year. (bug79076)
---
tex-fold.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tex-fold.el b/tex-fold.el
index 78e5b822..4daad455 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -786,7 +786,14 @@ publication year, or nil if author/year not found."
(when-let* ((case-fold-search t)
(entry (bibtex-parse-entry))
(author (bibtex-text-in-field "author" entry))
- (year (bibtex-text-in-field "year" entry))
+ (year (seq-some
+ (lambda (field)
+ (when-let* ((value (bibtex-text-in-field field entry)))
+ (save-match-data
+ (when (string-match "[[:digit:]]\\{4\\}" value)
+ (match-string 0 value)))))
+ '("year" "date")))
+ (year-XX (substring year -2))
(last-names
(mapcar #'TeX-fold--last-name (string-split author " and ")))
(last-names (seq-filter (lambda (name) (> (length name) 0))
@@ -797,8 +804,7 @@ publication year, or nil if author/year not found."
(substring (car last-names) 0 2)
(mapconcat (lambda (name)
(substring name 0 1))
- last-names)))
- (year-XX (when year (substring year -2))))
+ last-names))))
(concat initials year-XX)))
(defun TeX-fold--bib-entry (key files)
--
2.39.3 (Apple Git-145)
_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex