all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten
@ 2022-02-04 10:00 Andrea Greselin
  2022-08-02 16:11 ` Andrea Greselin
  0 siblings, 1 reply; 5+ messages in thread
From: Andrea Greselin @ 2022-02-04 10:00 UTC (permalink / raw)
  To: 53773

[-- Attachment #1: Type: text/plain, Size: 1765 bytes --]

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))))

[-- Attachment #2: Type: text/html, Size: 2084 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten
  2022-02-04 10:00 bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten Andrea Greselin
@ 2022-08-02 16:11 ` Andrea Greselin
  2022-08-03 11:17   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Andrea Greselin @ 2022-08-02 16:11 UTC (permalink / raw)
  To: 53773

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 320 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten
  2022-08-02 16:11 ` Andrea Greselin
@ 2022-08-03 11:17   ` Lars Ingebrigtsen
  2022-08-03 12:30     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-03 11:17 UTC (permalink / raw)
  To: Andrea Greselin; +Cc: 53773

Andrea Greselin <greselin.andrea@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)))






^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten
  2022-08-03 11:17   ` Lars Ingebrigtsen
@ 2022-08-03 12:30     ` Eli Zaretskii
  2022-08-04  6:16       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2022-08-03 12:30 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: greselin.andrea, 53773

> Cc: 53773@debbugs.gnu.org
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 03 Aug 2022 13:17:31 +0200
> 
> Andrea Greselin <greselin.andrea@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).





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten
  2022-08-03 12:30     ` Eli Zaretskii
@ 2022-08-04  6:16       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-04  6:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: greselin.andrea, 53773

Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-04  6:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-04 10:00 bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten Andrea Greselin
2022-08-02 16:11 ` Andrea Greselin
2022-08-03 11:17   ` Lars Ingebrigtsen
2022-08-03 12:30     ` Eli Zaretskii
2022-08-04  6:16       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.