Re: [Brett Presnell] Re: Fedora Core 3: File mode specification error

Ralf Angeli <[email protected]>
Newsgroups gmane.emacs.auc-tex
Message-ID <[email protected]>
* David Kastrup (2005-01-20) writes:

> So the only question that remains is how we are going to deal with
> this ourselves.  It would appear that Fedora Core 3 has shipped with
> an Emacspeak causing the problem.  We had several reports of this by
> now if I remember correctly.

Two.

> Probably there are not many calls of regexp-opt that can be passed
> "nil".  A grep turns up quite a few calls, however.  As far as I can
> see we have stuff in font-latex.el, tex-font.el (what is that?  The
> header says "keep this in synch with Emacs-21.1 which we haven't, and
> the changelog has no entry except this having been checked into
> AUCTeX), tex.el and tex-buf.el.

tex-font.el is a rip-out of fontification code from tex-mode.el.  You
can activate it by customizing `TeX-install-font-lock'.  If there
still is demand for that we could update it when Emacs 21.4 will be
out.  But I doubt many people are still using it.

Regarding `regexp-opt': The only place where it certainly will get
passed nil is `font-latex-set-syntactic-keywords' because the
variables `font-latex-verbatim-macros' and
`font-latex-verbatim-macros-local' are nil per default.  So I think it
would be enough to check only there, that it is only called with a
non-nil value.  I don't see a need for replacing every call to
`regexp-opt' with a to-be-implemented `TeX-regexp-opt' which could
handle the nil case.  (There are likely other ways to do this.)  And
the problem will go away in the not so far future anyway.

A proposed patch is attached.  Yes, it looks ugly, but still better
than let-binding another set of variables.

-- 
Ralf
(unnamed) (text/x-patch, 1.8 KB)
Index: font-latex.el
===================================================================
RCS file: /cvsroot/auctex/auctex/font-latex.el,v
retrieving revision 5.91
diff -u -r5.91 font-latex.el
--- font-latex.el	13 Jan 2005 17:27:34 -0000	5.91
+++ font-latex.el	20 Jan 2005 15:47:12 -0000
@@ -660,15 +660,24 @@
 This function can be used to refresh the variable in case other
 variables influencing its value, like `font-latex-verbatim-environments',
 have changed."
-  (let ((verb-envs (regexp-opt
-		    (append font-latex-verbatim-environments
-			    font-latex-verbatim-environments-local)))
-	(verb-like-commands (regexp-opt
-			     (append font-latex-verb-like-commands
-				     font-latex-verb-like-commands-local)))
-	(verb-macros (regexp-opt
-		      (append font-latex-verbatim-macros
-			      font-latex-verbatim-macros-local))))
+  ;; Checks for non-emptiness of lists added in order to cater for
+  ;; installations where `(regexp-opt-group nil)' would enter an
+  ;; infinite loop.
+  (let ((verb-envs (when (or font-latex-verbatim-environments
+			     font-latex-verbatim-environments-local)
+		     (regexp-opt
+		      (append font-latex-verbatim-environments
+			      font-latex-verbatim-environments-local))))
+	(verb-like-commands (when (or font-latex-verb-like-commands
+				      font-latex-verb-like-commands-local)
+			      (regexp-opt
+			       (append font-latex-verb-like-commands
+				       font-latex-verb-like-commands-local))))
+	(verb-macros (when (or font-latex-verbatim-macros
+			       font-latex-verbatim-macros-local)
+		       (regexp-opt
+			(append font-latex-verbatim-macros
+				font-latex-verbatim-macros-local)))))
     (setq font-latex-syntactic-keywords nil)
     (unless (= (length verb-envs) 0)
       (add-to-list 'font-latex-syntactic-keywords
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.