[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: jinx

From: Michael Eliachevitch
Subject: Re: jinx
Date: Mon, 03 Apr 2023 15:13:20 +0000

On 2023-04-03 at 17:26 +03, Eli Zaretskii <eliz@gnu.org> wrote:

From: Michael Heerdegen <michael_heerdegen@web.de>
Wasn't that the purpose of `flyspell-prog-mode'?

Markup languages are usually not descendants of prog-modes.

Or maybe I misunderstand what you are saying.

`flyspell-prog-mode' doesn't have any relation to prog-mode. It is a function 
(not really a mode) that enables flyspell-mode and sets the buffer-local 
variable `flyspell-generic-check-word-predicate'.

--8<---------------cut here---------------start------------->8---
 (defun flyspell-prog-mode ()
   "Turn on `flyspell-mode' for comments and strings."
   (setq flyspell-generic-check-word-predicate
   (flyspell-mode 1)
   (run-hooks 'flyspell-prog-mode-hook))
--8<---------------cut here---------------end--------------->8---

The function `flyspell-generic-progmode-verify' checks whether the face at 
point is a member of `flyspell-prog-text-faces'. By default it only checks 
comment and string faces, which is useful in programming modes. But 
flyspell-prog-mode can be used in any other mode as well 
`flyspell-prog-text-faces', and one can set `flyspell-prog-text-faces' 
buffer-locally via setq-local to e.g. only include non-markup. Though the 
flyspell documentation talks about it being for programming modes, so that 
seems to be a hack.

Until I read the code above today, I wasn't aware of 
`flyspell-generic-check-word-predicate', as it's not a defcustom-variable. It 
might serve as a customization entrypoint, i.e. one could bind it to a function 
that e.g. checks for include- and exclude-lists like jinx.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]