From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#39898: 28.0.50; The off-by-one bug in `flyspell-check-previous-highlighted-word' Date: Thu, 27 Aug 2020 12:37:45 -0700 Message-ID: References: <874kv4bfhw.fsf@mail.parknet.co.jp> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000001c8a4305ade112a4" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40133"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39898@debbugs.gnu.org To: OGAWA Hirofumi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 27 21:56:47 2020 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 1kBO0t-000ALI-5U for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Aug 2020 21:56:47 +0200 Original-Received: from localhost ([::1]:44604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBO0s-0001Hz-7H for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Aug 2020 15:56:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37730) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBNik-0004wp-CC for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 15:38:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBNik-0002NI-1d for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 15:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kBNij-0003yr-UR for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 15:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Aug 2020 19:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39898 X-GNU-PR-Package: emacs Original-Received: via spool by 39898-submit@debbugs.gnu.org id=B39898.159855707515281 (code B ref 39898); Thu, 27 Aug 2020 19:38:01 +0000 Original-Received: (at 39898) by debbugs.gnu.org; 27 Aug 2020 19:37:55 +0000 Original-Received: from localhost ([127.0.0.1]:44115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBNic-0003yO-L9 for submit@debbugs.gnu.org; Thu, 27 Aug 2020 15:37:54 -0400 Original-Received: from mail-yb1-f180.google.com ([209.85.219.180]:44935) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBNia-0003y6-8n for 39898@debbugs.gnu.org; Thu, 27 Aug 2020 15:37:53 -0400 Original-Received: by mail-yb1-f180.google.com with SMTP id i10so3592486ybt.11 for <39898@debbugs.gnu.org>; Thu, 27 Aug 2020 12:37:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc; bh=NkZntSz+yT1amPiZ4mmy/eGciuGNe7EWFDCSEZ7kN2o=; b=oWBZQtbSiVsHDlt5janxez+Q1VEigT5IdABso0tPpl5t/RWiRWwcFQb1vM0E+VwlQq UjC83H/NW7OdzQcJJuIxcFXrJssrIw6+xC4b86YVoEGaXooQfJCM2whc2kRnEmeT5aNU GneS2gAIw8zFfXOZvG6v0AxWSvWkh+HNp9Iyy6nKu7GoglS86BgZubeQmbyZ41w/I/ZD Arbn6q5IlONuQM/XO7jP/HtnWNq+9Ytj1TqEtcyaTjby8cFhvAof3Xc5RNO7QfsuCxQ1 K5u9cGgzO//lG9Kyh7bEQOJis8wjUwlWf/NIQ/Jdf1cjSJeB+XU8Drr/QaJsc0eE+1Pm SRHg== X-Gm-Message-State: AOAM532pDHykfm7GqxFKDeASRTOiXxX2X+3VxFBC6O18inX2eSmkstcw O+M8yWgZ6bfyd/vgSUryjHQGnjNsOM3Xb40k3UNw7RGQndA= X-Google-Smtp-Source: ABdhPJwZtuRwAvOkZEskpNvG7vmj3R2UVUGhGFFv8lbw7tM0KdmWxqeRJvqpGWD6iSmbbrdBmXdI3GUMc4WgoNnT3ic= X-Received: by 2002:a25:880e:: with SMTP id c14mr31555453ybl.181.1598557066651; Thu, 27 Aug 2020 12:37:46 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 27 Aug 2020 12:37:45 -0700 In-Reply-To: <874kv4bfhw.fsf@mail.parknet.co.jp> (OGAWA Hirofumi's message of "Wed, 04 Mar 2020 19:07:07 +0900") 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:186566 Archived-At: --0000000000001c8a4305ade112a4 Content-Type: text/plain; charset="UTF-8" tags 39898 + patch thanks OGAWA Hirofumi writes: > With the following test, > > (with-temp-buffer > (select-window (display-buffer (current-buffer))) > (insert "appl") > (flyspell-buffer) > (flyspell-check-previous-highlighted-word)) > > `flyspell-check-previous-highlighted-word' calls `(error)'. But "appl" > is the typo that should be fixed. > > At the following [**] mark in a that command, the ">" looks not allowing > a typo at (point-min). Maybe the ">" should be the ">=". > > (defun flyspell-check-previous-highlighted-word (&optional arg) > > [...] > > (if (> pos (point-min)) <- [**] > > [...] > > (save-excursion > (goto-char pos) > (ispell-word) > (setq flyspell-word-cache-word nil) ;; Force flyspell-word re-check > (flyspell-word)) > (error "No word to correct before point")))) Indeed, this just looks like an OBOE to me. The attached patch fixes it as per your suggestion. However, there is some stuff going on with `previous-overlay-change', so it would be good if someone could double-check that the fix here is correct. AFAIU, this should work at the price that in a buffer with no misspelled words we uselessly check if there's a misspelled word at point-min. Best regards, Stefan Kangas --0000000000001c8a4305ade112a4 Content-Type: text/x-diff; charset="US-ASCII"; name="0001-Fix-OBOE-in-flyspell-check-previous-highlighted-word.patch" Content-Disposition: attachment; filename="0001-Fix-OBOE-in-flyspell-check-previous-highlighted-word.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: 37bbd479b0e8bada_0.1 RnJvbSBhOTcyM2U5ODIxODgwMzRiMmIwYTUyYTg1MDBkNTg0OTdmOTZjZjE4IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBTdGVmYW4gS2FuZ2FzIDxzdGVmYW5rYW5nYXNAZ21haWwuY29t PgpEYXRlOiBUaHUsIDI3IEF1ZyAyMDIwIDIxOjIxOjAzICswMjAwClN1YmplY3Q6IFtQQVRDSF0g Rml4IE9CT0UgaW4gZmx5c3BlbGwtY2hlY2stcHJldmlvdXMtaGlnaGxpZ2h0ZWQtd29yZAoKKiBs aXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbAooZmx5c3BlbGwtY2hlY2stcHJldmlvdXMtaGlnaGxp Z2h0ZWQtd29yZCk6IEZpeCBvZmYtYnktb25lIGVycm9yIHdoZW4Kd29yZCBpcyBhdCAocG9pbnQt bWluKS4gIChCdWcjMz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