From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#50241: flyspell doesn't work with multiple dictionaries Date: Sat, 28 Aug 2021 23:26:28 +0300 Message-ID: References: <581ffd00b0c4a0762689a423aff0ee13b5c85e52.camel@yandex.ru> <83lf4lmm8k.fsf@gnu.org> <83k0k5mked.fsf@gnu.org> <8658b0b457b9fc41624b454a0534013173de37ce.camel@yandex.ru> <65a1ecacc7ae808fc6fbc204094375604352c4aa.camel@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15925"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.40.4 Cc: 50241@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 28 22:27:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mK4v0-0003vS-Cd for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Aug 2021 22:27:10 +0200 Original-Received: from localhost ([::1]:44328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mK4uy-00089H-Vk for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Aug 2021 16:27:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mK4us-00088s-39 for bug-gnu-emacs@gnu.org; Sat, 28 Aug 2021 16:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mK4ur-0000zU-SB for bug-gnu-emacs@gnu.org; Sat, 28 Aug 2021 16:27:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mK4ur-0007sB-M1 for bug-gnu-emacs@gnu.org; Sat, 28 Aug 2021 16:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Aug 2021 20:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50241 X-GNU-PR-Package: emacs Original-Received: via spool by 50241-submit@debbugs.gnu.org id=B50241.163018240230236 (code B ref 50241); Sat, 28 Aug 2021 20:27:01 +0000 Original-Received: (at 50241) by debbugs.gnu.org; 28 Aug 2021 20:26:42 +0000 Original-Received: from localhost ([127.0.0.1]:55075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mK4uY-0007rb-5r for submit@debbugs.gnu.org; Sat, 28 Aug 2021 16:26:42 -0400 Original-Received: from forward105j.mail.yandex.net ([5.45.198.248]:52512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mK4uS-0007rK-Tm for 50241@debbugs.gnu.org; Sat, 28 Aug 2021 16:26:40 -0400 Original-Received: from sas1-934f36a1872d.qloud-c.yandex.net (sas1-934f36a1872d.qloud-c.yandex.net [IPv6:2a02:6b8:c14:492:0:640:934f:36a1]) by forward105j.mail.yandex.net (Yandex) with ESMTP id EA5CA4EC8782; Sat, 28 Aug 2021 23:26:29 +0300 (MSK) Original-Received: from sas1-f4dc5f2fc86f.qloud-c.yandex.net (sas1-f4dc5f2fc86f.qloud-c.yandex.net [2a02:6b8:c08:cb28:0:640:f4dc:5f2f]) by sas1-934f36a1872d.qloud-c.yandex.net (mxback/Yandex) with ESMTP id dkvEwnMpSC-QTIiassE; Sat, 28 Aug 2021 23:26:29 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1630182389; bh=BzpXHHPnrLmdydup76yKBqWYSHseEajbr1ZzWpN3nzI=; h=In-Reply-To:References:Date:To:From:Subject:Message-ID:Cc; b=CjTFtUgwIG+4MENY1SrvhEH/6wT3/uL0jydVT5BD6riV2WzMyDPx6VNPXhDFr23p1 vgTd5HJ/E9Ts1jmcjBqZOMXvnzQFMh6P91C+KoyazSnFipau74GCEVBqoxNa76nzY1 DWGwMiDrGbzTiDp2lLKwAzikoBOMut1GfGHi8Pgo= Authentication-Results: sas1-934f36a1872d.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by sas1-f4dc5f2fc86f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id Uf3Y2klC1Z-QTg0ZIZp; Sat, 28 Aug 2021 23:26:29 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:212899 Archived-At: On Sat, 2021-08-28 at 23:19 +0300, Konstantin Kharlamov wrote: > On Sat, 2021-08-28 at 23:02 +0300, Konstantin Kharlamov wrote: > > On Sat, 2021-08-28 at 22:45 +0300, Konstantin Kharlamov wrote: > > > On Sat, 2021-08-28 at 22:36 +0300, Eli Zaretskii wrote: > > > > > From: Konstantin Kharlamov > > > > > Cc: 50241@debbugs.gnu.org > > > > > Date: Sat, 28 Aug 2021 22:05:55 +0300 > > > > > > > > > > On Sat, 2021-08-28 at 21:56 +0300, Eli Zaretskii wrote: > > > > > > > > > > > > You miss this step at the end: > > > > > > > > > > > >   (ispell-change-dictionary "ru_RU,en_US") > > > > > > > > > > > > It tells Emacs to restart Hunspell with these two dictionaries. > > > > > > > > > > Thank you! Running this command results in error: > > > > > > > > > >         (error "Undefined dictionary: ru_RU,en_US") > > > > > > > > Strange.  Here, it doesn't error out.  I did this: > > > > > > > >   M-x flyspell-mode RET > > > >   M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > > > >   M-x ispell-change-dictionary RET ru_RU,en_US RET > > > > > > > > And I don't get any errors, and flyspell-mode works for both Russian > > > > and English. > > > > > > Thank you! With a little modification for steps to be: > > > > > >   M-x flyspell-mode RET > > >   M-: (setq ispell-program-name "hunspell") > > >   M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > > >   M-x ispell-change-dictionary RET ru_RU,en_US RET > > > > > > this worked for me! Hmm, let me try to experiment with that a bit to see > > > why > > > it > > > didn't work for me non-interactively… > > > > Okay, so the bug seems to be in ispell-hunspell-add-multi-dic function. When > > called interactively, then the following interactive call to (ispell-change- > > dictionary) has the ru_RU,en_US dictionary as a completion. However, if > > ispell-hunspell-add-multi-dic was called non-interactively, the completion > > from the subsequent (ispell-change-dictionary) call seems to be missing. > > > > Not sure though why the difference in behaviour, the "interactive" part of > > that function look innocent, simply (interactive "sPrompt"). Not sure what > > starting "s" means though. > > Okay, so, I figured there's some sort of odd cooperation between (ispell- > hunspell-add-multi-dic) and (ispell-change-dictionary) going on. > > When the first is called non-interactively, interactive call to the second > results in no completion for the new dict, right? So, the fun thing is that if > you abort prompt afterwards, then you call (ispell-hunspell-add-multi-dic) > again, and then you call (ispell-change-dictionary) interactively again, the > prompt will have the completion. > > It looks as if call to (ispell-change-dictionary) initializes some important > variable required by (ispell-hunspell-add-multi-dic) to function properly. …and, the function that needs to be called before (ispell-hunspell-add-multi-dic "ru_RU,en_US") is (ispell-valid-dictionary-list)