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

From: Ikumi Keita <[email-masked]>
Date: Fri, 03 Feb 2017 19:20:34 +0900

Hi Tassilo,

>> 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.

> Oh, I didn't think about it.  But after a short test it seems that
> foo\|bar is equivalent to \(foo\|bar\) and not to fo\(o\|b\)ar which you
> seem to expect (and which sounded more plausible to me, too).

Ah, no, my concern is in the way how "\`" and "\'" are interpreted.  The
original regexp \`a5paper\|a5comb\' means
"\`a5paper" or "a5comb\'",
not
"\`a5paper\'" or "\`a5comb\'".
That is, \`a5paper\|a5comb\' matches with "a5paperXYZ" and "XYZa5comb"
while \`\(?:a5paper\|a5comb\)\' does not.

>> 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?

> Yes, makes sense.

> Could you do me a favor and submit a one-in-all patch which also
> contains your changes from your later 2 changes with a ChangeLog-like
> commit message?

OK, the patch is attached at the last of this mail.

> Bye,
> Tassilo

> BTW: You are a contributor since a very long time (12 years!) and I
> completely trust your ability to not mess up things beyond repair.  So
> I'd happily give you push access to our repository if you want to.
> Interested?

Thank you very much.  I would like to recieve that honor.  Please tell
me what I should do next.

Regards,
Ikumi Keita

>From [email-masked] Fri Feb 03 19:12:26 2017
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [PATCH] Fix minor problems
X-Mercurial-Node: 74d3eda9719c056c2a758350afdcca19657640f3
X-Mercurial-Series-Index: 1
X-Mercurial-Series-Total: 1
Message-Id: <[email-masked]>
X-Mercurial-Series-Id: <[email-masked]>
User-Agent: Mercurial-patchbomb/4.0.1
Date: Fri, 03 Feb 2017 19:12:26 +0900
From: Ikumi Keita <[email-masked]>
To: dummy

* tex.el (TeX-view-predicate-list-builtin): Enclose whole alternatives
in regexp with shy group in order that the effect of "\`" and "\'"
covers all the alternatives.
* latex.el (LaTeX-auto-cleanup): Regard "Class", in addition to
"class", as an indicator of LaTeX2e document.

diff --git a/latex.el b/latex.el
--- a/latex.el
+++ b/latex.el
@@ -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 --git a/tex.el b/tex.el
--- a/tex.el
+++ b/tex.el
@@ -1167,18 +1167,18 @@
     (mode-io-correlate
      TeX-source-correlate-mode)
     (paper-landscape
-     (and (fboundp 'LaTeX-provided-class-options)
+     (and (fboundp 'LaTeX-match-class-option)
 	  (LaTeX-match-class-option "\\`landscape\\'")))
     (paper-portrait
-     (not (and (fboundp 'LaTeX-provided-class-options)
+     (not (and (fboundp 'LaTeX-match-class-option)
 	       (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)))))