Hi,

I updated amsthm a bit, and also added support for pagestyle completion
via TeX-complete-list (sorry for merging this into one email, but the
last change doesn't need a separate email, I think).  The complete
ChangeLog entry is:

2013-03-06  Mads Jensen  <[email protected]>

        * style/amsthm.el: Updated copyright year range.
        ("amsthm"): Added regular expression for
        matching newtheoremstyles.  Added completion for        \newthoremstyle.
        The new functions are used in the definition of the macros.
        Added the \swapnumbers macro.  Reformatted entries slightly.
        (TeX-arg-theoremstyle): New function.
        (TeX-arg-define-theoremstyle): New function.

        * latex.el (LaTeX-common-initialization): Added regular expression
        for thispagestyle and pagestyle to `TeX-complete-list'.
-- 
Med Venlig Hilsen / Kind Regards,
Mads Jensen
Rubinsteinsvej 31,st.th
DK-2450 Kbh. SV
Denmark
+45 6168 8518
My brain is my second favorite organ.
      -- Woody Allen
Index: amsthm.el
===================================================================
RCS file: /sources/auctex/auctex/style/amsthm.el,v
retrieving revision 1.3
diff -u -u -r1.3 amsthm.el
--- amsthm.el	3 Feb 2008 14:53:30 -0000	1.3
+++ amsthm.el	6 Mar 2013 10:41:39 -0000
@@ -1,6 +1,6 @@
 ;;; amsthm.el --- Style hook for the AMS-LaTeX amsthm package.
 
-;; Copyright (C) 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2013 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <[email protected]>
 ;; Maintainer: [email protected]
@@ -27,27 +27,53 @@
 (TeX-add-style-hook "amsthm"
  (function
   (lambda ()
+    (TeX-auto-add-type "amsthmstyle" "LaTeX")
+    (LaTeX-add-amsthmstyles "plain" "definition" "remark")
+
+    (defvar LaTeX-auto-savebox-regexp-list
+      '(("\\\\newtheoremstyle{\\\\([A-Za-z]+\\)}?" 1 LaTeX-auto-amsthmstyle))
+      "List of regular expressions matching AMS-LaTeX theoremstyles only.")
+
+    (setq TeX-complete-list
+          (append '(("\\\\newtheoremstyle{\\([A-Za-z]*\\)" 1
+                     LaTeX-amsthmstyle-list "}"))
+                  TeX-complete-list))
+
     (LaTeX-add-environments
      '("proof" (lambda (env &rest ignore)
-		 (LaTeX-insert-environment 
+		 (LaTeX-insert-environment
 		  env
 		  (let ((heading (read-string "(optional) Heading: ")))
 		    (if (string= heading "")
 			""
-		      (format "[%s]" heading))))))
-     )
+		      (format "[%s]" heading)))))))
+
     (TeX-add-symbols
      '("newtheorem" "Environment name" ["Share numbering with"] "Heading"
        ["Number subordinated in each"])
      '("newtheorem*" "Environment name" "Heading")
-     '("theoremstyle" LaTeX-amsthm-complete-theoremstyle)
-     ))))
-
-(defun LaTeX-amsthm-complete-theoremstyle (&rest ignore)
-  (insert TeX-grop
-	  (completing-read  "Style: " '(("plain" . nil)
-					("definition" . nil)
-					("remark" . nil)))
-	  TeX-grcl))
+     '("theoremstyle" TeX-arg-theoremstyle)
+     '("newtheoremstyle" TeX-arg-define-theoremstyle)
+     '("swapnumbers" 0)))))
+
+(defun TeX-arg-theoremstyle (optional &optional prompt definition)
+  "Prompt for an AMS-LaTeX theoremstyle with completion.
+If OPTIONAL is non-nil, insert the resulting value as an optional
+argument, otherwise as a mandatory one.  Use PROMPT as the prompt
+string.  If DEFINITION is non-nil, add the chosen theoremstyle to
+the list of defined theoremstyles."
+  (let ((amsthmstyle (completing-read (TeX-argument-prompt optional prompt
+							 "Theorem style")
+				    (LaTeX-amsthmstyle-list))))
+    (if (and definition (not (string-equal "" amsthmstyle)))
+	(LaTeX-add-amsthmstyles amsthmstyle))
+    (TeX-argument-insert amsthmstyle optional)))
+
+(defun TeX-arg-define-theoremstyle (optional &optional prompt)
+  "Prompt for a label completing with known labels.
+If OPTIONAL is non-nil, insert the resulting value as an optional
+argument, otherwise as a mandatory one.  Use PROMPT as the prompt
+string."
+  (TeX-arg-theoremstyle optional prompt t))
 
 ;;; amsthm.el ends here
Index: latex.el
===================================================================
RCS file: /sources/auctex/auctex/latex.el,v
retrieving revision 5.488
diff -u -u -r5.488 latex.el
--- latex.el	4 Mar 2013 09:26:50 -0000	5.488
+++ latex.el	6 Mar 2013 10:43:56 -0000
@@ -5298,7 +5298,9 @@
 		  ("\\\\renewcommand\\*?{\\\\\\([A-Za-z]*\\)"
 		   1 LaTeX-symbol-list "}")
 		  ("\\\\renewenvironment\\*?{\\([A-Za-z]*\\)"
-		   1 LaTeX-environment-list "}"))
+		   1 LaTeX-environment-list "}")
+                  ("\\\\\\(this\\)?pagestyle{\\([A-Za-z]*\\)"
+		   1 LaTeX-pagestyle-list "}"))
 		TeX-complete-list))
 
   (LaTeX-add-environments

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to