Subject: Re: bug#25563: 11.90; Many predicates in TeX-view-predicate-list-builtin don't work.

From: Ikumi Keita <[email-masked]>
Date: Thu, 02 Feb 2017 22:58:23 +0900

Hi Tassilo,

> I think I've fixed this in commit
> c0f3659059a138aaf5fa610f2913035d63225bfb.

Thanks, the problem is fixed now.

> For paper-a4 and paper-a5 I wasn't quite sure if at least some of the
> regexes there could also be styles/packages so there I check both
> styles and documentclass options.  If you know better than me, feel
> free to make that more specific.

Sorry, I am not familiar about that issue either.

And just some minor comments about the code related to the problem.

1. Isn't the the regexp \`a5paper\|a5comb\' for paper-a5 really intended
   as \`\(?:a5paper\|a5comb\)\' ?  Similar question goes to the regexp
   for paper-a4, too.
2. `LaTeX-auto-cleanup' treats "package" and "Package" equally at the
   part
        (if (or (string-equal "package" class)
                (string-equal "Package" class))
   .  Thus the later part
	(cond (equal class "class")
	      (add-to-list 'TeX-auto-file "latex2e"))
   shuold also treat "class" and "Class" equally, shouldn't it?  The
   variable `LaTeX-auto-class-regexp-list' contains lines
    ;; \LoadClass[<options>]{<package>}[<date>]
    ("\\\\Load\\(Class\\)\\(\\[\\([^#\\.%]*?\\)\\]\\)?{\\([^#\\.\n\r]+?\\)}"
     (3 4 1) LaTeX-auto-style)
    ;; \LoadClassWithOptions{<package>}[<date>]
    ("\\\\Load\\(Class\\)WithOptions\\(\\){\\([^#\\.\n\r]+?\\)}"
     (2 3 1) LaTeX-auto-style)
  , with capitalized word "Class".

I attach a patch based on the above idea.

Bye,
Ikumi Keita

diff -r c52403a42881 latex.el
--- a/latex.el	Wed Dec 21 22:58:09 2016 +0900
+++ b/latex.el	Thu Feb 02 22:50:17 2017 +0900
@@ -1799,9 +1799,10 @@
 			      (list (cons style options)))))
 
 	;; The third argument if "class" indicates LaTeX2e features.
-	(cond ((equal class "class")
+	(cond ((or (string-equal class "class")
+		   (string-equal class "Class"))
 	       (add-to-list 'TeX-auto-file "latex2e"))
-	      ((equal class "style")
+	      ((string-equal class "style")
 	       (add-to-list 'TeX-auto-file "latex2"))))))
 
   ;; Cleanup optional arguments
diff -r c52403a42881 tex.el
--- a/tex.el	Wed Dec 21 22:58:09 2016 +0900
+++ b/tex.el	Thu Feb 02 22:50:17 2017 +0900
@@ -1173,12 +1173,12 @@
      (not (and (fboundp 'LaTeX-provided-class-options)
 	       (LaTeX-match-class-option "\\`landscape\\'"))))
     (paper-a4
-     (let ((regex "\\`a4paper\\|a4dutch\\|a4wide\\|sem-a4\\'"))
+     (let ((regex "\\`\\(?:a4paper\\|a4dutch\\|a4wide\\|sem-a4\\)\\'"))
        (or (TeX-match-style regex)
 	   (and (fboundp 'LaTeX-match-class-option)
 		(LaTeX-match-class-option regex)))))
     (paper-a5
-     (let ((regex "\\`a5paper\\|a5comb\\'"))
+     (let ((regex "\\`\\(?:a5paper\\|a5comb\\)\\'"))
        (or (TeX-match-style regex)
 	   (and (fboundp 'LaTeX-match-class-option)
 		(LaTeX-match-class-option regex)))))