* adding rules for flyspell
@ 2023-05-30 18:57 John Kitchin
2023-05-31 9:24 ` Ihor Radchenko
0 siblings, 1 reply; 2+ messages in thread
From: John Kitchin @ 2023-05-30 18:57 UTC (permalink / raw)
To: Emacs Orgmode
[-- Attachment #1: Type: text/plain, Size: 797 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1215 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: adding rules for flyspell
2023-05-30 18:57 adding rules for flyspell John Kitchin
@ 2023-05-31 9:24 ` Ihor Radchenko
0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-05-31 9:24 UTC (permalink / raw)
To: John Kitchin; +Cc: Emacs Orgmode
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-31 9:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30 18:57 adding rules for flyspell John Kitchin
2023-05-31 9:24 ` Ihor Radchenko
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).