GNU bug report logs - #26672
25.2; Flyspell overlay conflicts with table.el

Previous Next

Package: emacs;

Reported by: Allen Li <vianchielfaura <at> gmail.com>

Date: Wed, 26 Apr 2017 22:01:02 UTC

Severity: normal

Found in version 25.2

Done: Eli Zaretskii <eliz <at> gnu.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 26672 in the body.
You can then email your comments to 26672 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#26672; Package emacs. (Wed, 26 Apr 2017 22:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Allen Li <vianchielfaura <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 26 Apr 2017 22:01:02 GMT) Full text and rfc822 format available.

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

From: Allen Li <vianchielfaura <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2; Flyspell overlay conflicts with table.el
Date: Wed, 26 Apr 2017 15:00:05 -0700
Flyspell's overlay for misspelled words conflicts with table.el

table.el adds its keymap as a text property to the text in table cells.
When Flyspell detects a misspelled word, it adds an overlay with a
keymap binding mouse2 to ‘flyspell-correct-word’.  Apparently, this
overlay keymap overrides table.el’s ‘keymap’ text property.

The effect of this is that pressing TAB to move between table cells will
instead insert a literal tab character if your cursor happens to be on a
misspelled word.  This is extremely annoying.

More generally, I’m not sure that an overlay keymap replacing the
‘keymap’ text property is desired behavior.  At the very least, there
should be an escape hatch option on the overlay keymap that defers to
the ‘keymap’ text property for cases like Flyspell where replacing the
‘keymap’ text property is not desired behavior.

I am aware that there’s an option ‘flyspell-highlight-properties’ to
prevent Flyspell adding its overlay if the text has properties, but
that’s not really useful since most modes other than perhaps fundamental or text
will add various properties to text.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26672; Package emacs. (Fri, 28 Apr 2017 09:11:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: 26672 <at> debbugs.gnu.org
Subject: Re: bug#26672: 25.2; Flyspell overlay conflicts with table.el
Date: Fri, 28 Apr 2017 12:10:00 +0300
> From: Allen Li <vianchielfaura <at> gmail.com>
> Date: Wed, 26 Apr 2017 15:00:05 -0700
> 
> Flyspell's overlay for misspelled words conflicts with table.el
> 
> table.el adds its keymap as a text property to the text in table cells.
> When Flyspell detects a misspelled word, it adds an overlay with a
> keymap binding mouse2 to ‘flyspell-correct-word’.  Apparently, this
> overlay keymap overrides table.el’s ‘keymap’ text property.
> 
> The effect of this is that pressing TAB to move between table cells will
> instead insert a literal tab character if your cursor happens to be on a
> misspelled word.  This is extremely annoying.

Thank you for your report.

Could you please provide a complete recipe for reproducing the
problem, starting with "emacs -Q", and loading all the necessary
packages and visiting files if needed?  I think I know how to fix
this, but I need a clear-cut test case, and I don't use table.el to
easily know how to do that.

Also, is the problem only with TAB, or are there other keys which
conflict with the Flyspell overlay keymap?

> More generally, I’m not sure that an overlay keymap replacing the
> ‘keymap’ text property is desired behavior.  At the very least, there
> should be an escape hatch option on the overlay keymap that defers to
> the ‘keymap’ text property for cases like Flyspell where replacing the
> ‘keymap’ text property is not desired behavior.

I think we do have the necessary infrastructure in Emacs to achieve
the effect you want, it's just a matter of using it.  Whether to use
it in any given case is a decision that should be made on a case by
case basis, since the user and/or application could want one or the
other.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26672; Package emacs. (Sat, 29 Apr 2017 04:20:02 GMT) Full text and rfc822 format available.

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

From: Allen Li <vianchielfaura <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26672 <at> debbugs.gnu.org
Subject: Re: bug#26672: 25.2; Flyspell overlay conflicts with table.el
Date: Fri, 28 Apr 2017 21:19:38 -0700
1. emacs -Q
2. M-x flyspell-mode
3. M-x table-insert RET RET RET ... (the defaults are fine)
4. apple M-b TAB (apple is spelled correctly, TAB works)
5. asdf M-b TAB (wait for flyspell to mark the misspelling, TAB doesn't work)

On Fri, Apr 28, 2017 at 2:10 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Allen Li <vianchielfaura <at> gmail.com>
>> Date: Wed, 26 Apr 2017 15:00:05 -0700
>>
>> Flyspell's overlay for misspelled words conflicts with table.el
>>
>> table.el adds its keymap as a text property to the text in table cells.
>> When Flyspell detects a misspelled word, it adds an overlay with a
>> keymap binding mouse2 to ‘flyspell-correct-word’.  Apparently, this
>> overlay keymap overrides table.el’s ‘keymap’ text property.
>>
>> The effect of this is that pressing TAB to move between table cells will
>> instead insert a literal tab character if your cursor happens to be on a
>> misspelled word.  This is extremely annoying.
>
> Thank you for your report.
>
> Could you please provide a complete recipe for reproducing the
> problem, starting with "emacs -Q", and loading all the necessary
> packages and visiting files if needed?  I think I know how to fix
> this, but I need a clear-cut test case, and I don't use table.el to
> easily know how to do that.
>
> Also, is the problem only with TAB, or are there other keys which
> conflict with the Flyspell overlay keymap?
>
>> More generally, I’m not sure that an overlay keymap replacing the
>> ‘keymap’ text property is desired behavior.  At the very least, there
>> should be an escape hatch option on the overlay keymap that defers to
>> the ‘keymap’ text property for cases like Flyspell where replacing the
>> ‘keymap’ text property is not desired behavior.
>
> I think we do have the necessary infrastructure in Emacs to achieve
> the effect you want, it's just a matter of using it.  Whether to use
> it in any given case is a decision that should be made on a case by
> case basis, since the user and/or application could want one or the
> other.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26672; Package emacs. (Sat, 29 Apr 2017 09:10:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: 26672 <at> debbugs.gnu.org
Subject: Re: bug#26672: 25.2; Flyspell overlay conflicts with table.el
Date: Sat, 29 Apr 2017 12:09:08 +0300
> From: Allen Li <vianchielfaura <at> gmail.com>
> Date: Fri, 28 Apr 2017 21:19:38 -0700
> Cc: 26672 <at> debbugs.gnu.org
> 
> 1. emacs -Q
> 2. M-x flyspell-mode
> 3. M-x table-insert RET RET RET ... (the defaults are fine)
> 4. apple M-b TAB (apple is spelled correctly, TAB works)
> 5. asdf M-b TAB (wait for flyspell to mark the misspelling, TAB doesn't work)

Thanks.  Does the change below give good results?

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 0edf9b1..ecf729d 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -447,7 +447,9 @@ flyspell-prog-mode
 ;;*    The minor mode declaration.                                      */
 ;;*---------------------------------------------------------------------*/
 (defvar flyspell-mouse-map
-  (make-sparse-keymap)
+  (let ((map (make-sparse-keymap)))
+    (define-key map [mouse-2] 'flyspell-correct-word)
+    map)
   "Keymap for Flyspell to put on erroneous words.")
 
 (defvar flyspell-mode-map
@@ -1759,6 +1761,9 @@ make-flyspell-overlay
     (overlay-put overlay 'flyspell-overlay t)
     (overlay-put overlay 'evaporate t)
     (overlay-put overlay 'help-echo "mouse-2: correct word at point")
+    ;; If misspelled text has a 'keymap' property, let that remain in
+    ;; effect for the bindings that flyspell-mouse-map doesn't override.
+    (set-keymap-parent flyspell-mouse-map (get-char-property beg 'keymap))
     (overlay-put overlay 'keymap flyspell-mouse-map)
     (when (eq face 'flyspell-incorrect)
       (and (stringp flyspell-before-incorrect-word-string)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26672; Package emacs. (Sat, 29 Apr 2017 21:43:01 GMT) Full text and rfc822 format available.

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

From: Allen Li <vianchielfaura <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 26672 <at> debbugs.gnu.org
Subject: Re: bug#26672: 25.2; Flyspell overlay conflicts with table.el
Date: Sat, 29 Apr 2017 14:42:15 -0700
Works, thanks, although I had to rebase the patch on emacs-25 branch
as I couldn't get the master branch to compile.

On Sat, Apr 29, 2017 at 2:09 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Allen Li <vianchielfaura <at> gmail.com>
>> Date: Fri, 28 Apr 2017 21:19:38 -0700
>> Cc: 26672 <at> debbugs.gnu.org
>>
>> 1. emacs -Q
>> 2. M-x flyspell-mode
>> 3. M-x table-insert RET RET RET ... (the defaults are fine)
>> 4. apple M-b TAB (apple is spelled correctly, TAB works)
>> 5. asdf M-b TAB (wait for flyspell to mark the misspelling, TAB doesn't work)
>
> Thanks.  Does the change below give good results?
>
> diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
> index 0edf9b1..ecf729d 100644
> --- a/lisp/textmodes/flyspell.el
> +++ b/lisp/textmodes/flyspell.el
> @@ -447,7 +447,9 @@ flyspell-prog-mode
>  ;;*    The minor mode declaration.                                      */
>  ;;*---------------------------------------------------------------------*/
>  (defvar flyspell-mouse-map
> -  (make-sparse-keymap)
> +  (let ((map (make-sparse-keymap)))
> +    (define-key map [mouse-2] 'flyspell-correct-word)
> +    map)
>    "Keymap for Flyspell to put on erroneous words.")
>
>  (defvar flyspell-mode-map
> @@ -1759,6 +1761,9 @@ make-flyspell-overlay
>      (overlay-put overlay 'flyspell-overlay t)
>      (overlay-put overlay 'evaporate t)
>      (overlay-put overlay 'help-echo "mouse-2: correct word at point")
> +    ;; If misspelled text has a 'keymap' property, let that remain in
> +    ;; effect for the bindings that flyspell-mouse-map doesn't override.
> +    (set-keymap-parent flyspell-mouse-map (get-char-property beg 'keymap))
>      (overlay-put overlay 'keymap flyspell-mouse-map)
>      (when (eq face 'flyspell-incorrect)
>        (and (stringp flyspell-before-incorrect-word-string)




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 30 Apr 2017 18:59:02 GMT) Full text and rfc822 format available.

Notification sent to Allen Li <vianchielfaura <at> gmail.com>:
bug acknowledged by developer. (Sun, 30 Apr 2017 18:59:02 GMT) Full text and rfc822 format available.

Message #22 received at 26672-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: 26672-done <at> debbugs.gnu.org
Subject: Re: bug#26672: 25.2; Flyspell overlay conflicts with table.el
Date: Sun, 30 Apr 2017 21:57:40 +0300
> From: Allen Li <vianchielfaura <at> gmail.com>
> Date: Sat, 29 Apr 2017 14:42:15 -0700
> Cc: 26672 <at> debbugs.gnu.org
> 
> Works, thanks, although I had to rebase the patch on emacs-25 branch
> as I couldn't get the master branch to compile.

Thanks, pushed to the master branch.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 29 May 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 356 days ago.

Previous Next


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