[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding % to `ispell-tex-arg-end'
From: |
Eli Zaretskii |
Subject: |
Re: Adding % to `ispell-tex-arg-end' |
Date: |
Sat, 09 Jul 2016 12:16:27 +0300 |
> From: Arash Esbati <address@hidden>
> Date: Sat, 09 Jul 2016 11:02:27 +0200
>
> when I run Ispell over the following snippet, the second [htbp] is
> matched by Ispell:
>
> \begin{figure}
> [htbp]
> \caption{foo}
> \end{figure}
>
> \begin{figure}%
> [htbp] % <== matched by Ispell
> \caption{foo}
> \end{figure}
>
> It is due to the regexp in `ispell-tex-arg-end':
>
> (defun ispell-tex-arg-end (&optional arg)
> "Skip across ARG number of braces."
> (condition-case nil
> (progn
> (while (looking-at "[ \t\n]*\\[") (forward-sexp))
> (forward-sexp (or arg 1)))
> (error
> (message "Error skipping s-expressions at point %d." (point))
> (beep)
> (sit-for 2))))
>
> Would it be possible to add "%" to this function?
>
> (defun ispell-tex-arg-end (&optional arg)
> "Skip across ARG number of braces."
> (condition-case nil
> (progn
> (while (looking-at "[ \t\n%]*\\[") (forward-sexp))
> (forward-sexp (or arg 1)))
> (error
> (message "Error skipping s-expressions at point %d." (point))
> (beep)
> (sit-for 2))))
Maybe I'm missing something, but this solution doesn't look right to
me, because if we do that, any mis-spelling in the comment after %
will be skipped. E.g., imagine this text:
\begin{figure}% mysspelled word
[htbp] % <== matched by Ispell
\caption{foo}
\end{figure}
We do want the "mysspelled" part highlighted, right? I think your
suggestion makes Ispell skip it.