Better bibtex URL highlighting and matching

This commit is contained in:
Alexander Rosenberg 2024-12-20 16:11:38 -08:00
parent b148423914
commit 190627d982
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

11
init.el
View File

@ -1379,6 +1379,17 @@ COMMAND and COMINT are like `compile'."
;; Bibtex (built in)
(require 'bibtex)
;; Better URL highlighting and matching
(dolist (field '("howpublished" "url"))
(add-to-list 'bibtex-generate-url-list
`((,field . ,(rx "http" (? "s") "://" (+ (not "}"))))
"%s"
(,field
,(rx (? (or "\\url{" "{")) (group "http" (? "s") "://"
(+ (not "}")))
(? "}"))
,(lambda (field)
(match-string 1 field))))))
(defun my/bibtex-in-entry-p (&optional exclude-braces)
"Return t is point is inside a BibTeX entry.
When EXCLUDE-BRACES is non-nil, don't count the first and last brace of the