From unknown Mon Jun 23 18:30:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61874: 30.0.50; Flyspell only changes Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Feb 2023 18:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61874 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 61874@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167760726028702 (code B ref -1); Tue, 28 Feb 2023 18:01:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Feb 2023 18:01:00 +0000 Received: from localhost ([127.0.0.1]:51967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pX4Hb-0007Sr-Nq for submit@debbugs.gnu.org; Tue, 28 Feb 2023 13:01:00 -0500 Received: from lists.gnu.org ([209.51.188.17]:37000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pX4Ha-0007Sk-7k for submit@debbugs.gnu.org; Tue, 28 Feb 2023 13:00:58 -0500 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 1pX4HZ-0008KD-Hw for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2023 13:00:57 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pX4HX-0005Z2-7r for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2023 13:00:57 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 4B4D5E0011 for ; Tue, 28 Feb 2023 18:00:50 +0000 (UTC) From: Juri Linkov Organization: LINKOV.NET Date: Tue, 28 Feb 2023 19:53:06 +0200 Message-ID: <867cw1n0cd.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.183.196; envelope-from=juri@linkov.net; helo=relay4-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Tags: patch This feature is the opposite of the feature implemented by Augusto in bug#61814. The problem is that the default behavior of flyspell-mode is too erratic. It checks and highlights random words where the cursor happens to travel while navigating the buffer. The feature from Augusto allows to check all words in the buffer that makes sense when the intention of the user is to see all misspelled words to correct them. OTOH, often there is no need to check all misspellings in the existing file, but only newly entered text. For such use cases extra highlighting while moving thru the file causes too much distraction. So here is a new option that allow to check only text edited by the user. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=flyspell-check-changes.patch diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 84c207b8a48..ef11c0ca326 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -289,6 +289,11 @@ flyspell-auto-correct-binding "The key binding for flyspell auto correction." :type 'key-sequence) +(defcustom flyspell-check-changes nil + "Check only edited text." + :type 'boolean + :version "30.1") + ;;*---------------------------------------------------------------------*/ ;;* Mode specific options */ ;;* ------------------------------------------------------------- */ @@ -627,7 +632,9 @@ flyspell-mode-on ;; we put the `flyspell-deplacement' property on some commands (flyspell-deplacement-commands) ;; we bound flyspell action to post-command hook - (add-hook 'post-command-hook (function flyspell-post-command-hook) t t) + (if flyspell-check-changes + (add-hook 'post-command-hook (function flyspell-check-changes) t t) + (add-hook 'post-command-hook (function flyspell-post-command-hook) t t)) ;; we bound flyspell action to pre-command hook (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t) ;; we bound flyspell action to after-change hook @@ -732,6 +739,7 @@ flyspell-pre-command-hook (defun flyspell-mode-off () "Turn Flyspell mode off." ;; We remove the hooks. + (remove-hook 'post-command-hook (function flyspell-check-changes) t) (remove-hook 'post-command-hook (function flyspell-post-command-hook) t) (remove-hook 'pre-command-hook (function flyspell-pre-command-hook) t) (remove-hook 'after-change-functions 'flyspell-after-change-function t) @@ -1016,6 +1024,20 @@ flyspell-post-command-hook (setq flyspell-changes (cdr flyspell-changes)))) (setq flyspell-previous-command command))))) +(defun flyspell-check-changes () + "The `post-command-hook' used by flyspell to check only edits." + (when flyspell-mode + (with-local-quit + (when (consp flyspell-changes) + (let ((start (car (car flyspell-changes))) + (stop (cdr (car flyspell-changes))) + (word (save-excursion (flyspell-get-word)))) + (unless (and word (<= (nth 1 word) start) (>= (nth 2 word) stop)) + (save-excursion + (goto-char start) + (flyspell-word)) + (setq flyspell-changes nil))))))) + ;;*---------------------------------------------------------------------*/ ;;* flyspell-notify-misspell ... */ ;;*---------------------------------------------------------------------*/ --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 04 04:53:50 2023 Received: (at control) by debbugs.gnu.org; 4 Sep 2023 08:53:50 +0000 Received: from localhost ([127.0.0.1]:48527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qd5LC-00035o-0Z for submit@debbugs.gnu.org; Mon, 04 Sep 2023 04:53:50 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]:61813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qd5LA-00035X-Az for control@debbugs.gnu.org; Mon, 04 Sep 2023 04:53:48 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5007616b756so2017920e87.3 for ; Mon, 04 Sep 2023 01:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693817622; x=1694422422; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=TqYGlYBb9YWlBiVQgOGZiEIwHccr3CLd7WpcnslEjxc=; b=Ck50531ynVykbaMGozSNBQMcyvzgeKYRD1rBMrIbw5YkZZRrrCbJJ8mh9cKhKYqFCS McL2prWwreDKDE35njBIayBqseUYfJz3y1alTcBLKFY+hrgTUx+kkUVRhiR/LLVlUmZm YjBSVEjkdovcuP84xIoMJigc+74OmUSqfUiBssDSl+GkFfyGiOyo8IymiMCPo8PpZvl9 /7Wx2lfWc6fqDwfU3WKCBfTNbWZ4ptVZb+00yadG2bDJAYNARAE1dz00xFJGtI6il4Xu zP3KGPVT9WVDY7m4y/pQvh5uxTHfNzKpTeod3qiHDZat0BKLHfq0sIuKH9bYOUN/C8Uq kVAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693817622; x=1694422422; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TqYGlYBb9YWlBiVQgOGZiEIwHccr3CLd7WpcnslEjxc=; b=RfIkWvJOb6r8+TshEf3MOIVJZT1Ilc4c5h1WK+6SURTTFo4BUt0u/1A5zvdgfsthHi MgoHF72LH4NvO2q4S+TYzftUOE4iN6UGT1syuRSsCyjskDpImx8GRQ+D32Ug9nL2/dtM Uc03eQc7fp1CMfcRechgSH4FBHpu3MbSctrNjlU4G8uvjb+S2xUgCfuHsM1LSokiVVhY 8+kTdMAFViVhGPByy1xHb4J7mL4+YXuUK5xO/KGD1J8955Imocgme/HjJjbl7WAie2Aq 6vXpasWW4UUmEbGqGCXcpk/H8Y6ZSrNqpbRjBrcLbvK6Q2c/BiCMPV9ZoapcTjeE5sVw Si5g== X-Gm-Message-State: AOJu0YwNfUQ5/j4uyplZrr9Ub1dd0ErOiPFXm9ktbit23J1FUJk0rrIv YIjKLiEipcIMoP0fZHwYFwxik1r1ZvKHe2c8y4oFb0as95s= X-Google-Smtp-Source: AGHT+IG0R+hHIiXuOhP+UmO6Mbuy2p1iwcADpKtiQX/Z4Ncag2FFBiE2XY235hmPGYp9vcllC5i1cALMyDJMRX+fSDo= X-Received: by 2002:ac2:5a45:0:b0:4fe:d0f:1f1b with SMTP id r5-20020ac25a45000000b004fe0d0f1f1bmr5152940lfn.65.1693817622540; Mon, 04 Sep 2023 01:53:42 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 4 Sep 2023 01:53:42 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Mon, 4 Sep 2023 01:53:42 -0700 Message-ID: Subject: control message for bug #61874 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 61874 wishlist quit From unknown Mon Jun 23 18:30:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61874: 30.0.50; Flyspell only changes Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Mar 2024 18:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61874 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 61874@debbugs.gnu.org Received: via spool by 61874-submit@debbugs.gnu.org id=B61874.171044002320458 (code B ref 61874); Thu, 14 Mar 2024 18:14:02 +0000 Received: (at 61874) by debbugs.gnu.org; 14 Mar 2024 18:13:43 +0000 Received: from localhost ([127.0.0.1]:50593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkpaJ-0005Ju-9q for submit@debbugs.gnu.org; Thu, 14 Mar 2024 14:13:43 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:57723) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkpaH-0005Jb-9q; Thu, 14 Mar 2024 14:13:42 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 511A4FF803; Thu, 14 Mar 2024 18:12:58 +0000 (UTC) From: Juri Linkov In-Reply-To: <867cw1n0cd.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 28 Feb 2023 19:53:06 +0200") Organization: LINKOV.NET References: <867cw1n0cd.fsf@mail.linkov.net> Date: Thu, 14 Mar 2024 20:11:42 +0200 Message-ID: <865xxoptsx.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) close 61874 30.0.50 thanks > This feature is the opposite of the feature implemented by Augusto in > bug#61814. The problem is that the default behavior of flyspell-mode > is too erratic. It checks and highlights random words where the cursor > happens to travel while navigating the buffer. The feature from Augusto > allows to check all words in the buffer that makes sense when the intention > of the user is to see all misspelled words to correct them. > > OTOH, often there is no need to check all misspellings in the existing file, > but only newly entered text. For such use cases extra highlighting > while moving thru the file causes too much distraction. So here is > a new option that allow to check only text edited by the user. Now after a long period of testing pushed and closed.