unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Titus von der Malsburg <malsburg@posteo.de>
Cc: emacs-devel@gnu.org
Subject: Re: Changing dictionary while flyspell-buffer is running
Date: Thu, 21 Feb 2019 16:59:17 +0200	[thread overview]
Message-ID: <83y369fare.fsf@gnu.org> (raw)
In-Reply-To: <87h8cxsed3.fsf@posteo.de> (message from Titus von der Malsburg on Thu, 21 Feb 2019 10:03:04 +0100)

> From: Titus von der Malsburg <malsburg@posteo.de>
> Date: Thu, 21 Feb 2019 10:03:04 +0100
> 
> [Note: The last to message in this branch were off list.  My fault.]
> 
> On 2019-02-21 Thu 04:36, Eli Zaretskii wrote:
> > [Why personal email?]
> >
> >> From: Titus von der Malsburg <malsburg@posteo.de>
> >> Date: Wed, 20 Feb 2019 21:14:14 +0100
> >> 
> >> > Then why do you use flyspell-buffer and not flyspell-region, each time
> >> > starting the region from the word where you decided to switch to
> >> > another language?
> >> 
> >> That’s actually what happens when people just type: my package detects a
> >> new language and then just rechecks that paragraph.  However, some users
> >> of my package are used to doing flyspell-buffer on complete files, and
> >> when they do that, they don’t get the result they expect (which is that
> >> each paragraph is checked in its own language).  Checking a whole
> >> document with multiple languages does sound like a reasonable use case
> >> to me.
> >
> > Sorry, I still don't understand.  When the user runs flyspell-buffer,
> > and you find that the language was changed, invoke
> > ispell-change-dictionary and after that invoke flyspell-region to
> > continue spell-checking from that place to the end of the document.
> > Repeat as needed.  Wouldn't this algorithm work for your use case?
> 
> This algorithm does do the job, but when the language changes a lot in a
> document it would be inefficient.  Lets say you have 10 paragraphs, each
> in a different language, then you’d check the last paragraphs 10 times
> and only in the last pass with the correct language.  Guess-language was
> written primarily to facilitate work with such multilingual documents.
> (I’m a linguist.)  So that’s not a satisfying solution.

You don't have to end the region at the end of the document, you can
end it when your language guess changes.

> I can come up with a more efficient algorithm, no problem.  It’s just
> that it would be the easiest and most efficient solution, if I could
> just abort and restart spell-checking when a change in language is
> detected.  If flyspell doesn’t support this (aborting), tough luck.

Doesn't calling ispell-change-dictionary "abort" spell-checking
anyway?  If it doesn't, can you show a recipe to see this in action?

(I never use flyspell-buffer, so changing the dictionary is trivial,
and restarts the speller as side effect.)



  parent reply	other threads:[~2019-02-21 14:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y369fare.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=malsburg@posteo.de \
    /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.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).