unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Arash Esbati <esbati@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: Adding % to `ispell-tex-arg-end'
Date: Sat, 09 Jul 2016 12:16:27 +0300	[thread overview]
Message-ID: <83poqngoic.fsf@gnu.org> (raw)
In-Reply-To: <nlqejm$ukb$1@ger.gmane.org> (message from Arash Esbati on Sat, 09 Jul 2016 11:02:27 +0200)

> From: Arash Esbati <esbati@gmx.de>
> 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.



  reply	other threads:[~2016-07-09  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-09  9:02 Adding % to `ispell-tex-arg-end' Arash Esbati
2016-07-09  9:16 ` Eli Zaretskii [this message]
2016-07-09  9:43   ` Arash Esbati

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83poqngoic.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=esbati@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).