From: MAN ONE <[email-masked]>
Date: Wed, 2 Jul 2025 02:48:57 +0000

Hi, I made a small patch to resolve the bug, in my own testing it works so I would like to submit it.

-------------------------------------------------------------------------
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 2bef0573bed..5ed5e625b7e 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1495,7 +1495,16 @@ bibtex-generate-url-list
                                (choice (string :tag "Replacement")
                               (integer :tag "Sub-match")
                                        (function :tag "Filter")))))))
-  :risky t)
+  :risky t
+  :set (lambda (symbol value)
+         (set-default symbol value)
+         (let ((fields (delete-dups (mapcar #'caar bibtex-generate-url-list))))
+           (set-default-toplevel-value
+            'bibtex-font-lock-url-regexp
+            ;; Assume that field names begin at the beginning of a line.
+            (concat "^[ \t]*"
+                    (regexp-opt fields 'paren)
+                    "[ \t\n]*=[ \t\n]*")))))
 
 (defcustom bibtex-cite-matcher-alist
   '(("\\\\cite[ \t\n]*{\\([^}]+\\)}" . 1))
@@ -1838,11 +1847,7 @@ bibtex-font-lock-keywords
               bibtex-cite-matcher-alist))
   "Default expressions to highlight in BibTeX mode.")
 
-(defvar bibtex-font-lock-url-regexp
-  ;; Assume that field names begin at the beginning of a line.
-  (concat "^[ \t]*"
-          (regexp-opt (delete-dups (mapcar #'caar bibtex-generate-url-list)) t)
-          "[ \t\n]*=[ \t\n]*")
+(defvar bibtex-font-lock-url-regexp nil
   "Regexp for `bibtex-font-lock-url' derived from `bibtex-generate-url-list'.")
 
 (defvar bibtex-string-empty-key nil
------------------------------------------------------------------------------