From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Adding % to `ispell-tex-arg-end' Date: Sat, 09 Jul 2016 12:16:27 +0300 Message-ID: <83poqngoic.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1468055845 10604 80.91.229.3 (9 Jul 2016 09:17:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Jul 2016 09:17:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Arash Esbati Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 09 11:17:20 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bLoO0-0006Vc-4h for ged-emacs-devel@m.gmane.org; Sat, 09 Jul 2016 11:17:20 +0200 Original-Received: from localhost ([::1]:49510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLoNz-0003GS-2h for ged-emacs-devel@m.gmane.org; Sat, 09 Jul 2016 05:17:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLoNO-0003GK-I6 for emacs-devel@gnu.org; Sat, 09 Jul 2016 05:16:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLoNK-0000Oh-AE for emacs-devel@gnu.org; Sat, 09 Jul 2016 05:16:41 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLoNK-0000Od-6m; Sat, 09 Jul 2016 05:16:38 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1233 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bLoNH-0004JT-6B; Sat, 09 Jul 2016 05:16:35 -0400 In-reply-to: (message from Arash Esbati on Sat, 09 Jul 2016 11:02:27 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205466 Archived-At: > From: Arash Esbati > 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.