emacs-devel
[Top][All Lists]
Advanced

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

Re: jinx


From: Eli Zaretskii
Subject: Re: jinx
Date: Sat, 01 Apr 2023 14:54:25 +0300

> From: Augusto Stoffel <arstoffel@gmail.com>
> Cc: arash@gnu.org,  rms@gnu.org,  m.eliachevitch@posteo.de,
>   emacs-devel@gnu.org
> Date: Sat, 01 Apr 2023 13:39:40 +0200
> 
> On Sat,  1 Apr 2023 at 14:21, Eli Zaretskii wrote:
> 
> > If we pass START and END, why does the region have to be a single
> > "word"?
> 
> This is a tricky point.  The notion of "word", for spell checking
> purposes, is outside of the major mode's control.  For instance, some
> languages include the apostrophe or hyphen as a word char, some don't.
> 
> Passing START and END means that the major mode can use the information
> of how the spell-checker did the tokenization.  Typically, though, I
> expect most function will look only at START or END.
> 
> >  why not let the caller specify a larger region to be skipped?
> 
> Then the return value can't be a boolean; it has to be a list of
> regions, which is too complicated.

I'm afraid I don't quite follow.  I actually don't understand why we
need END here.  Why not call the function with some buffer position,
and let it return nil (meaning don't skip) or a buffer position, which
means skip until that position?

IOW, skipping text in at least some situation needs to skip multiple
words, perhaps even multiple lines, and the skip function should be
allowed to specify that in one go.  Right?

> >> (defun spelling-ignored-p (start end)
> >>   "Return non-nil if the word between START and END should not be spell 
> >> checked.
> >> See `spelling-ignore-functions' for information on how this is
> >> determined."
> >>   (save-excursion
> >
> > Why do we need save-excursion?
> 
> If we remove it here, then most spelling-ignore-functions will need to
> call save excursion on their own, which would probably be fine as well.

Yes, I don't think we should second-guess what those functions will
do.

> >> The above would go into a “neutral” place like simple.el.
> >
> > Why not ispell.el?  All the spelling functions use ispell.el anyway.
> > simple.el is preloaded, so having this there bloats every Emacs
> > session for no good reason, IMO.
> 
> jit-spell only uses ispell.el to start a process and jinx doesn't use it
> at all.

jinx is not in Emacs, so we don't have to solve its problems.  And
jit-spell uses ispell.el, so it will be able to use any function
there.

> To me it makes sense to untangle the spellchecking support API
> for major modes from any particular implementation.  But I guess this is
> not a major issue.

Not a major issue indeed, at least not yet.  If and when needed, we
could have a general spell.el file that would hold all the
spell-checking stuff not related to particular implementations.
Although in my mind ispell.el is such a "base-line" file already, as
every spelling feature basically uses some of its infrastructure.



reply via email to

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