From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#69703: Ispell process restarted too often Date: Tue, 12 Mar 2024 09:45:14 +0200 Organization: LINKOV.NET Message-ID: <867ci7rj05.fsf@mail.linkov.net> References: <86y1aqh70o.fsf@mail.linkov.net> <86bk7mwlwl.fsf@gnu.org> <867cia3z7x.fsf@mail.linkov.net> <86sf0yug9z.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15573"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 69703@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 12 09:01:50 2024 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 1rjx53-0003sk-Rv for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Mar 2024 09:01:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjx4q-0007gy-7S; Tue, 12 Mar 2024 04:01:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjx4i-0007gX-PF for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2024 04:01:29 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjx4i-0004o6-H4 for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2024 04:01:28 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rjx5G-0001u4-Lr for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2024 04:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Mar 2024 08:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69703 X-GNU-PR-Package: emacs Original-Received: via spool by 69703-submit@debbugs.gnu.org id=B69703.17102304807248 (code B ref 69703); Tue, 12 Mar 2024 08:02:02 +0000 Original-Received: (at 69703) by debbugs.gnu.org; 12 Mar 2024 08:01:20 +0000 Original-Received: from localhost ([127.0.0.1]:41739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rjx4Z-0001sq-Jw for submit@debbugs.gnu.org; Tue, 12 Mar 2024 04:01:19 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:48853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rjx4U-0001sX-OK for 69703@debbugs.gnu.org; Tue, 12 Mar 2024 04:01:18 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 789CD60002; Tue, 12 Mar 2024 08:00:13 +0000 (UTC) In-Reply-To: <86sf0yug9z.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 10 Mar 2024 19:51:20 +0200") X-GND-Sasl: juri@linkov.net 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:281506 Archived-At: >> I noticed that all these processes are created >> after loading the desktop buffers. > > Please show a reproduction recipe, as I didn't know this is possible. Here is what happens during loading the desktop: 1. When creating a new file buffer, 'ispell-kill-ispell' is called for every buffer because its personal dictionary is different from the previously restored buffer. 2. Then in the middle of 'ispell-kill-ispell', 'project-mode-line-format' kicks in from 'redisplay_internal'. 3. 'project-mode-line-format' creates a temporary buffer and enables 'flyspell-mode' in it. 4. 'flyspell-mode' creates a new stray process. 5. 'ispell-kill-ispell' that was started at 1 above finishes killing the previous Ispell process. So the processes created by 'flyspell-mode' remain unhandled. Ok, the bug is in 'project-mode-line-format'. I will send a patch to fix it in a separate bug report. >> But with the default configuration ispell-process is killed and started >> "only" on switching buffers that is very annoying since most of the time >> I see these messages in the echo area: >> >> Ispell process killed >> Starting new Ispell process /usr/bin/hunspell ... >> Ispell process killed >> Starting new Ispell process /usr/bin/hunspell ... >> Ispell process killed >> Starting new Ispell process /usr/bin/hunspell ... > > If the problem is with the messages, it can be easily solved by adding > some optional feature. But I understand there are more urgent issues, > so let's discuss those first, okay? Messages is not a problem. Perpetual process restarting causes noticeable performance degradation. Since the bug will be fixed in 'project-mode-line-format', the remaining problems are less urgent. But still the remaining inconvenience is the following: 1. Loading the desktop takes more time since it restarts the Ispell process for the every buffer: Starting new Ispell process... Ispell process killed Starting new Ispell process... Ispell process killed Starting new Ispell process... Ispell process killed Starting new Ispell process... Ispell process killed Starting new Ispell process... 2. Ispell processes still restarted on editing another buffer. >> > Not easily, AFAIR. But I don't think I understand the nature of the >> > problem you are experiencing, see above. >> >> The nature of the problem is the inability of ispell.el to maintain >> multiple processes with different dictionaries simultaneously >> that is required by flyspell-mode. >> >> What is needed here is a hash of processes where the key is >> the ispell program name and its dictionary arguments. > > Feel free to submit patches for that, and thanks. (But didn't you > just complain about one speller process per buffer?) Since implementing this is not urgent, here is a design outline for possible future improvements: 1. Create a pool of Ispell processes. 2. Instead of killing Ispell processes just get the process from the pool by the ispell program name and its dictionary arguments. 3. For backward-compatibility in 'ispell-init-process' need to set the value of 'ispell-process' to the process extracted from the pool.