Mercurial > emacs
comparison lisp/textmodes/flyspell.el @ 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 | 77a81df8971f |
children | e7cd485b79ff |
comparison
equal
deleted
inserted
replaced
98199:6c0794cd3864 | 98200:4f3b2bef6df0 |
---|---|
1164 (goto-char cursor-location) | 1164 (goto-char cursor-location) |
1165 (if ispell-quit (setq ispell-quit nil)) | 1165 (if ispell-quit (setq ispell-quit nil)) |
1166 res)))))))) | 1166 res)))))))) |
1167 | 1167 |
1168 ;;*---------------------------------------------------------------------*/ | 1168 ;;*---------------------------------------------------------------------*/ |
1169 ;;* flyspell-tex-math-initialized ... */ | |
1170 ;;*---------------------------------------------------------------------*/ | |
1171 (defvar flyspell-tex-math-initialized nil) | |
1172 | |
1173 ;;*---------------------------------------------------------------------*/ | |
1174 ;;* flyspell-math-tex-command-p ... */ | 1169 ;;* flyspell-math-tex-command-p ... */ |
1175 ;;* ------------------------------------------------------------- */ | 1170 ;;* ------------------------------------------------------------- */ |
1176 ;;* This function uses the texmathp package to check if (point) */ | 1171 ;;* This function uses the texmathp package to check if point */ |
1177 ;;* is within a tex command. In order to avoid using */ | 1172 ;;* is within a TeX math environment. `texmathp' can yield errors */ |
1178 ;;* condition-case each time we use the variable */ | 1173 ;;* if the document is currently not valid TeX syntax. */ |
1179 ;;* flyspell-tex-math-initialized to make a special case the first */ | |
1180 ;;* time that function is called. */ | |
1181 ;;*---------------------------------------------------------------------*/ | 1174 ;;*---------------------------------------------------------------------*/ |
1182 (defun flyspell-math-tex-command-p () | 1175 (defun flyspell-math-tex-command-p () |
1183 (when (fboundp 'texmathp) | 1176 (when (fboundp 'texmathp) |
1184 (cond | 1177 (if flyspell-check-tex-math-command |
1185 (flyspell-check-tex-math-command | 1178 nil |
1186 nil) | |
1187 ((eq flyspell-tex-math-initialized t) | |
1188 (texmathp)) | |
1189 ((eq flyspell-tex-math-initialized 'error) | |
1190 nil) | |
1191 (t | |
1192 (setq flyspell-tex-math-initialized t) | |
1193 (condition-case nil | 1179 (condition-case nil |
1194 (texmathp) | 1180 (texmathp) |
1195 (error (progn | 1181 (error nil))))) |
1196 (setq flyspell-tex-math-initialized 'error) | |
1197 nil))))))) | |
1198 | 1182 |
1199 ;;*---------------------------------------------------------------------*/ | 1183 ;;*---------------------------------------------------------------------*/ |
1200 ;;* flyspell-tex-command-p ... */ | 1184 ;;* flyspell-tex-command-p ... */ |
1201 ;;*---------------------------------------------------------------------*/ | 1185 ;;*---------------------------------------------------------------------*/ |
1202 (defun flyspell-tex-command-p (word) | 1186 (defun flyspell-tex-command-p (word) |