From unknown Sat Aug 09 20:34:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14419: 24.3.50; ispell behaves badly with some TeX documents Resent-From: Ivan Andrus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 May 2013 05:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14419 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 14419@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136885452111726 (code B ref -1); Sat, 18 May 2013 05:22:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 May 2013 05:22:01 +0000 Received: from localhost ([127.0.0.1]:49818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdZai-000332-C4 for submit@debbugs.gnu.org; Sat, 18 May 2013 01:22:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40351) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdZag-00032i-9z for submit@debbugs.gnu.org; Sat, 18 May 2013 01:21:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdZaG-0000Pj-IL for submit@debbugs.gnu.org; Sat, 18 May 2013 01:21:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-100.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID,USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:44792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdZaG-0000Pf-EL for submit@debbugs.gnu.org; Sat, 18 May 2013 01:21:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdZaF-0004kn-F2 for bug-gnu-emacs@gnu.org; Sat, 18 May 2013 01:21:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdZaE-0000PS-DQ for bug-gnu-emacs@gnu.org; Sat, 18 May 2013 01:21:31 -0400 Received: from mail-pb0-x22c.google.com ([2607:f8b0:400e:c01::22c]:64926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdZaE-0000PM-6b for bug-gnu-emacs@gnu.org; Sat, 18 May 2013 01:21:30 -0400 Received: by mail-pb0-f44.google.com with SMTP id wz17so3911899pbc.3 for ; Fri, 17 May 2013 22:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:content-type:content-transfer-encoding:subject :message-id:date:to:mime-version:x-mailer; bh=xSFywsXzlf6p1O3KS3sWsXGrs7fMviqYkfbFqErk7z4=; b=IZrrFRk48tLFgiFC0lUzADyl/NX2pmjscjHrby3UTaQr3Hcg6bpry6cah7YhMLF0oL +KkqjYOQ5tKLLOSe1SreTnUSibX4JFLCr2darUz7e+SiOF+1HmIO5+l6/aIxViJgxM9Z pnsLsv3w9HdpMsvf8BXVleURYaVqWZaMjFNxBpY5y8thHaP18///hEkE9pPi84QJaiDC KexCY+QIpagcr6uuNPa0WhzbL1zmxWEHk5wM+3E4zN4c5OSuuoyF5skUSrC8JeIWaAPx vF/UGziaf6D1Hgpyauvn/wDVUgS02VNdazQJoOejX0JQoCyxO/N9a1S3ftj98F11/5fy C3Fw== X-Received: by 10.66.232.230 with SMTP id tr6mr53012638pac.83.1368854488576; Fri, 17 May 2013 22:21:28 -0700 (PDT) Received: from [10.0.2.30] (host-69-145-52-115.bln-mt.client.bresnan.net. [69.145.52.115]) by mx.google.com with ESMTPSA id ya4sm14096728pbb.24.2013.05.17.22.21.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 May 2013 22:21:27 -0700 (PDT) From: Ivan Andrus Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <273F0CF4-1050-4BEB-A005-5707AF9961BA@gmail.com> Date: Fri, 17 May 2013 23:21:26 -0600 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) X-Mailer: Apple Mail (2.1503) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) ispell can overlook misspellings and (more annoyingly though easier to=20= detect) can start spell checking everything in math mode. 1. emacs -Q 2. Edit the following document in latex-mode (built in or AUCTeX): % \documentclass[12pt,draft,a4paper]{report} \documentclass[12pt,a4paper]{report} \begin{document} Representation theory concerns itself with the cases when $Y$ is the = general linear group $\GL_{n}(k)$, for some field $k$. spelling is basd $badmath$ here \end{document} 3. Run ispell-buffer 4. It asks you to correct the word badmath. This is in math mode and should be skipped. Moreover, it missed basd outside of math mode. 5. Delete the commented documentclass line (or move it after the other) and things work as they are supposed to. I ran ispell-buffer-with-debug and it seems that it skips the region starting with \documentclass and ending with \begin{document}, but since there was a comment before it the first line gets treated as a comment. This is bad in and of itself if that's what's happening. However, because the _ in $\GL_{n}(k)$ matches the final element of `ispell-skip-region-alist' (not sure what the purpose of that is), the first part of the line is a comment. That last part of the line, namely {n}(k)$, for some field $k$. is the first line that the spell checker sees as not a comment and therefore it gets confused about what is math and what isn't. Other cases of skipping in comments can also lead to bad scenarios. For example in the case below no misspellings are found: % \addcontentsline{1}{2} spelling is basd $badmath$ here. Perhaps it could be fixed by a small change to ispell-region to test if the skip region is in a comment and if so, not skip that region since comments can contain all sorts of malformed TeX. I would try this, but I couldn't find a canonical way to test if point is inside a comment. Feel free to point me to one and I'll give it a shot. -Ivan From unknown Sat Aug 09 20:34:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14419: In comment References: <273F0CF4-1050-4BEB-A005-5707AF9961BA@gmail.com> In-Reply-To: <273F0CF4-1050-4BEB-A005-5707AF9961BA@gmail.com> Resent-From: Ivan Andrus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 May 2013 05:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14419 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 14419@debbugs.gnu.org Received: via spool by 14419-submit@debbugs.gnu.org id=B14419.136885547214199 (code B ref 14419); Sat, 18 May 2013 05:38:01 +0000 Received: (at 14419) by debbugs.gnu.org; 18 May 2013 05:37:52 +0000 Received: from localhost ([127.0.0.1]:49830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdZq3-0003gv-81 for submit@debbugs.gnu.org; Sat, 18 May 2013 01:37:52 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:57860) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdZq1-0003gV-7m for 14419@debbugs.gnu.org; Sat, 18 May 2013 01:37:49 -0400 Received: by mail-pb0-f46.google.com with SMTP id rq13so3896407pbb.33 for <14419@debbugs.gnu.org>; Fri, 17 May 2013 22:37:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:content-type:content-transfer-encoding:subject :message-id:date:to:mime-version:x-mailer; bh=Rjs91T0CgorKBS5+3FFwIPDzHC59/9eF+nlYn0JcEGY=; b=yji+6MMH4feZ1VMnVWjKcQoHpVMsfax9gYqp4951NuQy3Up5Ip6RVar+u9PiN2bQG+ T08S/wmC921N+F59MviilzZ0Xxs4suNp2cr+nIZYAOa0tv37rOspn5d/tx+dnJXAiHs9 g0WDitnuHAFScUiobAwQ954ke/cUdYsjnKzdJkAGW6vVoR5q/+xVHAEDzj6lKOI89SP+ 8od+vPqVoKRhM6J8/8sPAXKDvWpGuzYg9JvkioV28iufJaWpfuuak7zTuj3OzMJWIjur H+iMiCZotjhBRnjICTLG5qXIpp/5F49QI8cH4S+BFJ+DQu7gck2oOSbsxi7wTheIvlQl 8hUA== X-Received: by 10.68.24.232 with SMTP id x8mr45234680pbf.150.1368855443555; Fri, 17 May 2013 22:37:23 -0700 (PDT) Received: from [10.0.2.30] (host-69-145-52-115.bln-mt.client.bresnan.net. [69.145.52.115]) by mx.google.com with ESMTPSA id zy5sm14133971pbb.43.2013.05.17.22.37.22 for <14419@debbugs.gnu.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 May 2013 22:37:23 -0700 (PDT) From: Ivan Andrus Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: Date: Fri, 17 May 2013 23:37:22 -0600 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) X-Mailer: Apple Mail (2.1503) X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.7 (/) Okay, I realized I said something stupid after I sent the bug report. = In ispell-region itself it checks if the point is in a comment, so that = is the "canonical method". I'll have to read through it some more when = I'm less tired to see if I can fix the problem. -Ivan= From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 16 08:52:20 2014 Received: (at control) by debbugs.gnu.org; 16 Jan 2014 13:52:21 +0000 Received: from localhost ([127.0.0.1]:53012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W3nMq-0000Am-EY for submit@debbugs.gnu.org; Thu, 16 Jan 2014 08:52:20 -0500 Received: from fibonacci.ccupm.upm.es ([138.100.198.70]:41692) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W3nMn-0000Aa-9P; Thu, 16 Jan 2014 08:52:18 -0500 Received: from agmartin.aq.upm.es (Agmartin.aq.upm.es [138.100.41.131]) by smtp.upm.es (8.14.3/8.14.3/fibonacci-001) with ESMTP id s0GDqF3W004628; Thu, 16 Jan 2014 14:52:15 +0100 Received: by agmartin.aq.upm.es (Postfix, from userid 1000) id 8C1EE402B1; Thu, 16 Jan 2014 14:52:15 +0100 (CET) Date: Thu, 16 Jan 2014 14:52:15 +0100 From: Agustin Martin To: 14419-done@debbugs.gnu.org Subject: Re: bug#14419: 24.3.50; ispell behaves badly with some TeX documents Message-ID: <20140116135215.GA6512@agmartin.aq.upm.es> References: <273F0CF4-1050-4BEB-A005-5707AF9961BA@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <273F0CF4-1050-4BEB-A005-5707AF9961BA@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) forcemerge 13577 14419 thanks On Fri, May 17, 2013 at 11:21:26PM -0600, Ivan Andrus wrote: > ispell can overlook misspellings and (more annoyingly though easier to > detect) can start spell checking everything in math mode. > > > 1. emacs -Q > > 2. Edit the following document in latex-mode (built in or AUCTeX): > > > % \documentclass[12pt,draft,a4paper]{report} > \documentclass[12pt,a4paper]{report} > > \begin{document} > > Representation theory concerns itself with the cases when $Y$ is the general linear group $\GL_{n}(k)$, for some field $k$. > > spelling is basd $badmath$ here > > \end{document} > > > 3. Run ispell-buffer > > 4. It asks you to correct the word badmath. This is in math mode and > should be skipped. Moreover, it missed basd outside of math mode. > > 5. Delete the commented documentclass line (or move it after the other) > and things work as they are supposed to. Also fixed (in trunk) by commit r116025. Indeed it is the same problem. Closing bug report and merging both. Regards, -- Agustin