emacs-orgmode
[Top][All Lists]
Advanced

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

Re: adding rules for flyspell


From: Ihor Radchenko
Subject: Re: adding rules for flyspell
Date: Wed, 31 May 2023 09:24:48 +0000

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> I use flyspell, and it looks like org-mode
> sets flyspell-generic-check-word-predicate to be org-mode-flyspell-verify.

Not directly. Rather we do

    (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify)
    
Then, flyspell uses this symbol value as the default value for
`flyspell-generic-check-word-predicate'.

> I have a few places I would like to augment this to avoid flyspell overlays
> in different places. In the past I have done this with around advice, which
> was ok for one rule, but less desirable for many rules.
>
> does anyone do anything clever here? I am currently making a list of
> predicate functions, and a generic function that runs each one, but I
> wondered if there was another approach. thanks.

AFAIK, there is no better interface provided by flyspell.
The most reliable approach I may think of is storing the value of
`flyspell-generic-check-word-predicate', and then replacing it with your
function that calls the previous value and then does more checking as
needed.

Looking into the docstring, I feel that flyspell could be changed to
accept a hook instead of a single function - the return values will fit
well into `run-hook-with-args-until-success'.

(defvar-local flyspell-generic-check-word-predicate nil
  "Function providing per-mode customization over which words are flyspelled.
Returns t to continue checking, nil otherwise.
Flyspell mode sets this variable to whatever is the `flyspell-mode-predicate'
property of the major mode name.")

This is something we can request from Emacs devs for future.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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