bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#52331: M-$ doesn't respect subword mode


From: Eli Zaretskii
Subject: bug#52331: M-$ doesn't respect subword mode
Date: Mon, 06 Dec 2021 18:46:24 +0200

> From: André A. Gomes <andremegafone@gmail.com>
> Date: Mon, 06 Dec 2021 16:34:43 +0000
> Cc: 52331@debbugs.gnu.org
> 
> > $ emacs --batch --eval "(global-subword-mode)" --eval "(insert
> > \"getBanana\")" --eval "(ispell-word)"
> >
> > Expected output:
> > ...
> > BANANA is correct
> >
> > Expected output:
> > ...
> > Checking spelling of GETBANANA... 
> 
> Thank you for the bug report.
> 
> There's only one speller checker that handles camelCase (AFAIK), which
> is aspell since 0.60.8.  If you're using it, then you can add the
> following to your init file:
> 
> (setq ispell-extra-args '("--camel-case"))
> 
> However, and the Emacs maintainers will probably agree, the
> responsibility of sending the "right" word to the ispell sub-process
> should be on Emacs' side.  I.e., when subword-mode is on, there should
> be a call to word-at-point before sending it to the spell checker.

It's not that easy, unfortunately.  ispell.el has its own rules for
what is a word, and the rules aren't static, they are determined
dynamically by the definition of the dictionary. That's because of at
least 2 reasons: (1) the rules must match what the dictionary
considers a word, and (2) spell-checking is expected to work in
buffers that mix several languages, so the rules need to be sensitive
to the language of the dictionary and reject "words" whose letters are
not part of the language.

So perhaps a better approach is to teach subword-mode about the word
rules of ispell.el, not the other way around.  Patches welcome.





reply via email to

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