Re: adding rules for flyspell

2023-05-31 Thread Ihor Radchenko
John Kitchin  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 .
Support Org development at ,
or support my work at 



adding rules for flyspell

2023-05-30 Thread John Kitchin
I use flyspell, and it looks like org-mode
sets flyspell-generic-check-word-predicate to be org-mode-flyspell-verify.

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.

-- 
John

---
Professor John Kitchin (he/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
https://kitchingroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/ pycse bookstore