changeset 98200:4f3b2bef6df0

(flyspell-math-tex-command-p): Always catch errors raised in `texmathp'. (flyspell-tex-math-initialized): Remove.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 17 Sep 2008 00:55:38 +0000
parents 6c0794cd3864
children 1d82f8f9b231
files lisp/textmodes/flyspell.el
diffstat 1 files changed, 6 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/flyspell.el	Wed Sep 17 00:54:53 2008 +0000
+++ b/lisp/textmodes/flyspell.el	Wed Sep 17 00:55:38 2008 +0000
@@ -1166,35 +1166,19 @@
 	      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 ...                                       */