Subject: Regex of (this)pagestyle in TeX-complete-list
From: Arash Esbati <[email-masked]>
To: [email-masked]
Date: Fri, 14 Aug 2015 21:32:04 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi all,

if I start emacs with `emacs --eval '(setq debug-on-error t)' &' type
the following a tex file:

    \thispagestyle{`C-M-i'

I get this error:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Can't find completion for \"\\thispagestyle{\"")
  signal(error ("Can't find completion for \"\\thispagestyle{\""))
  error("Can't find completion for \"%s\"" "\\thispagestyle{")
  TeX-complete-symbol()
  call-interactively(TeX-complete-symbol nil nil)
  command-execute(TeX-complete-symbol)
--8<---------------cut here---------------end--------------->8---

It is due to a bug in the definition of `TeX-complete-list' in
`latex.el' (line 5913):

--8<---------------cut here---------------start------------->8---
(setq TeX-complete-list
      (append '(;; snipped
		("\\\\\\(this\\)?pagestyle{\\([A-Za-z]*\\)"
		 1 LaTeX-pagestyle-list "}"))
		TeX-complete-list))
--8<---------------cut here---------------end--------------->8---

The number refers to the wrong subgroup in the regex.  There are two
ways to fix this: Make `\\(this\\)' a shy-group or replace `1' with `2'.

Please find attached a patch going the second route since it looks more
coherent to the rest of definitions in `TeX-complete-list'.  

As always, any comments welcome.

Best, Arash

From afbf77a3be746542ca210d8ef7c1f9db16ca9acf Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email-masked]>
Date: Fri, 14 Aug 2015 21:10:23 +0200
Subject: [PATCH] Fix the subgroup number in a regex.

* latex.el (LaTeX-common-initialization): Fix the subgroup number
in the regex for `\\(this\\)?pagestyle'
---
 ChangeLog | 5 +++++
 latex.el  | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 5ccb448..2e1516b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-14  Arash Esbati  <[email-masked]>
+
+	* latex.el (LaTeX-common-initialization): Fix the subgroup number
+	in the regex for `\\(this\\)?pagestyle'
+
 2015-08-10  Tassilo Horn  <[email-masked]>
 
 	* latex.el (TeX-latex-mode): Call LaTeX-preview-setup only if its
diff --git a/latex.el b/latex.el
index 5a0200a..8561535 100644
--- a/latex.el
+++ b/latex.el
@@ -5931,7 +5931,7 @@ i.e. you do _not_ have to cater for this yourself by adding \\\\' or $."
 		  ("\\\\renewenvironment\\*?{\\([A-Za-z]*\\)"
 		   1 LaTeX-environment-list-filtered "}")
                   ("\\\\\\(this\\)?pagestyle{\\([A-Za-z]*\\)"
-		   1 LaTeX-pagestyle-list "}"))
+		   2 LaTeX-pagestyle-list "}"))
 		TeX-complete-list))
 
   (LaTeX-add-environments
-- 
2.5.0