From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74437: 30.0.92; completion-preview-idle-delay is delayed by flyspell Date: Fri, 22 Nov 2024 08:26:42 +0100 Message-ID: References: <87cyirbfpd.fsf@alternateved.com> <86bjybta3i.fsf@gnu.org> <861pz7t4yb.fsf@gnu.org> <86sermrr8i.fsf@gnu.org> <86jzcxswbx.fsf@gnu.org> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11150"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74437@debbugs.gnu.org, mail@alternateved.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 22 08:27:19 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 1tEO4V-0002i0-Jr for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 22 Nov 2024 08:27:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEO4H-0005ks-9S; Fri, 22 Nov 2024 02:27:05 -0500 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 1tEO4F-0005kg-MA for bug-gnu-emacs@gnu.org; Fri, 22 Nov 2024 02:27:03 -0500 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 1tEO4F-0007IR-DP for bug-gnu-emacs@gnu.org; Fri, 22 Nov 2024 02:27:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=ZOCCme/VeO2pH7zFfoE+OluBe26ou/OVylD8kHU0Hl4=; b=Z6/YD8r0fowpWTJKOZc6/UC/WkWCU63A99LwgkkxkBkhmTotlLGheCX7PNB8U99514TZaI+fCZGCFUrGyvPCL9oOrm397IKG/Yqoa0z3jgunOam/XGrzxkINOF1JdwmGRinOt74J/Qw4/KFSIZvJdto82+TyqxaYdFo/nQ1Xa4TPaIFst9Y0LReSnTCMtdZtcL/p//H3vIgd2Zs+UQgcqioXXEZlV4G6EID/1reDKmrN2V4D4oNyUUULatUWMeLC0gbAQ4eSAXL2+3tWGah5WDuvflSyYbpJdifr80fOmUnOH+LyY9QHmWQM8tD2ORK2l+Us4WRjpOxdcNyHqyM0Mw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tEO4E-0002RE-Am for bug-gnu-emacs@gnu.org; Fri, 22 Nov 2024 02:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Nov 2024 07:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74437 X-GNU-PR-Package: emacs Original-Received: via spool by 74437-submit@debbugs.gnu.org id=B74437.17322604089350 (code B ref 74437); Fri, 22 Nov 2024 07:27:02 +0000 Original-Received: (at 74437) by debbugs.gnu.org; 22 Nov 2024 07:26:48 +0000 Original-Received: from localhost ([127.0.0.1]:52862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEO3z-0002Qh-Fr for submit@debbugs.gnu.org; Fri, 22 Nov 2024 02:26:47 -0500 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:57456 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEO3x-0002QY-Gv for 74437@debbugs.gnu.org; Fri, 22 Nov 2024 02:26:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1732260405; bh=C+ecsWp03V5sbj66qoLFBwaV5M168DP2s+5hlXGaabw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=qGq3mijph0tSu6xnwbVlaJBmdY9PRMHAUPlK1Tvth2+eD8/YfdEk6x5JqfUTRB8mf VtKM06aYphytMpuOesCjiAuQT4IUz3h6ICOyu4p9WeYUdNexGEzvrA7jPOCJwImPoA Uyh5TA36sT1Nj5khuoVBG+3oaolR4+WgAGVgbN8tqRuCg/WdCbSoMQGvoBuZY1SAr5 du5DJI8FTeGhP5KnUKRuhtzGufWn8bGeEi4Xau/TG2F6ZDe4oP6VxDj6llDtf+xaT9 NyMjdq2YsDy0FPs/1CedUD3HV2BXTxTt83vzQ2RG1vTi2SdSbpjLhJKuPZxrJLQoAJ +LEbsIEXFX1Yw== In-Reply-To: <86jzcxswbx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 20 Nov 2024 18:29:06 +0200") 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:295773 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Eshel Yaron >> Cc: 74437@debbugs.gnu.org, mail@alternateved.com >> Date: Wed, 20 Nov 2024 16:52:49 +0100 >> >> Eli Zaretskii writes: >> >> >> From: Eshel Yaron >> >> Cc: 74437@debbugs.gnu.org, mail@alternateved.com >> >> Date: Tue, 19 Nov 2024 21:16:56 +0100 >> > >> >> > Also, what happens if there are other async >> >> > subprocesses running in parallel, like maybe Grep or compilation or >> >> > url-retrieve? >> >> >> >> They make progress, which seems to work as expected, at least with Grep. >> >> That is if we use the previous patch, with the one below we pass non-nil >> >> JUST-THIS-ONE argument to accept-process-output when called from a timer >> >> so other processes shouldn't see new output during this call. Either >> >> way works, AFAICT. >> > >> > The question is: what do users expect to happen in those cases? >> >> I don't know > > Neither do I. I didn't say something was wrong with either of these > implementations, I'm just saying they should be well tested by users > before we have enough basis to make the decisions whether the idea is > generally good and whether it should probably become the default in > some future version. Sounds good. So here's a full patch that keeps the current implementation as the default: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-New-option-flyspell-delay-use-timer.patch >From 0dfa6f8b4aaa825a2587fa36f30bf9f55918ff3d Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 22 Nov 2024 08:17:25 +0100 Subject: [PATCH] New option 'flyspell-delay-use-timer' * lisp/textmodes/flyspell.el (flyspell-delay-use-timer): New user option. (flyspell--timer): New variable. (flyspell-check-word-p): Use them. (flyspell-post-command-hook): Disable timer. (flyspell-word): Pass non-nil SECONDS argument to 'accept-process-output' to permit quitting. (bug#74437) --- lisp/textmodes/flyspell.el | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 09d4e8a8d1a..5fcb83efb57 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -810,6 +810,18 @@ flyspell-check-changed-word-p (let ((pos (point))) (or (>= pos start) (<= pos stop) (= pos (1+ stop)))))))) +(defcustom flyspell-delay-use-timer nil + "Whether Flyspell should use a timer for waiting after a delayed command. + +If this is non-nil, Flyspell sets up a timer for checking the word at +point `flyspell-delay' seconds after you invoke a delayed command. +Otherwise, if this option is nil, Flyspell uses `sit-for' to wait for +that duration instead." + :type 'boolean + :version "31.1") + +(defvar flyspell--timer nil) + ;;*---------------------------------------------------------------------*/ ;;* flyspell-check-word-p ... */ ;;*---------------------------------------------------------------------*/ @@ -844,7 +856,16 @@ flyspell-check-word-p ;; The current command is not delayed, that ;; is that we must check the word now. (and (not unread-command-events) - (sit-for flyspell-delay))) + (if (not flyspell-delay-use-timer) + (sit-for flyspell-delay) + (setq flyspell--timer + (run-with-idle-timer + flyspell-delay nil + (lambda (buffer) + (when (eq (current-buffer) buffer) + (flyspell-word nil nil t))) + (current-buffer))) + nil))) (t t))) (t t)))) @@ -955,6 +976,7 @@ flyspell-debug-signal-changed-checked (defun flyspell-post-command-hook () "The `post-command-hook' used by flyspell to check a word on-the-fly." (interactive) + (when (timerp flyspell--timer) (cl-callf cancel-timer flyspell--timer)) (when flyspell-mode (with-local-quit (let ((command this-command) @@ -1179,7 +1201,7 @@ flyspell-word (set-process-query-on-exit-flag ispell-process nil) ;; Wait until ispell has processed word. (while (progn - (accept-process-output ispell-process) + (accept-process-output ispell-process 1) (not (string= "" (car ispell-filter))))) ;; (ispell-send-string "!\n") ;; back to terse mode. -- 2.46.2 --=-=-=--