bug#81638: 32.0.50; flyspell-prog-text-faces type and semantics

Eli Zaretskii <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
> Date: Mon, 17 Aug 2026 03:45:56 +0200
> From: Michael Heerdegen via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email protected]>
> 
> when editing .tex files having nil in `flyspell-prog-text-faces' is
> useful (even necessary) for flyspell-prog-mode doing its job.
> 
> But when using `setopt' (via file variable!) Emacs barfs about the type
> not matching.  The type spec of the option is much too restrictive IMO:
> 
> #+begin_src emacs-lisp
> (defcustom flyspell-prog-text-faces
>   '(font-lock-string-face font-lock-comment-face font-lock-doc-face)
>   "Faces corresponding to text in programming-mode buffers."
>   :type '(set (const font-lock-string-face)
>               (const font-lock-comment-face)
>               (const font-lock-doc-face))
>   :version "28.1")
> #+end_src
> 
> It limits the value to a subset of three given hardcoded builtin faces.

Because flyspell-prog-text-faces is supposed to spell-check the
corresponding portions of the program's source.

How is flyspell-prog-mode useful if you set that variable to nil?
doesn't that basically make flyspell-prog-mode identical to
flyspell-mode?

Also, if you want to tweak flyspell-prog-mode this way, why not use
setq instead of setopt?  That option doesn't have any :set function,
so the only reason to use setopt is to check the validity of the
value, which you don't like, so...

And if all of the above is not enough, and you still insist, I could
agree to adding nil to the valid values (but then please suggest a
suitable :tag), but allowing any symbol is IMO too dangerous,
especially as we use cl-flet there.  Next we will hear from someone
reporting a vulnerability in Emacs.

> But I wonder if we should, in addition, generalize
> `flyspell-generic-progmode-verify' so that members of
> `flyspell-prog-text-faces' are allowed to be functions (test
> predicates).

If you want to do that, it is better (and easier) to override
flyspell-generic-progmode-verify with your own function.

Finally, I'd like to hear Stefan's and Sean's opinions on this.

Thanks.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.