GNU bug report logs - #53773
27.2; Flyspell delays region overlay update when the region is overwritten

Previous Next

Package: emacs;

Reported by: Andrea Greselin <greselin.andrea <at> gmail.com>

Date: Fri, 4 Feb 2022 10:01:01 UTC

Severity: normal

Tags: moreinfo, patch

Found in version 27.2

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53773 in the body.
You can then email your comments to 53773 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#53773; Package emacs. (Fri, 04 Feb 2022 10:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrea Greselin <greselin.andrea <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 04 Feb 2022 10:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrea Greselin <greselin.andrea <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.2;
 Flyspell delays region overlay update when the region is overwritten
Date: Fri, 4 Feb 2022 11:00:05 +0100
[Message part 1 (text/plain, inline)]
Hello everyone :-)

When ‘delete-selection-mode’ and ‘transient-mark-mode’ are enabled,
there’s an active region and I type a character, the region is
immediately deactivated. In Flyspell mode, though, the unhighlighting
of the deactivated region is delayed by the function
‘flyspell-check-word-p’. The region is deactivated but the overlay is
not updated to reflect that.

If I understand correctly the delay (indicated by ‘<---’ below) is
used by Flyspell to give the user some time for typing before
highlighting a word as mispelled, but in this case it ends up
delaying also the refresh of the region overlay.

(defun flyspell-check-word-p ()
 "Return t when the word at `point' has to be checked.
The answer depends of several criteria.
Mostly we check word delimiters."
 (let ((ispell-otherchars (ispell-get-otherchars)))
   (cond
    ((<= (- (point-max) 1) (point-min))
     ;; The buffer is not filled enough.
     nil)
    ((and (and (> (current-column) 0)
(not (eq (current-column) flyspell-pre-column)))
  (save-excursion
    (backward-char 1)
    (and (looking-at (flyspell-get-not-casechars))
 (or (string= "" ispell-otherchars)
     (not (looking-at ispell-otherchars)))
 (or flyspell-consider-dash-as-word-delimiter-flag
     (not (looking-at "-"))))))
     ;; Yes because we have reached or typed a word delimiter.
     t)
    ((symbolp this-command)
     (cond
      ((get this-command 'flyspell-deplacement)
(not (eq flyspell-previous-command this-command)))
      ((get this-command 'flyspell-delayed)
;; The current command is not delayed, that
;; is that we must check the word now.
(and (not unread-command-events)
    (sit-for flyspell-delay))) ; <---
      (t t)))
    (t t))))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53773; Package emacs. (Tue, 02 Aug 2022 16:13:01 GMT) Full text and rfc822 format available.

Message #8 received at 53773 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Greselin <greselin.andrea <at> gmail.com>
To: 53773 <at> debbugs.gnu.org
Subject: 27.2;
 Flyspell delays region overlay update when the region is overwritten
Date: Tue, 2 Aug 2022 18:11:57 +0200
[Message part 1 (text/plain, inline)]
Issuing a ‘(deactivate-mark)’ right before the line

  (and (not unread-command-events)

solves the problem but I don't know if it has any unwanted side
effects or if it's a good way to go about it. By the way this bug
also affects Emacs 28.1.

Best,
Andrea
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53773; Package emacs. (Wed, 03 Aug 2022 11:18:02 GMT) Full text and rfc822 format available.

Message #11 received at 53773 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andrea Greselin <greselin.andrea <at> gmail.com>
Cc: 53773 <at> debbugs.gnu.org
Subject: Re: bug#53773: 27.2; Flyspell delays region overlay update when the
 region is overwritten
Date: Wed, 03 Aug 2022 13:17:31 +0200
Andrea Greselin <greselin.andrea <at> gmail.com> writes:

> Issuing a ‘(deactivate-mark)’ right before the line
>
>   (and (not unread-command-events)
>
> solves the problem but I don't know if it has any unwanted side
> effects or if it's a good way to go about it. By the way this bug
> also affects Emacs 28.1.

So the proposed change is the patch below, but I'm not really familiar
with this code.  Anybody have any comments?

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 2c5e30fecd..883137d5bd 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -856,6 +856,7 @@ flyspell-check-word-p
        ((get this-command 'flyspell-delayed)
 	;; The current command is not delayed, that
 	;; is that we must check the word now.
+        (deactivate-mark)
 	(and (not unread-command-events)
 	     (sit-for flyspell-delay)))
        (t t)))





Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 03 Aug 2022 11:18:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 03 Aug 2022 11:18:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53773; Package emacs. (Wed, 03 Aug 2022 12:31:02 GMT) Full text and rfc822 format available.

Message #18 received at 53773 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: greselin.andrea <at> gmail.com, 53773 <at> debbugs.gnu.org
Subject: Re: bug#53773: 27.2;
 Flyspell delays region overlay update when the region is overwritten
Date: Wed, 03 Aug 2022 15:30:07 +0300
> Cc: 53773 <at> debbugs.gnu.org
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Wed, 03 Aug 2022 13:17:31 +0200
> 
> Andrea Greselin <greselin.andrea <at> gmail.com> writes:
> 
> > Issuing a ‘(deactivate-mark)’ right before the line
> >
> >   (and (not unread-command-events)
> >
> > solves the problem but I don't know if it has any unwanted side
> > effects or if it's a good way to go about it. By the way this bug
> > also affects Emacs 28.1.
> 
> So the proposed change is the patch below, but I'm not really familiar
> with this code.  Anybody have any comments?

LGTM, but please add a comment there mentioning delete-selection-mode
(and I think the added line should be _before_ the comment about the
current command not being delayed).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53773; Package emacs. (Thu, 04 Aug 2022 06:18:02 GMT) Full text and rfc822 format available.

Message #21 received at 53773 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: greselin.andrea <at> gmail.com, 53773 <at> debbugs.gnu.org
Subject: Re: bug#53773: 27.2; Flyspell delays region overlay update when the
 region is overwritten
Date: Thu, 04 Aug 2022 08:16:57 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> LGTM, but please add a comment there mentioning delete-selection-mode
> (and I think the added line should be _before_ the comment about the
> current command not being delayed).

OK; now done.




bug marked as fixed in version 29.1, send any further explanations to 53773 <at> debbugs.gnu.org and Andrea Greselin <greselin.andrea <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 04 Aug 2022 06:18:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 01 Sep 2022 11:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.