emacs-devel
[Top][All Lists]
Advanced

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

Changing dictionary while flyspell-buffer is running


From: Titus von der Malsburg
Subject: Changing dictionary while flyspell-buffer is running
Date: Tue, 19 Feb 2019 23:58:19 +0100
User-agent: mu4e 1.1.0; emacs 26.1.91

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



reply via email to

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