unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Changing dictionary while flyspell-buffer is running
@ 2019-02-19 22:58 Titus von der Malsburg
  2019-02-20 17:05 ` Eli Zaretskii
  2019-02-21  3:26 ` Richard Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: Titus von der Malsburg @ 2019-02-19 22:58 UTC (permalink / raw)
  To: emacs-devel


Hi,

I wrote a package called guess-language that automatically detects the
language of what is being typed and then switches dictionaries for
spell-checking as needed.  The code relies on
fylspell-incorrect-hook.  Whenever this hook is triggered (i.e. when an
unknown word is detected) the language of the current paragraph is
checked and if it’s different from the currently configured language, the
dictionary is changed and the paragraph is rechecked.  This works really
nicely, especially with documents that contain paragraphs in multiple
languages.

Link to package: https://github.com/tmalsburg/guess-language.el/

My question relates to flyspell-buffer.  When flyspell-buffer detects an
incorrect word, language guessing is activated via
fylspell-incorrect-hook but it’s not clear to me how to proceed next.  I
think I’d have to kill the running ispell/aspell/hunspell process and
restart with the new dictionary from where we left off.  Is there any
infrastructure in Flyspell that makes this relatively easy and safe?  I
had a look at the code and it seems that there is quite a bit of state
in various places, so it’s probably not just a matter of killing a
process, and doing things cleanly might require better understanding of
the internals than I have.  Any advice one how to approach this would be
appreciated.

Best wishes,

  Titus






--
Dr. Titus von der Malsburg
Department of Linguistics
University of Potsdam, Germany
https://tmalsburg.github.io



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-02-28 17:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-19 22:58 Changing dictionary while flyspell-buffer is running Titus von der Malsburg
2019-02-20 17:05 ` Eli Zaretskii
     [not found]   ` <87y36as44p.fsf@posteo.de>
     [not found]     ` <83o976gvd2.fsf@gnu.org>
     [not found]       ` <87h8cxsed3.fsf@posteo.de>
2019-02-21 14:59         ` Eli Zaretskii
2019-02-21  3:26 ` Richard Stallman
2019-02-21  3:46   ` Eli Zaretskii
2019-02-21  8:34     ` Titus von der Malsburg
2019-02-21 14:53       ` Eli Zaretskii
2019-02-21 19:42         ` Joost Kremers
2019-02-21 20:09           ` Eli Zaretskii
2019-02-21 21:19             ` Titus von der Malsburg
2019-02-22  7:10               ` Eli Zaretskii
2019-02-22  9:57                 ` Titus von der Malsburg
2019-02-22 10:32                   ` Eli Zaretskii
2019-02-23 15:24           ` Stefan Monnier
2019-02-21  8:29   ` Titus von der Malsburg
2019-02-21 13:12     ` Clément Pit-Claudel
2019-02-22  2:06     ` Richard Stallman
2019-02-22  9:27       ` Titus von der Malsburg
2019-02-28 12:36       ` Titus von der Malsburg
2019-02-28 17:50         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).