GNU bug report logs -
#78798
bibtex-font-lock-url-regexp should re-eval after setting bibtex-generate-url-list
Previous Next
Reported by: MAN ONE <pRoMMMModE <at> outlook.com>
Date: Sun, 15 Jun 2025 12:09:02 UTC
Severity: normal
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 78798 <at> debbugs.gnu.org (full text, mbox):
On Wed, Jul 02 2025, Eli Zaretskii wrote:
>> + :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]*")))))
Small thing: What is the purpose of the intermediate let-binding?
The elisp manual says about setfunctions:
If you specify this keyword, the variable’s documentation string
should describe how to do the same job in hand-written Lisp code,
either by invoking SETFUNCTION directly or by using ‘setopt’.
Isn't it then cleaner to define a helper function instead of using
a lambda expression?
>> -(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'.")
I was surprised when I tested the above that it sets
bibtex-font-lock-url-regexp even if the value of
bibtex-generate-url-list is defined outside defcustom, that is,
defcustom evaluates the above setfunction even when it ignores the
standard value for bibtex-generate-url-list. This is sensible,
but I did not find it documented anywhere.
This bug report was last modified 12 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.