emacs flyspell disable for custom latex macros

151 Views Asked by At

I have the following LaTeX code which has some custom macro's and environments which i would like to exclude from flyspell.

Some normal text

\begin{customenv}
Please dont flyspell-this
\end{customenv}

again some normal text (please flyspell this) and some \customcode{dont-flyspell-this}.

I know I need to write a function to pass to flyspell-mode-predicate but I'm haveing some trouble getting it to work for both the \customcode and the \begin{customenv} and \end{customenv}.

Any suggestions are welcome.

Update: It seems i can set the following:

(setq flyspell-tex-command-regexp
"\\(\\((\\(begin\\|end\\)[ \t]*{\\|\\(cite[a-z*]*\\|label\\|ref\\|eqref\\|usepackage\\|documentclass\\|customcode\\)[ \t]*\\(\\[[^]]*\\]\\)?{[^{}]*\\)\\|\\\\begin{\\(customenv[1-9]*\\)}\\(.\\|\n\\)*\\\\end{\\(customenv[1-9]*\\)}\\)")

This seems to work for the \customcode{stuff} but it still doesn't skip the text in customenv

0

There are 0 best solutions below