From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.devel Subject: Re: Adding % to `ispell-tex-arg-end' Date: Sat, 09 Jul 2016 11:43:40 +0200 Message-ID: References: <83poqngoic.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1468057477 32572 80.91.229.3 (9 Jul 2016 09:44:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Jul 2016 09:44:37 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 09 11:44:28 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 1bLooF-0001D1-5A for ged-emacs-devel@m.gmane.org; Sat, 09 Jul 2016 11:44:27 +0200 Original-Received: from localhost ([::1]:49619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLooE-0006Jf-C7 for ged-emacs-devel@m.gmane.org; Sat, 09 Jul 2016 05:44:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLonk-0006Ja-8T for emacs-devel@gnu.org; Sat, 09 Jul 2016 05:43:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLong-0005DF-0N for emacs-devel@gnu.org; Sat, 09 Jul 2016 05:43:55 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLonf-0005DA-Pg for emacs-devel@gnu.org; Sat, 09 Jul 2016 05:43:51 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bLone-0000vb-Al for emacs-devel@gnu.org; Sat, 09 Jul 2016 11:43:50 +0200 Original-Received: from p4fed17b2.dip0.t-ipconnect.de ([79.237.23.178]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 09 Jul 2016 11:43:50 +0200 Original-Received: from esbati by p4fed17b2.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 09 Jul 2016 11:43:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 67 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p4fed17b2.dip0.t-ipconnect.de Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:205467 Archived-At: Eli Zaretskii writes: >> 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. 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!