emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding % to `ispell-tex-arg-end'


From: Arash Esbati
Subject: Re: Adding % to `ispell-tex-arg-end'
Date: Sat, 09 Jul 2016 11:43:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95

Eli Zaretskii <address@hidden> writes:

>> 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.

Hmm, my Ispell (Hunspell 1.4.1, Emacs 25.0.95.1) does not check comments
at all with `ispell-check-comments' set to t, e.g.:

% mysspelled word

is not matched.  It does work when `ispell-check-comments' is set to
exclusive though.  Will play more with it and create a new case.

Best, Arash

PS: Also my congratulations to your new role!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]