diff --git a/init.el b/init.el index 3e647b1..541d13d 100644 --- a/init.el +++ b/init.el @@ -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