unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35397: flyspell-mode affects delete-selection-mode
@ 2019-04-23 15:24 Евгений Курневский
  2019-06-30 16:49 ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Евгений Курневский @ 2019-04-23 15:24 UTC (permalink / raw)
  To: 35397

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

Emacs version: 26.2
Steps to reproduce:
emacs -Q
M-x delete-selection-mode
M-x flyspell-mode
Type one word, select it and type one character. This character will be
selected for flyspell-delay seconds.
Desired behavior - selection disappears right after new character is
inserted, as without flyspell-mode.

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

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

* bug#35397: flyspell-mode affects delete-selection-mode
  2019-04-23 15:24 bug#35397: flyspell-mode affects delete-selection-mode Евгений Курневский
@ 2019-06-30 16:49 ` Stefan Kangas
  2019-06-30 17:53   ` Евгений Курневский
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2019-06-30 16:49 UTC (permalink / raw)
  To: Евгений Курневский
  Cc: 35397

Евгений Курневский <kurnevsky@gmail.com> writes:

> Emacs version: 26.2
> Steps to reproduce:
> emacs -Q
> M-x delete-selection-mode
> M-x flyspell-mode
> Type one word, select it and type one character. This character will be selected for flyspell-delay seconds.
> Desired behavior - selection disappears right after new character is inserted, as without flyspell-mode.

I tried the following steps:

0. emacs -Q
1. M-x delete-selection-mode
2. M-x flyspell-mode
3. foobar C-SPC C-a x

What I see is that "x" is highlighted for flyspell-delay seconds.  If I
continue typing before that, the highlighting immediately disappears.
If I type "1" instead of "x", there is no highlighting.

Crucially, the "x" does not get replaced by subsequent characters, as it
would have been under delete-selection-mode if the "x" was actually
selected.  In other words, if you change step three to:

3. foobar C-SPC C-a xyz

You see a buffer containing "xyz".

Thus, the problem seems to be the highlighting only, which could perhaps
be somewhat confusing to a user.  I think this is indeed a bug (or
buglet), although its mostly cosmetic.

Could you please confirm this, or are you talking about something else?

Thanks,
Stefan Kangas





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

* bug#35397: flyspell-mode affects delete-selection-mode
  2019-06-30 16:49 ` Stefan Kangas
@ 2019-06-30 17:53   ` Евгений Курневский
  0 siblings, 0 replies; 3+ messages in thread
From: Евгений Курневский @ 2019-06-30 17:53 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 35397

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

Yes, you are right, the problem is with highlighting. But there is another
undesired consequence - flyspell mode prevents `company` popup in this
case, it appears only after second character is typed. I investigated it a
bit and it seems it's caused by `sit-for` used inside
`flyspell-check-word-p`. So I came up with a workaround that solves both
these issues:

(advice-add 'flyspell-check-word-p :around (lambda (orig-fun &rest args)
                                             (if (eq this-command
'self-insert-command)
                                               (memq
(get-char-code-property (char-before) 'general-category) '(Zs Zl Zp))
                                               (apply orig-fun args))))

This makes flyspell return immediately when `self-insert-command` was used.

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

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

end of thread, other threads:[~2019-06-30 17:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 15:24 bug#35397: flyspell-mode affects delete-selection-mode Евгений Курневский
2019-06-30 16:49 ` Stefan Kangas
2019-06-30 17:53   ` Евгений Курневский

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).