From: Ihor Radchenko <yantar92@posteo.net>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: Emacs Orgmode <emacs-orgmode@gnu.org>
Subject: Re: adding rules for flyspell
Date: Wed, 31 May 2023 09:24:48 +0000 [thread overview]
Message-ID: <87wn0on99b.fsf@localhost> (raw)
In-Reply-To: <CALEYq09EGPFrihQP5akCwCvu02Z9Zcb5X3y9Wuooek+-bkrSvg@mail.gmail.com>
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>
prev parent reply other threads:[~2023-05-31 9:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 18:57 adding rules for flyspell John Kitchin
2023-05-31 9:24 ` Ihor Radchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wn0on99b.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=jkitchin@andrew.cmu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).