GNU bug report logs - #728
23.0.60; flyspell checking is sometimes silently disabled

Previous Next

Package: emacs;

Reported by: Markus Triska <markus.triska <at> gmx.at>

Date: Fri, 15 Aug 2008 22:30:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

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 728 in the body.
You can then email your comments to 728 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#728; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; flyspell checking is sometimes silently disabled
Date: Sat, 16 Aug 2008 00:20:22 +0200 (CEST)
Sometimes in flyspell-mode, the mode line still says "Fly", but no
more flychecking is actually performed. I cannot yet reproduce it
reliably; however, if you add the following to your .emacs:

   (defun my-flyspell-check ()
     (when flyspell-mode
       (unless (memq 'flyspell-post-command-hook post-command-hook)
         (with-current-buffer (get-buffer-create "flywarn")
           (insert "flychecking inactive despite flyspell-mode!\n"))
         (display-buffer  "flywarn"))))

   (setq flycheck-timer (run-with-timer 0 0.5 'my-flyspell-check))

you will be informed when flyspell mode is superficially active, but
no checking is actually performed. I only encountered the problem once
since I have the above code in my .emacs, and then I also saw:
"Invalid search bound (wrong side of point)" in *Messages*, which I
previously probably missed. Thus I think this could for example happen
when switching buffers or using the minibuffer at the wrong time.

It is clear that flyspell-post-command-hook must be removed from
post-command-hook in case of errors; if the error is hard to catch in
the hook, I would already find it an improvement if flyspell mode were
cleanly disabled (existing underlines, mode line, ...) in such cases.

In GNU Emacs 23.0.60.1 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
 of 2008-08-15 on mt-computer.local
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#728; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 728 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#728: 23.0.60; flyspell checking is sometimes silently disabled
Date: Sat, 16 Aug 2008 00:12:37 -0400
> no checking is actually performed. I only encountered the problem once
> since I have the above code in my .emacs, and then I also saw:
> "Invalid search bound (wrong side of point)" in *Messages*, which I

You need to try and track down the porigian of this message.  It may
be due to flyspell but it can also be due to something else: if there's
a bug in one of the post-command-hooks, post-command-hook is set to nil
(hence *all* post-command-hooks are disabled).


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#728; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#728; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at 728 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 728 <at> debbugs.gnu.org
Subject: Re: 23.0.60; flyspell checking is sometimes silently disabled
Date: Thu, 21 Aug 2008 19:25:33 -0400
> Sometimes in flyspell-mode, the mode line still says "Fly", but no
> more flychecking is actually performed. I cannot yet reproduce it
> reliably

Hi Markus,

Have you found a way to track down the problem causing this bug?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#728; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #25 received at 728 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 728 <at> debbugs.gnu.org
Subject: Re: 23.0.60; flyspell checking is sometimes silently disabled
Date: Thu, 21 Aug 2008 22:15:57 -0400
Chong Yidong <cyd <at> stupidchicken.com> writes:

> Have you found a way to track down the problem causing this bug?

I have set debug-on-error to t, so the next time I see this problem, I
hope to catch which function raises the error. I already know that it is
either preview-move-point (from AUCTeX) or flyspell-post-command-hook.

Thus, especially if an AUCTeX user reads this: If you want to help to
debug this problem, please add the following to your .emacs:

   (defun my-flyspell-check ()
     (when flyspell-mode
       (unless (memq 'flyspell-post-command-hook post-command-hook)
         (with-current-buffer (get-buffer-create "flywarn")
           (insert "flychecking inactive despite flyspell-mode!\n"))
         (display-buffer  "flywarn"))))

   (setq flycheck-timer (run-with-timer 0 0.5 'my-flyspell-check))

and it will warn you when Flyspell is no longer really active.

Also, as I mentioned: I find it fair enough that Flyspell is disabled
when there are errors; I only wish that there were a general mechanism
to disable it in a cleaner way in case of errors, i.e., existing
underlines should be removed, the mode line should reflect that it is no
longer active etc. In short, when flyspell-post-command-hook must be
removed from post-command-hook, also (flyspell-mode 0) or anything
equivalent should be done. Analogously for some other modes (linum.el is
another example, where errors in a custom linum-format function should
make Emacs disable the minor mode completely, thus removing it from
other hooks as well).




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#728; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #30 received at 728 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 728 <at> debbugs.gnu.org
Subject: Re: 23.0.60; flyspell checking is sometimes silently disabled
Date: Tue, 09 Sep 2008 01:18:24 +0200
The error occurs in flyspell-post-command-hook. To reproduce:

1) Install the latest AUCTeX (11.85), and let .emacs consist only of:

   (load "auctex.el" nil t t)

2) Let sat.tex ( http://www.logic.at/prolog/sat.tex ) consist of:

\maketitle
    \includegraphics[scale=0.8]
%       \hline
  
%   \begin{itemize}
%     \hspace{1cm}\hbox{\begin{tabular}
%       $a$ & $b$ & $c$ & $d$ \\

   without leading or trailing whitespace.

3) When you now do:

   $ emacs sat.tex -f flyspell-mode

   and press:

   M-g M-g 3 RET C-s $

   you get:

   Error in post-command-hook: (error Invalid search bound (wrong side
   of point))

   Alternatively, you can also press for example:

   C-n C-n C-p C-n C-n C-n C-n C-n C-n C-p




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#728; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #35 received at 728 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 728 <at> debbugs.gnu.org
Subject: Re: 23.0.60; flyspell checking is sometimes silently disabled
Date: Sun, 14 Sep 2008 20:33:48 +0200
The following patch fixes this problem for me:

2008-09-14  Markus Triska  <markus.triska <at> gmx.at>

	* textmodes/flyspell.el (flyspell-math-tex-command-p): Always
	catch errors raised in `texmathp'.
	(flyspell-tex-math-initialized): Remove.

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 47297c9..4296861 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1166,35 +1166,19 @@ Mostly we check word delimiters."
 	      res))))))))
 
 ;;*---------------------------------------------------------------------*/
-;;*    flyspell-tex-math-initialized ...                                */
-;;*---------------------------------------------------------------------*/
-(defvar flyspell-tex-math-initialized nil)
-
-;;*---------------------------------------------------------------------*/
 ;;*    flyspell-math-tex-command-p ...                                  */
 ;;*    -------------------------------------------------------------    */
-;;*    This function uses the texmathp package to check if (point)      */
-;;*    is within a tex command. In order to avoid using                 */
-;;*    condition-case each time we use the variable                     */
-;;*    flyspell-tex-math-initialized to make a special case the first   */
-;;*    time that function is called.                                    */
+;;*    This function uses the texmathp package to check if point        */
+;;*    is within a TeX math environment. `texmathp' can yield errors    */
+;;*    if the document is currently not valid TeX syntax.               */
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-math-tex-command-p ()
   (when (fboundp 'texmathp)
-    (cond
-     (flyspell-check-tex-math-command
-      nil)
-     ((eq flyspell-tex-math-initialized t)
-      (texmathp))
-     ((eq flyspell-tex-math-initialized 'error)
-      nil)
-     (t
-      (setq flyspell-tex-math-initialized t)
+    (if flyspell-check-tex-math-command
+        nil
       (condition-case nil
           (texmathp)
-        (error (progn
-                 (setq flyspell-tex-math-initialized 'error)
-                 nil)))))))
+        (error nil)))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-tex-command-p ...                                       */




Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Markus Triska <markus.triska <at> gmx.at>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #40 received at 728-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 728-done <at> debbugs.gnu.org
Subject: Re: 23.0.60; flyspell checking is sometimes silently disabled
Date: Tue, 16 Sep 2008 20:59:57 -0400
> The following patch fixes this problem for me:

Checked in, thanks.




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Wed, 15 Oct 2008 14:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 252 days ago.

Previous Next


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