From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ralf Angeli Newsgroups: gmane.emacs.devel Subject: Re: [cs-usenet@arcor.de: tex-mode: too many _ (underscores) interpreted as subscripts] Date: Tue, 05 Oct 2004 11:56:03 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1096970131 11538 80.91.229.6 (5 Oct 2004 09:55:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 5 Oct 2004 09:55:31 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 05 11:55:20 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CEm2S-0004ca-00 for ; Tue, 05 Oct 2004 11:55:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CEm95-0001Op-Be for ged-emacs-devel@m.gmane.org; Tue, 05 Oct 2004 06:02:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CEm7Y-0000jb-81 for emacs-devel@gnu.org; Tue, 05 Oct 2004 06:00:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CEm7W-0000ij-52 for emacs-devel@gnu.org; Tue, 05 Oct 2004 06:00:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CEm7V-0000ig-Ho for emacs-devel@gnu.org; Tue, 05 Oct 2004 06:00:34 -0400 Original-Received: from [80.91.229.2] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CEm0l-0004Lj-HP for emacs-devel@gnu.org; Tue, 05 Oct 2004 05:53:35 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1CEm0j-0004ik-00 for ; Tue, 05 Oct 2004 11:53:33 +0200 Original-Received: from iwi190.iwi.uni-sb.de ([134.96.72.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Oct 2004 11:53:33 +0200 Original-Received: from angeli by iwi190.iwi.uni-sb.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Oct 2004 11:53:33 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-To: emacs-devel@gnu.org Original-Lines: 36 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: iwi190.iwi.uni-sb.de Mail-Copies-To: nobody User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:QAjcFUgMVhM64QjhEZcPZ940IrI= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 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 Xref: main.gmane.org gmane.emacs.devel:27927 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27927 * Richard Stallman (2004-10-04) writes: > If this should be fixed for arbitrary LaTeX commands which are not > fontified, one would have to check if the underscores in concern are > located inside of math environments. > > \nolinkurl and \url are not related to math. Is there an intermediate > possibility, one that doesn't check specifically for math > environments, but handles all the constructs that are not related to > math? None I know of. Unescaped underscores can be used in a variety of places; in labels, references, verbatim commands/environments, math commands/environments etc. The current implementation searches for occurences of unescaped underscores in the buffer and checks for the presence of certain faces. If it finds e.g. `tex-verbatim-face', it knows that there is no math-related content and skips this occurence. If there is no such face, it assumes that it is inside of a math command or environment and fontifies the stuff after the underscore. This may cause false fontifications. If the code wanted to check if the (unfontified) underscore at hand is part of math content it would have to search for constructs starting or ending math (that's what `texmathp' does). So for each underscore you could end up scanning a large part of the buffer. A way out of this could be to scan the buffer linearly from start to end and stop only at math-related content for the fontification of subscripts and superscripts. (Of course, for JIT fontification one would have to look upwards in the buffer when fontification starts.) > Meanwhile, why is texmathp so slow? -- Ralf