emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] elpa e2be637 34/35: Merge branch 'master' into elpa


From: Tassilo Horn
Subject: [elpa] elpa e2be637 34/35: Merge branch 'master' into elpa
Date: Thu, 1 Sep 2016 15:57:50 +0000 (UTC)

branch: elpa
commit e2be63700c058312f3c96ff92715bc53b46026f2
Merge: 8eca45c 12bfe80
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Merge branch 'master' into elpa
---
 Makefile.in        |    6 +-
 doc/auctex.texi    |  196 +++++++++++++++++--
 doc/changes.texi   |   14 +-
 doc/macros.texi    |   16 +-
 doc/todo.texi      |    4 -
 latex.el           |   12 +-
 style/amsthm.el    |    8 +-
 style/commath.el   |  102 ++++++++++
 style/empheq.el    |  504 ++++++++++++++++++++++++++++++++++++++++++++++++
 style/enumitem.el  |   11 +-
 style/environ.el   |    2 +-
 style/framed.el    |   52 +++++
 style/listings.el  |    4 +-
 style/mathtools.el |  442 ++++++++++++++++++++++++++++++++++--------
 style/menukeys.el  |  539 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 style/ntheorem.el  |    8 +-
 style/paracol.el   |  274 ++++++++++++++++++++++++++
 style/pdflscape.el |   44 +++++
 style/splitidx.el  |   10 +-
 style/theorem.el   |    8 +-
 style/xcolor.el    |   15 +-
 tex-buf.el         |   11 +-
 tex-fold.el        |    2 +-
 tex-ispell.el      |  289 ++++++++++++++++++++++++++++
 tex-jp.el          |  139 ++++++++++----
 tex.el             |  132 +++++++++++--
 26 files changed, 2660 insertions(+), 184 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 23bf4a5..014f5be 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -84,7 +84,7 @@ MULEELC = @MULEELC@
 AUCSRC = tex.el tex-buf.el tex-style.el plain-tex.el latex.el tex-info.el \
        texmathp.el multi-prompt.el tex-mik.el font-latex.el tex-font.el \
        context.el context-en.el context-nl.el tex-fold.el \
-       toolbar-x.el tex-bar.el bib-cite.el
+       toolbar-x.el tex-bar.el bib-cite.el tex-ispell.el
 AUCELC = $(AUCSRC:.el=.elc)
 
 STYLESRC = style/prosper.el \
@@ -154,7 +154,9 @@ STYLESRC = style/prosper.el \
           style/fontenc.el   style/Alegreya.el  style/gloss-italian.el \
           style/newfloat.el  style/subcaption.el style/AlegreyaSans.el \
           style/hologo.el    style/theorem.el   style/ntheorem.el \
-          style/splitidx.el  style/tikz.el      style/xcolor.el
+          style/splitidx.el  style/tikz.el      style/xcolor.el \
+          style/pdflscape.el style/commath.el   style/empheq.el \
+          style/framed.el    style/paracol.el   style/menukeys.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 80014d9..673b6ad 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2597,10 +2597,10 @@ the @TeX{} code @code{\alpha \times \beta} will be 
displayed as @code{α
 × β}.  When point is on one of the characters, it'll be unprettified
 automatically, meaning you see the verbatim text again.
 
-To enable prettification in @AUCTeX, simply add
+To enable prettification in @AUCTeX{}, simply add
 @code{prettify-symbols-mode} to @code{TeX-mode-hook}.  If you enabled
 prettification globally with @code{global-prettify-symbols-mode}, then
-it's automatically enabled in @AUCTeX, too.
+it's automatically enabled in @AUCTeX{}, too.
 
 You can also add custom symbol unicode-character pairs for
 prettification by adding to @code{tex--prettify-symbols-alist}.  Note
@@ -2876,6 +2876,126 @@ If nil, just check the current file.
 Used when checking if any files have changed.
 @end defopt
 
address@hidden ispell
+When performing spell checking on a document or a region (invoked
+through @AUCTeX{}'s @samp{Spell} command or @kbd{M-x ispell RET}), you
+want the spell checking program to skip certain macro arguments and
+environments, most notably the arguments of referencing macros and the
+contents of verbatim environments.  The skipped parts are controlled by
+variable @code{ispell-tex-skip-alists} provided by @file{ispell.el}.
address@hidden has a library which can be added to this variable depending on
+the value of @code{TeX-ispell-extend-skip-list} which is set to @code{t}
+by default.
+
address@hidden TeX-ispell-extend-skip-list
+This boolean option controls whether @AUCTeX{} activates its extension
+for skipping certain macro arguments and environments when spell
+checking.
+
+When address@hidden, @AUCTeX{} loads the file @file{tex-ispell.el} and
+adds its content to @code{ispell-tex-skip-alists}.  This library can and
+will never be complete, but the interface can be used to add selected
+and private macro names within your init file or on a file local basis.
+
address@hidden has the following structure:
address@hidden
+(defvar ispell-tex-skip-alists
+  '((;; First list
+     ("\\\\addcontentsline"         ispell-tex-arg-end 2)
+     ("\\\\\\([aA]lph\\|arabic\\)"  ispell-tex-arg-end)
+     ("\\\\makebox"                 ispell-tex-arg-end 0)
+     ("\\\\documentclass" . "address@hidden@}"))
+    (;; Second list
+     ("\\(figure\\|table\\)\\*?"  ispell-tex-arg-end 0)
+     ("list"                      ispell-tex-arg-end 2)
+     ("verbatim\\*?" . "address@hidden@}")))
+  "*Lists of regions to be skipped in TeX mode.
+First list is used raw.
+Second list has key placed inside address@hidden@}.")
address@hidden lisp
+Each item is an alist and the structure of it is described in
address@hidden:
address@hidden
+(defvar ispell-skip-region-alist
+  '((...))
+  "Alist expressing beginning and end of regions not to spell check.
+The alist key must be a regular expression.
+Valid forms include:
+  (KEY) - just skip the key.
+  (KEY . REGEXP) - skip to the end of REGEXP.
+                   REGEXP may be string or symbol.
+  (KEY REGEXP) - skip to end of REGEXP.  REGEXP must be a string.
+  (KEY FUNCTION ARGS) - FUNCTION called with ARGS
+                        returns end of region.")
address@hidden lisp
+
+Let's go through the first list of @code{ispell-tex-skip-alists} line by
+line:
address@hidden
+("\\\\addcontentsline"         ispell-tex-arg-end 2)
address@hidden lisp
address@hidden is the string @code{"\\\\addcontentsline"}, @code{FUNCTION}
+is @code{ispell-tex-arg-end} called with @code{ARGS}, here @code{2}.
address@hidden is a function provided by @file{ispell.el}
+which skips as many subsequent optional arguments in square brackets as
+it sees and then skips @code{ARGS} number of mandatory arguments in
+braces.  Omitting @code{ARGS} means skip @code{1} mandatory argument.
+In practice, when you have something like this in your document:
address@hidden
address@hidden@address@hidden@address@hidden address@hidden
address@hidden example
+The first two arguments are left out and @samp{Some text} will be spell
+checked.  For the next line
address@hidden
+("\\\\\\([aA]lph\\|arabic\\)"  ispell-tex-arg-end)
address@hidden lisp
+the name of the counter as argument is skipped.  Next line is
address@hidden
+("\\\\makebox"                 ispell-tex-arg-end 0)
address@hidden lisp
+where only optional arguments are skipped, the first mandatory argument
+is checked, e.g.
address@hidden
address@hidden address@hidden
address@hidden example
+Finally, the next line
address@hidden
+("\\\\documentclass" . "address@hidden@}"))
address@hidden lisp
+ensures that the entire preamble of a document is discarded.  Second
+list works the same; it is more convenient for environments since
address@hidden is wrapped inside @address@hidden@}}.
+
address@hidden provides two functions to add items to car and cdr of
address@hidden, namely @code{TeX-ispell-skip-setcar} and
address@hidden  The argument of these functions is
+exactly as in @code{ispell-tex-skip-alists}.  Additions can be done via
+init file, e.g.:
address@hidden
+(eval-after-load "tex-ispell"
+  '(progn
+     (TeX-ispell-skip-setcar
+      '(("\\\\mymacro" ispell-tex-arg-end)))
+     (TeX-ispell-skip-setcdr
+      '(("myverbatim" . "address@hidden@}")))))
address@hidden lisp
+Another possibility is to use file local additions at the end of your
address@hidden file, e.g.:
address@hidden
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% eval: (TeX-ispell-skip-setcar '(("\\\\mymacro" . "@address@hidden")))
+%%% End:
address@hidden example
+
address@hidden TeX-ispell-tex-arg-end
+Finally, @AUCTeX{} provides a function called
address@hidden which sees more arguments than
address@hidden  Refer to its doc string for more
+information.
address@hidden defopt
+
 @node Processor Options
 @subsection Options for @TeX{} Processors
 
@@ -3342,6 +3462,49 @@ from the viewer, typically by a mouse click.  Refer to 
the documentation
 of your viewer to find out how it has to be configured and what you have
 to do exactly.  In xdvi you normally have to use @kbd{C-down-mouse-1}.
 
address@hidden TeX-source-correlate-start-server
+Note that inverse search with the Evince PDF viewer or its MATE fork
+Atril might fail in raising the Emacs frame after updating point in your
+document's buffer.  There is simply no way to raise the Emacs frame
+reliably accross different operating systems and different window
+managers with their different focus stealing policies.  If the Emacs
+frame is not raised after performing an inverse search from Evince or
+Atril, you can customize the following option.
+
address@hidden TeX-raise-frame-function
+A function that will be called after performing an inverse search from
+Evince or Atril in order to raise the current Emacs frame.
+
+If your Emacs frame is already raised in that situation, just
+leave this variable set to its default value
address@hidden  Otherwise, here are some alternative
+settings that work for some users.
+
address@hidden
+;; Alternative 1: For some users, `x-focus-frame' works.  Note
+;; that this function requires Emacs 24+.
+(setq TeX-raise-frame-function #'x-focus-frame)
+
+;; Alternative 2: Under GNOME 3.20 (and probably others), it
+;; seems some focus stealing prevention policy prohibits that
+;; some window gets the focus immediately after the user has
+;; clicked in some other window.  Here waiting a bit before
+;; issuing the request seems to work.
+(setq TeX-raise-frame-function
+      (lambda ()
+       (run-at-time 0.5 nil #'x-focus-frame)))
+
+;; Alternative 3: Use the external wmctrl tool in order to
+;; force Emacs into the focus.
+(setq TeX-raise-frame-function
+      (lambda ()
+       (call-process
+        "wmctrl" nil nil nil "-i" "-R"
+        (frame-parameter (selected-frame) ’outer-window-id))))
address@hidden lisp
address@hidden defopt
+
+
 @node Debugging
 @section Catching the errors
 @cindex Debugging
@@ -4040,8 +4203,8 @@ address@hidden for Japanese, address@hidden and 
address@hidden for Korean.  The
 
 Note that Unicode is not fully supported in Emacs 21 and XEmacs 21.
 @acronym{CJK} characters are not usable.  Please use the
address@hidden@acronym{UCS} EmacsLisp package or Emacs 22 (not released
-yet) if you need @acronym{CJK}.
address@hidden@acronym{UCS} EmacsLisp package or Emacs 22 and later if
+you need @acronym{CJK}.
 
 @c FIXME: We need more information for CTeX, ChinaTeX, KTeX, and HLaTeX.
 
@@ -4273,8 +4436,7 @@ If nil do it the other way round.
 @cindex address@hidden
 @cindex @file{tex-jp.el}
 @vindex TeX-default-mode
address@hidden japanese-TeX-command-default
address@hidden japanese-LaTeX-command-default
address@hidden japanese-TeX-engine-default
 @vindex japanese-LaTeX-default-style
 
 To write Japanese text with @AUCTeX{}, you need to have versions of
@@ -4304,16 +4466,10 @@ set the variable like this:
 @end lisp
 @end defopt
 
address@hidden japanese-TeX-command-default
-The default command for @code{TeX-command} in Japanese @TeX{} mode.
address@hidden japanese-TeX-engine-default
+The default TeX engine in Japanese @TeX{} mode.
 
-The default value is @samp{"pTeX"}.
address@hidden defopt
-
address@hidden japanese-LaTeX-command-default
-The default command for @code{TeX-command} in Japanese @LaTeX{} mode.
-
-The default value is @samp{"LaTeX"}.
+The default value is @samp{ptex}.
 @end defopt
 
 @defopt japanese-LaTeX-default-style
@@ -4322,6 +4478,16 @@ The default style/class when creating a new Japanese 
@LaTeX{} document.
 The default value is @samp{"jarticle"}.
 @end defopt
 
+The former customize options @code{japanese-TeX-command-default} and
address@hidden are obsolete.  Use
address@hidden instead.  If you need to customize
+the executable file name such as @samp{"latex"}, the options for them,
+or both, customize @code{TeX-engine-alist}.
+
+Also, the option @code{japanese-TeX-command-list} is considered as
+semi-obsolete.  It still functions as before, but in theory, it is not
+required anymore in normal use.
+
 See @file{tex-jp.el} for more information.
 
 @node Automatic
diff --git a/doc/changes.texi b/doc/changes.texi
index d819cc0..a14ff2e 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -12,6 +12,18 @@
 
 @itemize @bullet
 @item
address@hidden has a new Ispell dictionary @file{tex-ispell.el} for macros
+and environments which will be skipped during spell checking.  The
+activiation of this feature is controlled by a new customize option
address@hidden, which is set to @code{t} and
+activated by default.
+
address@hidden
address@hidden has a new customize option @code{TeX-raise-frame-function}
+that is currently only used by Evince and Atril inverse search to raise
+the Emacs frame.
+
address@hidden
 @AUCTeX{} now has limited support for the TikZ package.  For the moment,
 this includes some basic support for prompting the user of arguments to
 the @samp{\draw} macro.
@@ -41,7 +53,7 @@ A new option, @code{TeX-PDF-from-DVI}, controls if and how to 
produce a
 obsolete and may be removed in future releases.
 
 @item
-Support for a number of external viewers has been addedd:
+Support for a number of external viewers has been added:
 @itemize
 @item
 Atril viewer.  Forward and inverse search requires version 1.9.1 or
diff --git a/doc/macros.texi b/doc/macros.texi
index fdf37a0..4162d05 100644
--- a/doc/macros.texi
+++ b/doc/macros.texi
@@ -64,10 +64,18 @@ font-latex
   \def\TeX#1{TeX#1}%
   \def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}}
 \xdef\indexnofonts{\the\toks0}
-\toks0\expandafter{\commondummies
-  \def\TeX#1{TeX#1}%
-  \def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}}
-\xdef\commondummies{\the\toks0}
+\ifx\commondummies\undefined \else
+  \toks0\expandafter{\commondummies
+    \def\TeX#1{TeX#1}%
+    \def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}}
+  \xdef\commondummies{\the\toks0}
+\fi
+\ifx\definedummies\undefined \else
+  \toks0\expandafter{\definedummies
+    \def\TeX#1{TeX#1}%
+    \def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}}
+  \xdef\definedummies{\the\toks0}
+\fi
 \ifx\acronym\undefined \gdef\acronym#1{{\smallcaps \lowercase{#1}}} \fi
 \ifx\env\undefined \global\let\env=\code \fi
 \ifx\option\undefined \global\let\option=\samp \fi
diff --git a/doc/todo.texi b/doc/todo.texi
index 8025351..c21d816 100644
--- a/doc/todo.texi
+++ b/doc/todo.texi
@@ -76,10 +76,6 @@ used to insert an appropriate @samp{\usepackage} statement 
if the user
 tries to insert a macro for which the respective package has not been
 requested yet.
 
address@hidden Spell checking of macros
-
-A special ispell dictionary for macros could be nice to have.
-
 @item Improvements to error reporting
 
 Fringe indicators for errors in the main text would be nice.
diff --git a/latex.el b/latex.el
index 16d6760..c21699d 100644
--- a/latex.el
+++ b/latex.el
@@ -30,6 +30,7 @@
 
 (require 'tex)
 (require 'tex-style)
+(require 'tex-ispell)
 (eval-when-compile (require 'cl))       ;FIXME: Use cl-lib.
 
 ;;; Syntax
@@ -2995,7 +2996,10 @@ consideration just as is in the non-commented source 
code."
     ("tabbing"))
     "Alist of environments with special indentation.
 The second element in each entry is the function to calculate the
-indentation level in columns."
+indentation level in columns.
+
+Environments present in this list are not filled by filling
+functions, see `LaTeX-fill-region-as-paragraph'."
     :group 'LaTeX-indentation
     :type '(repeat (list (string :tag "Environment")
                         (option function))))
@@ -3457,7 +3461,11 @@ Break lines to fit `fill-column', but leave all lines 
ending with
 \\\\ \(plus its optional argument) alone.  Lines with code
 comments and lines ending with `\par' are included in filling but
 act as boundaries.  Prefix arg means justify too.  From program,
-pass args FROM, TO and JUSTIFY-FLAG."
+pass args FROM, TO and JUSTIFY-FLAG.
+
+You can disable filling inside a specific environment by adding
+it to `LaTeX-indent-environment-list', only indentation is
+performed in that case."
   (interactive "*r\nP")
   (let ((end-marker (save-excursion (goto-char to) (point-marker))))
     (if (or (assoc (LaTeX-current-environment) LaTeX-indent-environment-list)
diff --git a/style/amsthm.el b/style/amsthm.el
index 5deb9e3..fee2843 100644
--- a/style/amsthm.el
+++ b/style/amsthm.el
@@ -73,14 +73,14 @@ argument.  Use PROMPT as the prompt string."
 for label.  AUCTeX users should add ENVIRONMENT to
 `LaTeX-label-alist' via customize or in init-file with:
 
-  (add-to-list 'LaTeX-label-alist '(\"lemma\" . \"lem:\"))
+  (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
 
 RefTeX users should customize or add ENVIRONMENT to
 `LaTeX-label-alist' and `reftex-label-alist', e.g.
 
-  (add-to-list 'LaTeX-label-alist '(\"lemma\" . \"lem:\"))
-  (add-to-list 'reftex-label-alist
-              '(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
+  (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
+  (add-to-list \\='reftex-label-alist
+              \\='(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
                 nil (\"Lemma\" \"lemma\") nil))"
   (let ((opthead (TeX-read-string
                  (TeX-argument-prompt t nil "Heading"))))
diff --git a/style/commath.el b/style/commath.el
new file mode 100644
index 0000000..fd42550
--- /dev/null
+++ b/style/commath.el
@@ -0,0 +1,102 @@
+;;; commath.el --- AUCTeX style for `commath.sty' (v0.3)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-07-31
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `commath.sty' (v0.3) from 2006/07/18.
+;; `commath.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "commath"
+ (lambda ()
+
+   ;; Only load amsmath.el, ifthen.el is not necessary
+   (TeX-run-style-hooks "amsmath")
+
+   (TeX-add-symbols
+    '("dif" 0)
+    '("Dif" 0)
+    '("od" [ "Order of differentiation" ] "Function" "Variable")
+    '("tod" [ "Order of differentiation" ] "Function" "Variable")
+    '("dod" [ "Order of differentiation" ] "Function" "Variable")
+    '("pd" [ "Order of differentiation" ] "Function" "Variable")
+    '("tpd" [ "Order of differentiation" ] "Function" "Variable")
+    '("dpd" [ "Order of differentiation" ] "Function" "Variable")
+    '("md" 6)
+    '("tmd" 6)
+    '("dmd" 6)
+    '("del" [ "Size argument (0..4)" ] "Argument")
+    '("cbr" [ "Size argument (0..4)" ] "Argument")
+    '("set" [ "Size argument (0..4)" ] "Argument")
+    '("sbr" [ "Size argument (0..4)" ] "Argument")
+    '("intoo" [ "Size argument (0..4)" ] "Argument")
+    '("intcc" [ "Size argument (0..4)" ] "Argument")
+    '("intoc" [ "Size argument (0..4)" ] "Argument")
+    '("intco" [ "Size argument (0..4)" ] "Argument")
+    '("eval" [ "Size argument (0..4)" ] t)
+    '("sVert" [ "Size argument (0..4)" ])
+    '("envert" [ "Size argument (0..4)" ] "Argument")
+    '("abs" [ "Size argument (0..4)" ] "Argument")
+    '("enVert" [ "Size argument (0..4)" ] "Argument")
+    '("norm" [ "Size argument (0..4)" ] "Argument")
+    '("fullfunction" 5)
+
+    ;; Referencing macros
+    '("thmref" TeX-arg-ref)
+    '("exref" TeX-arg-ref)
+    '("defnref" TeX-arg-ref)
+    '("secref" TeX-arg-ref)
+    '("lemref" TeX-arg-ref)
+    '("propref" TeX-arg-ref)
+    '("remref" TeX-arg-ref)
+    '("figref" TeX-arg-ref)
+    '("colref" TeX-arg-ref)
+    '("appref" TeX-arg-ref)
+    '("assref" TeX-arg-ref))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("thmref"  "{")
+                               ("exref"   "{")
+                               ("defnref" "{")
+                               ("secref"  "{")
+                               ("lemref"  "{")
+                               ("propref" "{")
+                               ("remref"  "{")
+                               ("figref"  "{")
+                               ("colref"  "{")
+                               ("appref"  "{")
+                               ("assref"  "{"))
+                             'reference)))
+ LaTeX-dialect)
+
+(defvar LaTeX-commath-package-options nil
+  "Package options for the commath package.")
+
+;;; commath.el ends here
diff --git a/style/empheq.el b/style/empheq.el
new file mode 100644
index 0000000..cbafdb1
--- /dev/null
+++ b/style/empheq.el
@@ -0,0 +1,504 @@
+;;; empheq.el --- AUCTeX style for `empheq.sty' (v2.14)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-08-07
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `empheq.sty' (v2.14) from 2014/08/04.
+;; `empheq.sty' is part of TeXLive.
+
+;;; Code:
+
+;; Needed for compiling `pushnew':
+(eval-when-compile (require 'cl))
+
+;; Needed for auto-parsing.
+(require 'tex)
+
+(defvar LaTeX-empheq-key-val-options
+  `(("box")
+    ("innerbox")
+    ("left" ,(mapcar
+             (lambda (x)
+               (concat TeX-esc x))
+             '("empheqlbrace"
+               "empheqlbrack"
+               "empheqlangle"
+               "empheqlparen"
+               "empheqlvert"
+               "empheqlVert"
+               "empheqlfloor"
+               "empheqlceil"
+               "empheqbiglbrace"
+               "empheqbiglbrack"
+               "empheqbiglangle"
+               "empheqbiglparen"
+               "empheqbiglvert"
+               "empheqbiglVert"
+               "empheqbiglfloor"
+               "empheqbiglceil")))
+    ("right" ,(mapcar
+              (lambda (x)
+                (concat TeX-esc x))
+              '("empheqrbrace"
+                "empheqrbrack"
+                "empheqrangle"
+                "empheqrparen"
+                "empheqrvert"
+                "empheqrVert"
+                "empheqrfloor"
+                "empheqrceil"
+                "empheqbigrbrace"
+                "empheqbigrbrack"
+                "empheqbigrangle"
+                "empheqbigrparen"
+                "empheqbigrvert"
+                "empheqbigrVert"
+                "empheqbigrfloor"
+                "empheqbigrceil")))
+    ("outerbox")
+    ("marginbox"))
+  "Key=value options for environments from empheq.sty.")
+
+(defvar LaTeX-empheq-key-val-options-local nil
+  "Buffer-local key=value options for environments from empheq.sty.")
+(make-local-variable 'LaTeX-empheq-key-val-options-local)
+
+(defvar LaTeX-empheq-supported-amsmath-envs
+  '("equation"  "equation*"
+    "align"     "align*"
+    "gather"    "gather*"
+    "flalign"   "flalign*"
+    "alignat"   "alignat*"
+    "multline"  "multline*")
+  "List of amsmath environments supported by empheq package.")
+
+(defvar LaTeX-empheq-package-options
+  '("overload" "overload2" "ntheorem" "newmultline" "oldmultline")
+  "Package options for the empheq package.")
+
+;; Setup for \Declare(Left|Right)Delimiter:
+
+(TeX-auto-add-type "empheq-declaredelimiter" "LaTeX")
+
+(defvar LaTeX-empheq-declaredelimiter-regexp
+  `(,(concat "\\\\Declare\\(Left\\|Right\\)Delimiter"
+            "[ \t\n\r%]*"
+            "\\(?:\\[[^]]*\\]\\)?"
+            "[ \t\n\r%]*"
+            "{"
+            (regexp-quote TeX-esc)
+            "\\([^}]+\\)}")
+    (2 1) LaTeX-auto-empheq-declaredelimiter)
+  "Matches the argument of \\Declare(Left|Right)Delimiter from empheq 
package.")
+
+(defun LaTeX-empheq-auto-prepare ()
+  "Clear `LaTeX-auto-empheq-declaredelimiter' before parsing."
+  (setq LaTeX-auto-empheq-declaredelimiter nil))
+
+(defun LaTeX-empheq-auto-cleanup ()
+  "Process parsed delimiters."
+  (dolist (delim (mapcar #'car (LaTeX-empheq-declaredelimiter-list)))
+    (TeX-add-symbols (concat "empheq" delim)
+                    (concat "empheqbig" delim)))
+  (LaTeX-empheq-update-key-val-options))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-empheq-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-empheq-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun LaTeX-empheq-update-key-val-options ()
+  "Update `LaTeX-empheq-key-val-options-local' if the function
+`LaTeX-empheq-declaredelimiter-list' returns non-nil."
+  (when (LaTeX-empheq-declaredelimiter-list)
+    (let ((lvals (cadr (assoc "left" LaTeX-empheq-key-val-options)))
+         (rvals (cadr (assoc "right" LaTeX-empheq-key-val-options)))
+         (tmp (copy-alist LaTeX-empheq-key-val-options))
+         lval rval)
+      (dolist (delims (LaTeX-empheq-declaredelimiter-list))
+       (let ((delim (car delims))
+             (where (cadr delims)))
+         (if (string= where "Left")
+             (progn
+               (pushnew (concat TeX-esc "empheq" delim) lval :test #'equal)
+               (pushnew (concat TeX-esc "empheqbig" delim) lval :test #'equal))
+           (progn
+             (pushnew (concat TeX-esc "empheq" delim) rval :test #'equal)
+             (pushnew (concat TeX-esc "empheqbig" delim) rval :test 
#'equal)))))
+      (when lval
+       (setq tmp (assq-delete-all (car (assoc "left" tmp)) tmp))
+       (setq lvals (append lval lvals))
+       (push (list "left" lvals) tmp))
+      (when rval
+       (setq tmp (assq-delete-all (car (assoc "right" tmp)) tmp))
+       (setq rvals (append rval rvals))
+       (push (list "right" rvals) tmp))
+      (setq LaTeX-empheq-key-val-options-local
+           (copy-alist tmp)))))
+
+(defun LaTeX-empheq-env (env)
+  "Query for a supported amsmath environment and insert it accordingly."
+  (let* ((keyvals (TeX-read-key-val t LaTeX-empheq-key-val-options-local))
+        (amsenv (completing-read
+                 (TeX-argument-prompt nil nil "amsmath environment")
+                 LaTeX-empheq-supported-amsmath-envs))
+        (ncols (when (or (string= amsenv "alignat")
+                         (string= amsenv "alignat*"))
+                 (TeX-read-string
+                  (TeX-argument-prompt nil nil "Number of columns"))))
+        num)
+    (LaTeX-insert-environment
+     env
+     (concat
+      (when (and keyvals (not (string= keyvals "")))
+       (concat LaTeX-optop keyvals LaTeX-optcl))
+      TeX-grop
+      (if (and ncols (not (string= ncols "")))
+         (concat amsenv "=" ncols)
+       (symbol-value 'amsenv))
+      TeX-grcl))
+    (when (and (assoc amsenv LaTeX-label-alist)
+              (LaTeX-label amsenv 'environment))
+      (LaTeX-newline)
+      (indent-according-to-mode))
+    (when (and ncols (not (string= ncols "")))
+      (setq num (string-to-number ncols))
+      (save-excursion
+       (insert (make-string (+ num num -1) ?&))))))
+
+(defun LaTeX-empheq-env-overload (env &optional _ignore)
+  "Insert amsmath ENV's when option overload is given to empheq package.
+This function combines the capabilities of `LaTeX-env-label' and
+`LaTeX-amsmath-env-alignat'.  It overwrites the definitions of
+`amsmath.el'."
+  (if (or (string= env "alignat")
+         (string= env "alignat*"))
+      (let ((ncols (TeX-read-string
+                   (TeX-argument-prompt nil nil "Number of columns")))
+           (keyvals (TeX-read-key-val t
+                                      LaTeX-empheq-key-val-options-local
+                                      "empheq options (k=v)")))
+       (LaTeX-insert-environment env (concat TeX-grop ncols TeX-grcl
+                                             (when (and keyvals (not (string= 
keyvals "")))
+                                               (concat LaTeX-optop keyvals 
LaTeX-optcl))))
+       (LaTeX-item-equation-alignat t))
+    (let ((keyvals
+          (TeX-read-key-val t LaTeX-empheq-key-val-options-local "empheq 
options (k=v)")))
+      (LaTeX-insert-environment env (when (and keyvals (not (string= keyvals 
"")))
+                                     (concat LaTeX-optop keyvals LaTeX-optcl)))
+      (when (and (assoc env LaTeX-label-alist)
+                (LaTeX-label env 'environment))
+       (LaTeX-newline)
+       (indent-according-to-mode)))))
+
+(defun LaTeX-empheq-item-equation ()
+  "Insert contents to terminate a line in multi-line equations environment.
+Put line break macro on the last line.  Next, if the current
+environment wants \\label, insert it also.  And insert suitable
+number of ampersands if possible."
+  (let ((env (LaTeX-current-environment))
+       amsenv ncols match)
+    (save-excursion
+      (LaTeX-find-matching-begin)
+      (re-search-forward (concat (regexp-quote TeX-esc)
+                                "begin" TeX-grop env TeX-grcl))
+      (when (looking-at "[ \t\n\r%]*\\[")
+       (forward-sexp))
+      (re-search-forward "[ \t\n\r%]*{\\([^}]+\\)}")
+      (setq match (replace-regexp-in-string "[ \t\n\r%]*" ""
+                                           (match-string-no-properties 1)))
+      (if (string-match "=" match)
+         (progn
+           (setq amsenv (car (split-string match "=")))
+           (setq ncols (string-to-number (cadr (split-string match "=")))))
+       (setq amsenv match)))
+    ;; Do not ask for "\\" if in "equation" or "equation*" since these
+    ;; are single line equations only
+    (if (or (string= amsenv "equation")
+           (string= amsenv "equation*"))
+       ;; Nullify the effect of `M-RET'
+       (progn
+         (message "This environment does not support multi-line equations")
+         (end-of-line 0)
+         (kill-line 1))
+      (progn
+       (end-of-line 0)
+       (just-one-space)
+       (TeX-insert-macro "\\")
+       (forward-line 1)
+       (indent-according-to-mode)))
+    ;; Add a new label only if not in "equation"
+    (when (and (not (string= amsenv "equation"))
+              (assoc amsenv LaTeX-label-alist)
+              (LaTeX-label amsenv 'environment))
+      (LaTeX-newline)
+      (indent-according-to-mode))
+    (when ncols
+      (save-excursion
+       (insert (make-string (+ ncols ncols -1) ?&))))))
+
+(TeX-add-style-hook
+ "empheq"
+ (lambda ()
+
+   ;; Add empheq to parser
+   (TeX-auto-add-regexp LaTeX-empheq-declaredelimiter-regexp)
+
+   ;; Load amsmath.el and mathtools.el
+   (TeX-run-style-hooks "amsmath" "mathtools")
+
+   ;; Add elements from `LaTeX-mathtools-package-options' only once
+   ;; and not every time the style hook runs
+   (dolist (elt LaTeX-mathtools-package-options)
+     (add-to-list 'LaTeX-empheq-package-options elt))
+
+   ;; Local version of key-val options
+   (setq LaTeX-empheq-key-val-options-local
+        (copy-alist LaTeX-empheq-key-val-options))
+
+   ;; Initial update of key-vals
+   (LaTeX-empheq-update-key-val-options)
+
+   (LaTeX-add-environments
+    '("empheq" LaTeX-empheq-env))
+
+   ;; Add "empheq" to `LaTeX-item-list' and run
+   ;; `LaTeX-empheq-item-equation' when `M-RET' is invoked
+   (add-to-list 'LaTeX-item-list '("empheq" . LaTeX-empheq-item-equation) t)
+
+   ;; Reftex support: Append definition to `reftex-label-alist'
+   (when (boundp 'reftex-label-alist)
+     (add-to-list 'reftex-label-alist '("empheq" ?e nil nil t) t))
+
+   (TeX-add-symbols
+    '("empheqset" (TeX-arg-key-val LaTeX-empheq-key-val-options-local))
+
+    ;; 1.4 Special delimiters
+    ;; Normal
+    '("empheqlbrace" TeX-arg-insert-right-brace-maybe)
+    '("empheqrbrace")
+    '("empheqlbrack" TeX-arg-insert-right-brace-maybe)
+    '("empheqrbrack")
+    '("empheqlangle" TeX-arg-insert-right-brace-maybe)
+    '("empheqrangle")
+    '("empheqlparen" TeX-arg-insert-right-brace-maybe)
+    '("empheqrparen")
+    '("empheqlvert" TeX-arg-insert-right-brace-maybe)
+    '("empheqrvert")
+    '("empheqlVert" TeX-arg-insert-right-brace-maybe)
+    '("empheqrVert")
+    '("empheqlfloor" TeX-arg-insert-right-brace-maybe)
+    '("empheqrfloor")
+    '("empheqlceil" TeX-arg-insert-right-brace-maybe)
+    '("empheqrceil")
+    ;; Bigger
+    '("empheqbiglbrace" TeX-arg-insert-right-brace-maybe)
+    '("empheqbigrbrace")
+    '("empheqbiglbrack" TeX-arg-insert-right-brace-maybe)
+    '("empheqbigrbrack")
+    '("empheqbiglangle" TeX-arg-insert-right-brace-maybe)
+    '("empheqbigrangle")
+    '("empheqbiglparen" TeX-arg-insert-right-brace-maybe)
+    '("empheqbigrparen")
+    '("empheqbiglvert" TeX-arg-insert-right-brace-maybe)
+    '("empheqbigrvert")
+    '("empheqbiglVert" TeX-arg-insert-right-brace-maybe)
+    '("empheqbigrVert")
+    '("empheqbiglfloor" TeX-arg-insert-right-brace-maybe)
+    '("empheqbigrfloor")
+    '("empheqbiglceil" TeX-arg-insert-right-brace-maybe)
+    '("empheqbigrceil"))
+
+   ;; Append delimiters to `TeX-braces-association'
+   (make-local-variable 'TeX-braces-association)
+   (let ((delimiters '(("\\empheqlbrace" . "\\empheqrbrace")
+                      ("\\empheqlbrack" . "\\empheqrbrack")
+                      ("\\empheqlangle" . "\\empheqrangle")
+                      ("\\empheqlparen" . "\\empheqrparen")
+                      ("\\empheqlvert"  . "\\empheqrvert")
+                      ("\\empheqlVert"  . "\\empheqrVert")
+                      ("\\empheqlfloor" . "\\empheqrfloor")
+                      ("\\empheqlceil"  . "\\empheqrceil")
+                      ("\\empheqbiglbrace" . "\\empheqbigrbrace")
+                      ("\\empheqbiglbrack" . "\\empheqbigrbrack")
+                      ("\\empheqbiglangle" . "\\empheqbigrangle")
+                      ("\\empheqbiglparen" . "\\empheqbigrparen")
+                      ("\\empheqbiglvert"  . "\\empheqbigrvert")
+                      ("\\empheqbiglVert"  . "\\empheqbigrVert")
+                      ("\\empheqbiglfloor" . "\\empheqbigrfloor")
+                      ("\\empheqbiglceil"  . "\\empheqbigrceil"))))
+     (dolist (elt delimiters)
+       (add-to-list 'TeX-braces-association elt t)))
+
+   ;; 2.2.1 Using multline
+   (when (LaTeX-provided-package-options-member "empheq" "oldmultline")
+     (LaTeX-add-environments
+      '("MTmultlined" LaTeX-mathtools-env-multlined)))
+
+   ;; 2.2.2 The overload option
+   ;; I simplify it and ignore the additional feature overload2:
+   (when (or (LaTeX-provided-package-options-member "empheq" "overload")
+            (LaTeX-provided-package-options-member "empheq" "overload2"))
+     (LaTeX-add-environments
+      '("align"      LaTeX-empheq-env-overload)
+      '("alignat"    LaTeX-empheq-env-overload)
+      '("equation"   LaTeX-empheq-env-overload)
+      '("flalign"    LaTeX-empheq-env-overload)
+      '("gather"     LaTeX-empheq-env-overload)
+      '("multline"   LaTeX-empheq-env-overload)
+      '("align*"     LaTeX-env-args [TeX-arg-key-val 
LaTeX-empheq-key-val-options-local])
+      '("alignat*"   LaTeX-empheq-env-overload)
+      '("equation*"  LaTeX-env-args [TeX-arg-key-val 
LaTeX-empheq-key-val-options-local])
+      '("flalign*"   LaTeX-env-args [TeX-arg-key-val 
LaTeX-empheq-key-val-options-local])
+      '("gather*"    LaTeX-env-args [TeX-arg-key-val 
LaTeX-empheq-key-val-options-local])
+      '("multline*"  LaTeX-env-args [TeX-arg-key-val 
LaTeX-empheq-key-val-options-local])
+
+      ;; Original definitions are stored prefixed with "AmS"
+      '("AmSalign"      LaTeX-env-label)
+      '("AmSalignat"    LaTeX-amsmath-env-alignat)
+      '("AmSequation"   LaTeX-env-label)
+      '("AmSflalign"    LaTeX-env-label)
+      '("AmSgather"     LaTeX-env-label)
+      '("AmSmultline"   LaTeX-env-label)
+      '("AmSalign*")
+      '("AmSalignat*"   LaTeX-amsmath-env-alignat)
+      '("AmSequation*")
+      '("AmSflalign*")
+      '("AmSgather*")
+      '("AmSmultline*"))
+
+     ;; Append original definitions to `LaTeX-label-alist'
+     (let ((envs '("AmSalign"
+                  "AmSalignat"
+                  "AmSequation"
+                  "AmSflalign"
+                  "AmSgather"
+                  "AmSmultline")))
+       (dolist (env envs)
+        (add-to-list 'LaTeX-label-alist `(,env . LaTeX-amsmath-label) t)))
+
+     ;; RefTeX support: Append original definitions to `reftex-label-alist'
+     (when (boundp 'reftex-label-alist)
+       (let ((envs '(("AmSalign"     ?e nil nil eqnarray-like)
+                    ("AmSequation"  ?e nil nil t)
+                    ("AmSgather"    ?e nil nil eqnarray-like)
+                    ("AmSmultline"  ?e nil nil t)
+                    ("AmSflalign"   ?e nil nil eqnarray-like)
+                    ("AmSalignat"   ?e nil nil alignat-like))))
+        (dolist (env envs)
+          (add-to-list 'reftex-label-alist env t))))
+
+     ;; Append original definitions to `LaTeX-item-list'; functions
+     ;; are provided by amsmath.el
+     (let ((envs '(("AmSalign" . LaTeX-item-equation)
+                  ("AmSalign*" . LaTeX-item-equation)
+                  ("AmSflalign" . LaTeX-item-equation)
+                  ("AmSalignat" . LaTeX-item-equation-alignat)
+                  ("AmSalignat*" . LaTeX-item-equation-alignat)
+                  ("AmSflalign*" . LaTeX-item-equation)
+                  ("AmSgather" . LaTeX-item-equation)
+                  ("AmSgather*" . LaTeX-item-equation)
+                  ("AmSmultline" . LaTeX-item-equation)
+                  ("AmSmultline*" . LaTeX-item-equation))))
+       (dolist (env envs)
+        (add-to-list 'LaTeX-item-list env t)))
+
+     ;; Ispell skip lists:
+     (TeX-ispell-skip-setcdr
+      `(,(cons (concat "\\(AmS\\(?:align\\(?:\\*\\|at\\*?\\)?\\|"
+                      
"equation\\*?\\|flalign\\*?\\|gather\\*?\\|multline\\*?\\)\\)")
+              (concat "\\\\end{"
+                      "\\(AmS\\(?:align\\(?:\\*\\|at\\*?\\)?\\|"
+                      
"equation\\*?\\|flalign\\*?\\|gather\\*?\\|multline\\*?\\)\\)}")))))
+
+   ;; 3.2 Support for ntheorem
+   (LaTeX-add-lengths "mintagvsep")
+
+   ;; 4.1 Creating your own delimiters
+   (TeX-add-symbols
+    '("DeclareLeftDelimiter"
+      [ "Space adjustment" ]
+      (TeX-arg-eval
+       (lambda ()
+        (let ((delim (TeX-read-string (concat "Delimiter: " TeX-esc))))
+          (TeX-add-symbols (concat "empheq" delim)
+                           (concat "empheqbig" delim))
+          (LaTeX-add-empheq-declaredelimiters `(,delim "Left"))
+          (LaTeX-empheq-update-key-val-options)
+          (concat TeX-esc delim)))))
+
+    '("DeclareRightDelimiter"
+      [ "Space adjustment" ]
+      (TeX-arg-eval
+       (lambda ()
+        (let ((delim (TeX-read-string (concat "Delimiter: " TeX-esc))))
+          (TeX-add-symbols (concat "empheq" delim)
+                           (concat "empheqbig" delim))
+          (LaTeX-add-empheq-declaredelimiters `(,delim "Right"))
+          (LaTeX-empheq-update-key-val-options)
+          (concat TeX-esc delim))))))
+
+   ;; 4.2 Fine-tuning of delimiters
+   (LaTeX-add-lengths "EmphEqdelimitershortfall")
+   (LaTeX-add-counters "EmphEqdelimiterfactor")
+
+   (TeX-add-symbols
+    ;; 4.3 Scaling material yourself
+    '("EmphEqdisplayheight" 0)
+    '("EmphEqdisplaydepth"  0)
+    ;; 6.1 New empheq-like environments
+    '("EmphEqMainEnv" 0)
+    '("endEmphEqMainEnv" 0))
+
+   ;; Ispell skip lists
+   (TeX-ispell-skip-setcar '(("\\\\empheqset" ispell-tex-arg-end)))
+   (TeX-ispell-skip-setcdr '(("empheq" . "\\\\end{empheq}")))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("empheqset"             "{")
+                               ("DeclareLeftDelimiter"  "[{")
+                               ("DeclareRightDelimiter" "[{"))
+                             'function)
+     ;; Append our addition so that we don't interfere with user customizations
+     (make-local-variable 'font-latex-math-environments)
+     (add-to-list 'font-latex-math-environments "empheq" t)
+     (when (or (LaTeX-provided-package-options-member "empheq" "overload")
+              (LaTeX-provided-package-options-member "empheq" "overload2"))
+       (let ((envs '(;; Do not insert the starred versions here;
+                    ;; function `font-latex-match-math-envII' takes
+                    ;; care of it
+                    "AmSalign"
+                    "AmSalignat"
+                    "AmSequation"
+                    "AmSflalign"
+                    "AmSgather"
+                    "AmSmultline")))
+        (dolist (env envs)
+          (add-to-list 'font-latex-math-environments env t))))))
+ LaTeX-dialect)
+
+;;; empheq.el ends here
diff --git a/style/enumitem.el b/style/enumitem.el
index c81cd96..02e3a25 100644
--- a/style/enumitem.el
+++ b/style/enumitem.el
@@ -171,7 +171,9 @@ package.")
       ;; Tell AUCTeX about parsed description like environments.
       (when (or (string-equal type "description")
                (string-equal type "description*"))
-       (add-to-list 'LaTeX-item-list `(,env . LaTeX-item-argument)))))
+       (add-to-list 'LaTeX-item-list `(,env . LaTeX-item-argument)))
+      ;; Add new env's to `ispell-tex-skip-alist': skip the optional argument
+      (TeX-ispell-skip-setcdr `((,env ispell-tex-arg-end 0)))))
   ;; Now add the parsed env's to the local list.
   (when (LaTeX-enumitem-newlist-list)
     (setq LaTeX-enumitem-newlist-list-local
@@ -344,9 +346,10 @@ in `enumitem'-completions."
             (add-to-list 'LaTeX-item-list `(,name . LaTeX-item-argument)))
           (LaTeX-add-environments `(,name LaTeX-enumitem-env-with-opts))
           (LaTeX-add-enumitem-newlists (list name type))
-          (insert (format "{%s}" name)
-                  (format "{%s}" type))
-           (format "%s" depth)))))
+          (TeX-ispell-skip-setcdr `((,name ispell-tex-arg-end 0)))
+          (TeX-argument-insert name optional)
+          (TeX-argument-insert type optional)
+          (format "%s" depth)))))
 
     ;; \renewlist{<name>}{<type>}{<max-depth>}
     '("renewlist"
diff --git a/style/environ.el b/style/environ.el
index c6b34cc..4f275e9 100644
--- a/style/environ.el
+++ b/style/environ.el
@@ -89,7 +89,7 @@ from `environ.sty'.")
 (defun TeX-arg-environ-final-code (_optional)
   "Query for the presence of optional `final code' as argument to
 `\\NewEnviron' and insert the appropriate brackets."
-  (let ((fincode (y-or-n-p "With optional final code?")))
+  (let ((fincode (y-or-n-p "With optional final code? ")))
     (when fincode
        (insert "[]"))))
 
diff --git a/style/framed.el b/style/framed.el
new file mode 100644
index 0000000..44a69c5
--- /dev/null
+++ b/style/framed.el
@@ -0,0 +1,52 @@
+;;; framed.el --- AUCTeX style for `framed.sty' (v0.96)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-06-26
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `framed.sty' (v0.96) from 2011/10/22.
+;; `framed.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "framed"
+ (lambda ()
+   ;; env's defined by framed.sty
+   (LaTeX-add-environments
+    '("framed")
+    '("oframed")
+    '("shaded")
+    '("shaded*")
+    '("snugshade")
+    '("snugshade*")
+    '("leftbar")
+    '("titled-frame" "Title")))
+ LaTeX-dialect)
+
+(defvar LaTeX-framed-package-options nil
+  "Package options for the framed package.")
+
+;;; framed.el ends here
diff --git a/style/listings.el b/style/listings.el
index 2d50b2c..e3a48a9 100644
--- a/style/listings.el
+++ b/style/listings.el
@@ -291,7 +291,9 @@ with user-defined values via the \"lstdefinestyle\" macro."
            (t ; No args
             (add-to-list 'LaTeX-auto-environment (list env))))
       (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation) 
t)
-      (add-to-list 'LaTeX-verbatim-environments-local env)))
+      (add-to-list 'LaTeX-verbatim-environments-local env)
+      ;; Add new env's to `ispell-tex-skip-alist': skip the entire env
+      (TeX-ispell-skip-setcdr `(,(cons env (concat "\\\\end{" env "}"))))))
   (when (LaTeX-listings-lstdefinestyle-list)
     (LaTeX-listings-update-style-key)))
 
diff --git a/style/mathtools.el b/style/mathtools.el
index 68fed88..c6c4b17 100644
--- a/style/mathtools.el
+++ b/style/mathtools.el
@@ -1,6 +1,6 @@
 ;;; mathtools.el --- Style hook for the LaTeX package `mathtools'.
 
-;; Copyright (C) 2011-2012, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2012, 2014, 2016 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Created: 2011-02-13
@@ -36,30 +36,213 @@
 
 ;;; Code:
 
+;; Needed for auto-parsing.
+(require 'tex)
+
 ;; amsmath options which can be passed directly to mathtools are
 ;; appended in the style hook below
 (defvar LaTeX-mathtools-package-options
-  '("fixamsmath" "donotfixamsmathbugs" "allowspaces" "disallowspaces")
+  '("fixamsmath" "donotfixamsmathbugs" "allowspaces" "disallowspaces"
+    ;; Update 2013: We now make \(\) and \[\] robust (can be disabled
+    ;; via nonrobust package option)
+    "nonrobust")
   "Package options for the mathtools package.")
 
 (defvar LaTeX-mathtools-key-val-options
   '(("showonlyrefs")
     ("mathic" ("true" "false"))
     ("showmanualtags" ("true" "false"))
+    ;; 3.4.1 Matrices
+    ("smallmatrix-align" ("c" "l" "r"))
+    ("smallmatrix-inner-space")
+    ;; 3.4.2 The multlined environment
     ("firstline-afterskip")
     ("lastline-preskip")
     ("multlined-pos" ("c" "b" "t"))
     ("multlined-width")
+    ;; 3.4.7 Centered \vdots
+    ("shortvdotsadjustabove")
+    ("shortvdotsadjustbelow")
+    ;; 3.5 Intertext and short intertext
+    ("original-intertext" ("true" "false"))
+    ("original-shortintertext" ("true" "false"))
+    ("above-intertext-sep")
+    ("below-intertext-sep")
+    ("above-shortintertext-sep")
+    ("below-shortintertext-sep")
+    ;; 3.7.2 Vertically centered colon
     ("centercolon" ("true" "false"))
+    ;; 4.2 Left sub/superscripts
     ("prescript-sub-format")
     ("prescript-sup-format")
     ("prescript-arg-format"))
-  "Options for the \\mathtoolsset command")
+  "Options for the \\mathtoolsset command.")
+
+;; Setup for \newtagform
+(TeX-auto-add-type "mathtools-newtagform" "LaTeX")
+
+(defvar LaTeX-mathtools-newtagform-regexp
+  '("\\\\newtagform{\\([^}]+\\)}"
+    1 LaTeX-auto-mathtools-newtagform)
+  "Matches the first argument of \\newtagform from mathtools package.")
+
+;; Setup for \DeclarePairedDelimiter(X)?:
+(TeX-auto-add-type "mathtools-DeclarePairedDelimiter" "LaTeX")
+
+(defvar LaTeX-mathtools-DeclarePairedDelimiter-regexp
+  `(,(concat "\\\\DeclarePairedDelimiter\\(?:X\\|XPP\\)?"
+            "{?"
+            "\\\\\\([a-zA-Z]+\\)"
+            "}?"
+            "\\(?:\\[\\([0-9]+\\)\\]\\)?")
+    (1 2) LaTeX-auto-mathtools-DeclarePairedDelimiter)
+  "Match the arguments of \\DeclarePairedDelimiterX? from mathtools package.")
+
+;; Setup for \newgathered
+(TeX-auto-add-type "mathtools-newgathered" "LaTeX")
+
+(defvar LaTeX-mathtools-newgathered-regexp
+  '("\\\\newgathered{\\([^}]+\\)}"
+    1 LaTeX-auto-mathtools-newgathered)
+  "Matches the first argument of \\newgathered from mathtools package.")
+
+(defun LaTeX-mathtools-auto-prepare ()
+  "Clear various variables for mathtools package before parsing."
+  (setq LaTeX-auto-mathtools-newtagform             nil
+       LaTeX-auto-mathtools-DeclarePairedDelimiter nil
+       LaTeX-auto-mathtools-newgathered            nil))
+
+(defun LaTeX-mathtools-auto-cleanup ()
+  "Process the parsed elements for mathtools package."
+  (when (LaTeX-mathtools-DeclarePairedDelimiter-list)
+    (dolist (delim (LaTeX-mathtools-DeclarePairedDelimiter-list))
+      (let ((cmd (car delim))
+           (arg (cadr delim)))
+       (TeX-add-symbols `(,cmd [ LaTeX-mathtools-arg-mathsize-completion ]
+                               ,(if (string= arg "")
+                                    1
+                                  (string-to-number arg)))
+                        `(,(concat cmd "*")
+                          ,(if (string= arg "")
+                               1
+                             (string-to-number arg)))))))
+  (when (LaTeX-mathtools-newgathered-list)
+    (dolist (env (mapcar #'car (LaTeX-mathtools-newgathered-list)))
+      (LaTeX-add-environments env)
+      (add-to-list 'LaTeX-item-list
+                  `(,env . LaTeX-item-equation) t)
+      (add-to-list 'LaTeX-label-alist
+                  `(,env . LaTeX-amsmath-label) t)
+      (when (boundp 'reftex-label-alist)
+       (add-to-list 'reftex-label-alist `(,env ?e nil nil t) t)))))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-mathtools-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-mathtools-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun LaTeX-mathtools-arg-mathstyle-completion (optional)
+  "Query and insert mathstyle argument to various commands.
+If OPTIONAL, insert it as optional argument in brackets."
+  (TeX-argument-insert
+   (let ((style (completing-read
+                (TeX-argument-prompt optional nil
+                                     (concat "Math style: " TeX-esc) t)
+                '("displaystyle" "textstyle"
+                  "scriptstyle"  "scriptscriptstyle"))))
+     (if (string= style "")
+        style
+       (concat TeX-esc style)))
+   optional))
+
+(defun LaTeX-mathtools-arg-mathsize-completion (optional)
+  "Query and insert math size argument to various commands.
+If OPTIONAL, insert it as optional argument in brackets."
+  (TeX-argument-insert
+   (let ((size (completing-read
+               (TeX-argument-prompt optional nil
+                                    (concat "Size command: " TeX-esc) t)
+               '("big" "Big" "bigg" "Bigg"))))
+     (if (string= size "")
+        size
+       (concat TeX-esc size)))
+   optional))
+
+(defun LaTeX-mathtools-arg-declarepaireddelimiter (optional &optional X)
+  "Query and insert various \\DeclarePairedDelimiter macros from mathtools 
package."
+  (let ((cmd (TeX-read-string (concat "Command: " TeX-esc)))
+       (arg (when X (TeX-read-string
+                     (TeX-argument-prompt t nil "Number of arguments")))))
+    (TeX-add-symbols `(,cmd [ LaTeX-mathtools-arg-mathsize-completion ]
+                           ,(if X
+                                ;; This is no precaution, arg has to be > 0
+                                (string-to-number arg)
+                              1))
+                    `(,(concat cmd "*")
+                      ,(if X
+                           (string-to-number arg)
+                         1)))
+    (LaTeX-add-mathtools-DeclarePairedDelimiters
+     `(,cmd ,(if X arg "")))
+    (TeX-argument-insert (concat TeX-esc cmd) optional)
+    (when arg
+      (insert (concat LaTeX-optop arg LaTeX-optcl)))))
+
+(defun LaTeX-mathtools-env-multlined (env)
+  "Query and insert two optional arguments for ENV multlined.
+If both arguments are given, insert them in brackets.  If only a
+width is given, insert it prefixed with a pair of empty
+brackets."
+  (let ((pos (TeX-read-string
+             (TeX-argument-prompt t nil "Position (t, b or c (default))")))
+       (width (completing-read
+               (TeX-argument-prompt t nil "Width")
+               (mapcar
+                (lambda (x) (concat TeX-esc (car x)))
+                (LaTeX-length-list)))))
+    (LaTeX-insert-environment
+     env
+     (cond (;; both arguments
+           (and pos   (not (string= pos ""))
+                width (not (string= width "")))
+           (format "[%s][%s]" pos width))
+          (;; pos not empty, width empty
+           (and pos (not (string= pos ""))
+                (string= width ""))
+           (format "[%s]" pos))
+          (;; pos empty, width not
+           (and (string= pos "")
+                width (not (string= width "")))
+           (format "[][%s]" width))
+          (t nil)))))
+
+(defun LaTeX-mathtools-env-cases (env)
+  "Insert various cases ENVs incl. an ampersand from mathtools package."
+  (LaTeX-insert-environment env)
+  (save-excursion
+    (insert ?&)))
+
+(defun LaTeX-mathtools-item-cases ()
+  "Insert contents to terminate a line in multi-line cases environment.
+Put line break macro on the last line.  Next, insert an ampersand."
+  (end-of-line 0)
+  (just-one-space)
+  (TeX-insert-macro "\\")
+  (forward-line 1)
+  (save-excursion
+    (insert ?&)))
 
 (TeX-add-style-hook
  "mathtools"
  (lambda ()
 
+   ;; Add mathtools to parser
+   (TeX-auto-add-regexp LaTeX-mathtools-newtagform-regexp)
+   (TeX-auto-add-regexp LaTeX-mathtools-DeclarePairedDelimiter-regexp)
+   (TeX-auto-add-regexp LaTeX-mathtools-newgathered-regexp)
+
+   ;; "default" is pre-defined
+   (LaTeX-add-mathtools-newtagforms "default")
+
    ;; mathtools requires amsmath, as some bugs in amsmath are fixed
    (TeX-run-style-hooks "amsmath")
 
@@ -67,39 +250,82 @@
      (add-to-list 'LaTeX-mathtools-package-options elt))
 
    (LaTeX-add-environments
-    '("lgathered" ["Vertical position (t or b)"])
-    '("rgathered" ["Vertical position (t or b)"])
+    ;; 3.4.1 Matrices
+    '("matrix*"  [ "Vertical alignment (l, r or c (default))" ])
+    '("pmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("bmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("Bmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("vmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("Vmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("smallmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("psmallmatrix")
+    '("psmallmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("bsmallmatrix")
+    '("bsmallmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("Bsmallmatrix")
+    '("Bsmallmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("vsmallmatrix")
+    '("vsmallmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    '("Vsmallmatrix")
+    '("Vsmallmatrix*" [ "Vertical alignment (l, r or c (default))" ])
+    ;; 3.4.2 The multlined environment
     '("multlined" LaTeX-mathtools-env-multlined)
-    '("matrix*" LaTeX-mathtools-env-matrix-starred)
-    '("pmatrix*" LaTeX-mathtools-env-matrix-starred)
-    '("bmatrix*" LaTeX-mathtools-env-matrix-starred)
-    '("Bmatrix*" LaTeX-mathtools-env-matrix-starred)
-    '("vmatrix*" LaTeX-mathtools-env-matrix-starred)
-    '("Vmatrix*" LaTeX-mathtools-env-matrix-starred)
-    '("spreadlines" LaTeX-mathtools-env-spreadlines)
-    "dcases" "dcases*")
+    ;; 3.4.3 More cases -like environments
+    '("dcases"   LaTeX-mathtools-env-cases)
+    '("dcases*"  LaTeX-mathtools-env-cases)
+    '("rcases"   LaTeX-mathtools-env-cases)
+    '("rcases*"  LaTeX-mathtools-env-cases)
+    '("drcases"  LaTeX-mathtools-env-cases)
+    '("drcases*" LaTeX-mathtools-env-cases)
+    '("cases*"   LaTeX-mathtools-env-cases)
+    ;; 4.4 Spreading equations
+    '("spreadlines" "Spacing between lines")
+    ;; 4.5 Gathered environments
+    '("lgathered" ["Vertical position (t or b)"])
+    '("rgathered" ["Vertical position (t or b)"]))
 
    (TeX-add-symbols
-    '("mathtoolsset" (TeX-arg-key-val LaTeX-mathtools-key-val))
-    '("mathclap" 1)
-    '("mathllap" ["Mathstyle"] t)
-    '("mathrlap" ["Mathstyle"] t)
-    '("mathclap" ["Mathstyle"] t)
-    '("mathmakebox" [TeX-arg-size] [ TeX-arg-size ] 1)
+    '("mathtoolsset" (TeX-arg-key-val LaTeX-mathtools-key-val-options))
+    ;; 3.1.1 A complement to \smash, \llap, and \rlap
+    '("mathllap" [ LaTeX-mathtools-arg-mathstyle-completion ] t)
+    '("mathrlap" [ LaTeX-mathtools-arg-mathstyle-completion ] t)
+    '("mathclap" [ LaTeX-mathtools-arg-mathstyle-completion ] t)
+    '("mathmakebox" [ (TeX-arg-length "Width") ] [ "Position" ] 1)
     '("clap" 1)
     '("mathmbox" 1)
-    '("cramped" 1)
-    '("crampedllap" [ "Mathstye" ] t)
-    '("crampedrlap" [ "Mathstyle" ] t)
-    '("crampedclap" [ "Mathstyle" ] t)
-    '("smashoperator" [ "Position (l, r or lr (default)" ] 2)
+    ;; 3.1.2 Forcing a cramped style
+    '("cramped" [ LaTeX-mathtools-arg-mathstyle-completion ] 1)
+    '("crampedllap" [ LaTeX-mathtools-arg-mathstyle-completion ] t)
+    '("crampedrlap" [ LaTeX-mathtools-arg-mathstyle-completion ] t)
+    '("crampedclap" [ LaTeX-mathtools-arg-mathstyle-completion ] t)
+    ;; 3.1.3 Smashing an operator
+    '("smashoperator" [ "Position (l, r or lr (default)" ] 1)
     ;; 3.1.4 Adjusting the limits of operators
-    ;; explicit argument encapsulation does not seem to be required
-    '("adjustlimits" 4)
-    ;; 3.2 Controlling tags
-    '("newtagform" "Name" ["Inner format"] "Left" "Right")
-    '("renewtagform" "Name" ["Inner format"] "Left" "Right")
-    '("usetagform" "Name")
+    '("adjustlimits" t (TeX-arg-literal "_") nil nil (TeX-arg-literal "_") nil)
+    ;; 3.1.5 Swapping space above AMS display math environments
+    '("SwapAboveDisplaySkip" 0)
+    ;; 3.2.1 The appearance of tags
+    '("newtagform"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((newtag (TeX-read-string
+                       (TeX-argument-prompt nil nil "Name"))))
+          (LaTeX-add-mathtools-newtagforms newtag)
+          (format "%s" newtag))))
+       [ "Inner format" ] "Left" "Right")
+    '("renewtagform"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt nil nil "Name")
+                   (LaTeX-mathtools-newtagform-list))
+      [ "Inner format" ] "Left" "Right")
+    '("usetagform"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt nil nil "Name")
+                   (LaTeX-mathtools-newtagform-list)))
+    ;; 3.2.2 Showing only referenced tags
+    '("refeq" TeX-arg-ref)
+    '("noeqref" TeX-arg-ref)
+    ;; 3.3.1 Arrow-like symbols
     '("xleftrightarrow" ["Below"] "Above")
     '("xLeftarrow" ["Below"] "Above")
     '("xRightarrow" ["Below"] "Above")
@@ -113,40 +339,99 @@
     '("xleftharpoonup" ["Below"] "Above")
     '("xrightleftharpoons" ["Below"] "Above")
     '("xleftrightharpoons" ["Below"] "Above")
-    '("underbracket" [ "Rule thickness" ] [ "Bracket height" ] t)
-    '("overbracket" [ "Rule thickness" ] [ "Bracket height" ] t)
+    ;; 3.3.2 Braces and brackets
+    '("underbracket" [ (TeX-arg-length "Rule thickness") ]
+                    [ (TeX-arg-length "Bracket height") ] t)
+    '("overbracket"  [ (TeX-arg-length "Rule thickness") ]
+                    [ (TeX-arg-length "Bracket height") ] t)
     '("underbrace" 1)
     '("overbrace" 1)
     '("LaTeXunderbrace" 1)
     '("LaTeXoverbrace" 1)
     ;; 3.4.2
-    '("shoveleft"  [ TeX-arg-size ] 1)
-    '("shoveright" [ TeX-arg-size ] 1)
-    ;; don't understand t, but intertext in amsmath.el uses it
-    '("shortintertext" t)
-    '("DeclarePairedDelimiter" TeX-arg-macro "Left delimiter" "Right 
delimiter")
+    '("shoveleft"  [ (TeX-arg-length "Dimension") ] 1)
+    '("shoveright" [ (TeX-arg-length "Dimension") ] 1)
     ;; 3.4.4
     '("MoveEqLeft" [ "Number" ])
+    ;; 3.4.5 Boxing a single line in an alignment
+    '("Aboxed" 1)
+    ;; 3.4.6 Adding arrows between lines in an alignment
     '("ArrowBetweenLines" [ TeX-arg-macro ] )
     '("ArrowBetweenLines*" [ TeX-arg-macro ] )
-    ;; colon operators
+    ;; 3.4.7 Centered \vdots
+    '("vdotswithin" "Symbol")
+    '("shortvdotswithin" "Symbol")
+    '("shortvdotswithin*" "Symbol")
+    '("MTFlushSpaceAbove")
+    '("MTFlushSpaceBelow")
+    ;; 3.5 Intertext and short intertext
+    ;; don't understand t, but intertext in amsmath.el uses it
+    '("shortintertext" t)
+    ;; 3.6 Paired delimiters
+    '("DeclarePairedDelimiter"
+      LaTeX-mathtools-arg-declarepaireddelimiter
+      "Left delimiter" "Right delimiter")
+    '("DeclarePairedDelimiterX"
+      (LaTeX-mathtools-arg-declarepaireddelimiter t)
+      "Left delimiter" "Right delimiter" t)
+    '("DeclarePairedDelimiterXPP"
+      (LaTeX-mathtools-arg-declarepaireddelimiter t)
+      "Pre-code" "Left delimiter" "Right delimiter" 2)
+    '("delimsize" 0)
+    ;; 3.6.1 Expert use
+    '("reDeclarePairedDelimiterInnerWrapper"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((cmd (completing-read
+                    (concat "Command: " TeX-esc)
+                    (mapcar #'car 
(LaTeX-mathtools-DeclarePairedDelimiter-list)))))
+          (concat TeX-esc cmd))))
+      (TeX-arg-eval completing-read
+                   "star or nostar: "
+                   '("star" "nostar"))
+      t)
+    ;; 3.7.1 Left and right parentheses
+    '("lparen" TeX-arg-insert-right-brace-maybe)
+    '("rparen")
+    ;; 3.7.2 Vertically centered colon
     "vcentcolon" "ordinarycolon" "coloneqq" "Coloneqq"
     "coloneq" "Coloneq" "eqqcolon" "Eqqcolon" "eqcolon"
     "Eqcolon" "colonapprox" "Colonapprox" "colonsim" "Colonsim"
-    ;; 3.7.1
-    "lparen" "rparen"
-    ;; left sub/superscripts
+    "dblcolon"
+    ;; 3.7.3 A few missing symbols
+    "nuparrow" "ndownarrow" "bigtimes"
+    ;; 4.2 Left sub/superscripts
     '("prescript" "Below" "Above" t)
-    ;; Declaring math sizes; this command doesn't seem so relevant, but
-    ;; for completion, it's included
+    ;; 4.3 Declaring math sizes
     '("DeclareMathSizes" 4)
-    ;; Gathered envionments
-    '("newgather" "Name" "Pre-line" "Post-line" "After")
-    '("renewgather" "Name" "Pre-line" "Post-line" "After")
-    ;; Split fractions
+    ;; 4.5 Gathered environments
+    '("newgathered"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((env (TeX-read-string
+                    (TeX-argument-prompt nil nil "Name"))))
+          (LaTeX-add-environments env)
+          (LaTeX-add-mathtools-newgathereds env)
+          (add-to-list 'LaTeX-item-list
+                       `(,env . LaTeX-item-equation) t)
+          (add-to-list 'LaTeX-label-alist
+                       `(,env . LaTeX-amsmath-label) t)
+          (format "%s" env))))
+      3)
+    '("renewgathered"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt nil nil "Name")
+                   (LaTeX-mathtools-newgathered-list))
+      3)
+    ;; 4.6 Split fractions
     '("splitfrac" 2)
     '("splitdfrac" 2))
 
+   ;; Append delimiters to `TeX-braces-association'
+   ;; 3.7.1 Left and right parentheses
+   (make-local-variable 'TeX-braces-association)
+   (add-to-list 'TeX-braces-association '("\\lparen" . "\\rparen") t)
+
    (setq LaTeX-item-list
         (append '(("multlined"   . LaTeX-item-equation)
                   ("lgathered"   . LaTeX-item-equation)
@@ -158,42 +443,45 @@
                   ("Bmatrix*"    . LaTeX-item-equation)
                   ("vmatrix*"    . LaTeX-item-equation)
                   ("Vmatrix*"    . LaTeX-item-equation)
-                  ("dcases"      . LaTeX-item-equation)
-                  ("dcases*"     . LaTeX-item-equation))
+                  ("dcases"      . LaTeX-mathtools-item-cases)
+                  ("dcases*"     . LaTeX-mathtools-item-cases)
+                  ("rcases"      . LaTeX-mathtools-item-cases)
+                  ("rcases*"     . LaTeX-mathtools-item-cases)
+                  ("drcases"     . LaTeX-mathtools-item-cases)
+                  ("drcases*"    . LaTeX-mathtools-item-cases)
+                  ("cases*"      . LaTeX-mathtools-item-cases))
                 LaTeX-item-list))
 
    (setq LaTeX-label-alist
         (append '(("lgathered" . LaTeX-amsmath-label)
                   ("rgathered" . LaTeX-amsmath-label)
                   ("multlined" . LaTeX-amsmath-label))
-                LaTeX-label-alist)))
- LaTeX-dialect)
+                LaTeX-label-alist))
 
-(defun LaTeX-mathtools-env-matrix-starred (env)
-  (let ((where (TeX-read-string "(optional) Vertical placement of columns: ")))
-    (if (string= where "")
-       (setq where "")
-      (setq where (concat "[" where "]")))
-    (LaTeX-insert-environment env where)))
+   ;; RefTeX support: Add env's to `reftex-label-alist'
+   (when (boundp 'reftex-label-alist)
+     (let ((envs '(("lgathered"  ?e nil nil t)
+                  ("rgathered"  ?e nil nil t)
+                  ("multlined"  ?e nil nil t))))
+       (dolist (env envs)
+        (add-to-list 'reftex-label-alist env t))))
 
-(defun LaTeX-mathtools-env-spreadlines (env)
-  (let ((spread (TeX-read-string "Spacing between lines: ")))
-    (LaTeX-insert-environment env (concat TeX-grop spread TeX-grcl))
-    (newline-and-indent)))
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("mathtoolsset"  "{")
+                               ("newtagform"    "{[{{")
+                               ("renewtagform"  "{[{{")
+                               ("DeclarePairedDelimiter"     "|{\\{{")
+                               ("DeclarePairedDelimiterX"    "|{\\[{{{")
+                               ("DeclarePairedDelimiterXPP"  "|{\\[{{{{{")
+                               ("reDeclarePairedDelimiterInnerWrapper" 
"|{\\{{")
+                               ("DeclareMathSizes"           "{{{{")
+                               ("newgathered"                "{{{{")
+                               ("renewgathered"              "{{{{"))
+                             'function)
+     (font-latex-add-keywords '(("usetagform" "{"))
+                             'variable)))
+ LaTeX-dialect)
 
-;; FIXME: there are probably more subtle ways to support more than one
-;; optional argument; please change if this is the case
-(defun LaTeX-mathtools-env-multlined (env)
-  (let ((pos (TeX-read-string "(optional) Position: "))
-       (width (TeX-read-string "(optional) Width: "))
-       (extra ""))
-    (if (not (string= pos ""))
-       (setq pos (concat LaTeX-optop pos LaTeX-optcl))
-      (setq pos ""))
-    (if (not (string= width ""))
-       (setq width (concat LaTeX-optop width LaTeX-optcl))
-      (setq width ""))
-    (setq extra (concat pos width))
-    (LaTeX-insert-environment env extra)))
-
-;;; mathtools.el ends here.
+;;; mathtools.el ends here
diff --git a/style/menukeys.el b/style/menukeys.el
new file mode 100644
index 0000000..bc30a84
--- /dev/null
+++ b/style/menukeys.el
@@ -0,0 +1,539 @@
+;;; menukeys.el --- AUCTeX style for `menukeys.sty' (v1.4)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-02-07
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `menukeys.sty' (v1.4) from 2016/04/18.
+;; `menukeys.sty' is part of TeXLive.
+
+;;; Code:
+
+;; Needed for auto-parsing.
+(require 'tex)
+
+(defvar LaTeX-menukeys-input-separators-list
+  '("/" "=" "*" "+" "," ";" ":" "-" ">" "<" "bslash")
+  "List of input separators for macros of menukeys package.")
+
+(defvar LaTeX-menukeys-predefined-styles-list
+  '("menus" "roundedmenus" "angularmenus" "roundedkeys"
+    "shadowedroundedkeys"  "angularkeys"  "shadowedangularkeys"
+    "typewriterkeys"       "paths"        "pathswithfolder"
+    "pathswithblackfolder" "hyphenatepaths"
+    "hyphenatepathswithfolder"
+    "hyphenatepathswithblackfolder")
+  "List of predefined styles for macros from menukeys package.")
+
+;; Setup for \newmenustyle(simple):
+(TeX-auto-add-type "menukeys-newmenustyle" "LaTeX")
+
+(defvar LaTeX-menukeys-newmenustyle-regexp
+  '("\\\\\\(?:new\\|copy\\)menustyle\\(?:simple\\)?*?{\\([^}]+\\)}"
+    1 LaTeX-auto-menukeys-newmenustyle)
+  "Matches the argument of \\newmenustyle and
+\\newmenustylesimple from menukeys package.")
+
+;; Setup for \newmenucolortheme:
+(TeX-auto-add-type "menukeys-newmenucolortheme" "LaTeX")
+
+(defvar LaTeX-menukeys-newmenucolortheme-regexp
+  '("\\\\\\(?:new\\|copy\\)menucolortheme{\\([^}]+\\)}"
+    1 LaTeX-auto-menukeys-newmenucolortheme)
+  "Matches the argument of \\newmenucolortheme from menukeys package.")
+
+;; Setup for \newmenumacro:
+(TeX-auto-add-type "menukeys-newmenumacro" "LaTeX")
+
+(defvar LaTeX-menukeys-newmenumacro-regexp
+  `(,(concat
+      "\\\\\\(new\\|renew\\|provide\\)menumacro"
+      "{?"
+      (regexp-quote TeX-esc)
+      "\\([a-zA-Z]+\\)"
+      "}?"
+      "\\(?:\\[\\([^]]*\\)\\]\\)?")
+    (2 3 1) LaTeX-auto-menukeys-newmenumacro)
+  "Matches the arguments of \\newmenumacro from menukeys package.")
+
+(defun LaTeX-menukeys-auto-prepare ()
+  "Clear various `LaTeX-auto-menukeys-*' variables before parsing."
+  (setq LaTeX-auto-menukeys-newmenustyle nil
+       LaTeX-auto-menukeys-newmenucolortheme nil
+       LaTeX-auto-menukeys-newmenumacro nil))
+
+(defun LaTeX-menukeys-auto-cleanup ()
+  "Process the parsed elements for menukeys package.
+This function adds parsed elements from the variable
+`LaTeX-menukeys-newmenumacro-list' to AUCTeX via the function
+`TeX-add-symbols'.  The variable
+`LaTeX-menukeys-newmenumacro-list' and not the function with the
+same name is used since this function looks for the order of
+commands which are set by \\renewmenumacro in order to pick the
+current separator.  These renew-commands are also removed first
+from the variable `TeX-symbol-list' before being re-added."
+  (dolist (x (apply #'append LaTeX-menukeys-newmenumacro-list))
+    (let ((macro (nth 0 x))
+         (sep   (nth 1 x))
+         (renew (when (string= (nth 2 x) "renew")
+                  (nth 2 x))))
+      ;; When we are renewmenumacro'ing, delete the entry first from the
+      ;; variable `TeX-symbol-list' and then add the new spec:
+      (when renew
+       (setq TeX-symbol-list
+             (assq-delete-all (car (assoc macro (TeX-symbol-list))) 
TeX-symbol-list)))
+      (TeX-add-symbols
+       `(,macro [ TeX-arg-eval completing-read
+                              (TeX-argument-prompt optional nil
+                                                   ,(concat "Input separator "
+                                                            "(default "
+                                                            (if (and sep (not 
(string= sep "")))
+                                                                sep
+                                                              ",")
+                                                            ")"))
+                              LaTeX-menukeys-input-separators-list ] t ))
+      (when (and (featurep 'font-latex)
+                (eq TeX-install-font-lock 'font-latex-setup))
+       (font-latex-add-keywords `((,macro "[{"))
+                                'textual)))))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-menukeys-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-menukeys-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun TeX-arg-menukeys-newmenumacro (optional &optional renew)
+  "Query and insert the arguments of \\newmenumacro from menukeys package.
+After inserting, add the name of macro and the optional separator
+to the name of known macros via `TeX-add-symbols'.  If
+font-latex.el is loaded, also use `font-latex-add-keywords' on
+macro.  If RENEW is non-nil, query for an already defined macro."
+  (let ((macro (if renew
+                  (completing-read
+                   (concat "Macro: " TeX-esc)
+                   (delete-dups (mapcar #'car 
(LaTeX-menukeys-newmenumacro-list))))
+                (TeX-read-string (concat "Macro: " TeX-esc))))
+       (sep   (completing-read
+               (TeX-argument-prompt optional nil "Input separator (default ,)")
+               LaTeX-menukeys-input-separators-list))
+       (style (completing-read
+               (TeX-argument-prompt optional nil "Style")
+               (LaTeX-menukeys-newmenustyle-list))))
+    (TeX-argument-insert (concat TeX-esc macro) optional)
+    (when (and sep (not (string= sep "")))
+      (insert (format "[%s]" sep)))
+    (TeX-argument-insert style optional)
+    ;; When we are renewmenumacro'ing, delete the entry first from the
+    ;; variable `TeX-symbol-list' and then add the new spec:
+    (when renew
+      (setq TeX-symbol-list
+           (assq-delete-all (car (assoc macro (TeX-symbol-list))) 
TeX-symbol-list)))
+    (TeX-add-symbols
+     `(,macro [ TeX-arg-eval completing-read
+                            (TeX-argument-prompt optional nil
+                                                 ,(concat "Input separator "
+                                                         "(default "
+                                                         (if (and sep (not 
(string= sep "")))
+                                                             sep
+                                                           ",")
+                                                         ")"))
+                            LaTeX-menukeys-input-separators-list ] t ))
+    (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+      (font-latex-add-keywords `((,macro       "[{"))
+                              'textual))))
+
+(TeX-add-style-hook
+ "menukeys"
+ (lambda ()
+
+   ;; Add menukeys to the parser
+   (TeX-auto-add-regexp LaTeX-menukeys-newmenustyle-regexp)
+   (TeX-auto-add-regexp LaTeX-menukeys-newmenucolortheme-regexp)
+   (TeX-auto-add-regexp LaTeX-menukeys-newmenumacro-regexp)
+
+   ;; Activate predefined stuff
+   (apply #'LaTeX-add-menukeys-newmenustyles 
LaTeX-menukeys-predefined-styles-list)
+   (LaTeX-add-menukeys-newmenucolorthemes "gray" "blacknwhite")
+
+   ;; Run style hooks for xcolor, tikz and relsize
+   (TeX-run-style-hooks "xcolor" "tikz" "relsize")
+
+   ;; 4.1 Basic macros: These are not defined if the package option
+   ;; definemenumacros ist set to false (default is true).  We check
+   ;; for the package option here and add them.
+   (unless (LaTeX-provided-package-options-member "menukeys" 
"definemenumacros=false")
+     (TeX-add-symbols
+      ;; \menu      [<separator>]{<sequence>}
+      ;; \directory [<separator>]{path}
+      ;; \keys      [<separator>]{keystrokes}
+      '("menu"
+       [ TeX-arg-eval completing-read
+                      (TeX-argument-prompt optional nil "Input separator")
+                      LaTeX-menukeys-input-separators-list ]
+       t)
+
+      '("directory"
+       [ TeX-arg-eval completing-read
+                      (TeX-argument-prompt optional nil "Input separator")
+                      LaTeX-menukeys-input-separators-list ]
+       t)
+
+      '("keys"
+       [ TeX-arg-eval completing-read
+                      (TeX-argument-prompt optional nil "Input separator")
+                      LaTeX-menukeys-input-separators-list ]
+       t)))
+
+   (TeX-add-symbols
+    ;; 4.2.1 Predefined styles
+    ;; \drawtikzfolder[<front fill>][<draw>]
+    '("drawtikzfolder"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Front color")
+                    (LaTeX-xcolor-definecolor-list) ]
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Line color")
+                    (LaTeX-xcolor-definecolor-list) ] )
+
+    ;; 4.2.2 Declaring styles
+    ;; \newmenustylesimple*{<name>}[<pre>]{<style>}[<sep>][<post>]{<theme>}
+    '("newmenustylesimple"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-menukeys-newmenustyles name)
+          (format "%s" name))))
+      [ t ] nil [ nil ] [ nil ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Color theme")
+                   (LaTeX-menukeys-newmenucolortheme-list)))
+
+    '("newmenustylesimple*"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-menukeys-newmenustyles name)
+          (format "%s" name))))
+      [ t ] nil [ nil ] [ nil ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Color theme")
+                   (LaTeX-menukeys-newmenucolortheme-list)))
+
+    ;; 
\newmenustyle*{<name>}[<pre>]{<first>}[<sep>]{<mid>}{<last>}{<single>}[<post>]{<theme>}
+    '("newmenustyle"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-menukeys-newmenustyles name)
+          (format "%s" name))))
+      [ t ] nil [ nil ] nil nil nil [ nil ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Color theme")
+                   (LaTeX-menukeys-newmenucolortheme-list)))
+
+    '("newmenustyle*"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-menukeys-newmenustyles name)
+          (format "%s" name))))
+      [ t ] nil [ nil ] nil nil nil [ nil ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Color theme")
+                   (LaTeX-menukeys-newmenucolortheme-list)))
+
+    '("CurrentMenuElement" 0)
+
+    ;; 4.2.3 Copying styles
+    '("copymenustyle"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((copy (TeX-read-string
+                     (TeX-argument-prompt optional nil "Copy")))
+              (orig (completing-read
+                     (TeX-argument-prompt optional nil "Original")
+                     (LaTeX-menukeys-newmenustyle-list))))
+          (LaTeX-add-menukeys-newmenustyles copy)
+          (TeX-argument-insert copy optional)
+          (format "%s" orig)))))
+
+    ;; 4.2.4 Changing styles
+    ;; \changemenuelement*{name}{element}{definition}
+    '("changemenuelement"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Name")
+                   (LaTeX-menukeys-newmenustyle-list))
+      2)
+
+    '("changemenuelement*"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Name")
+                   (LaTeX-menukeys-newmenustyle-list))
+      2)
+
+    ;; Same arguments as \newmenustylesimple
+    '("renewmenustylesimple"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Name")
+                   (LaTeX-menukeys-newmenustyle-list))
+      [ t ] nil [ nil ] [ nil ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Color theme")
+                   (LaTeX-menukeys-newmenucolortheme-list)))
+
+    '("providemenustylesimple"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-menukeys-newmenustyles name)
+          (format "%s" name))))
+      [ t ] nil [ nil ] [ nil ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Color theme")
+                   (LaTeX-menukeys-newmenucolortheme-list)))
+
+    ;; Same arguments as \newmenustyle
+    '("providemenustyle"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Name")
+                   (LaTeX-menukeys-newmenustyle-list))
+      [ t ] nil [ nil ] nil nil nil [ nil ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Color theme")
+                   (LaTeX-menukeys-newmenucolortheme-list)))
+
+    '("renewmenustyle"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-menukeys-newmenustyles name)
+          (format "%s" name))))
+      [ t ] nil [ nil ] nil nil nil [ nil ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Color theme")
+                   (LaTeX-menukeys-newmenucolortheme-list)))
+
+    ;; 4.3 Color themes
+    ;; 4.3.2 Create a theme
+    ;; \newmenucolortheme{<name>}{<model>}{<bg>}{<br>}{<txt>}[<a>][<b>][<c>]
+    '("newmenucolortheme"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-menukeys-newmenucolorthemes name)
+          (format "%s" name))))
+      (TeX-arg-eval
+       (lambda ()
+        (let ((model (completing-read
+                      (TeX-argument-prompt optional nil "Model")
+                      (LaTeX-xcolor-color-models))))
+          (TeX-argument-insert model optional)
+          (if (string= model "named")
+              (let ((bg (completing-read
+                         (TeX-argument-prompt optional nil "Node background 
color")
+                         (LaTeX-xcolor-definecolor-list)))
+                    (br (completing-read
+                         (TeX-argument-prompt optional nil "Node border color")
+                         (LaTeX-xcolor-definecolor-list)))
+                    (txt (completing-read
+                          (TeX-argument-prompt optional nil "Node text color")
+                          (LaTeX-xcolor-definecolor-list))))
+                (TeX-argument-insert bg optional)
+                (TeX-argument-insert br optional)
+                (format "%s" txt))
+            (let ((bg (TeX-read-string
+                       (TeX-argument-prompt optional nil "Node background 
color spec")))
+                  (br (TeX-read-string
+                       (TeX-argument-prompt optional nil "Node border color 
spec")))
+                  (txt (TeX-read-string
+                        (TeX-argument-prompt optional nil "Node text color 
spec"))))
+              (TeX-argument-insert bg optional)
+              (TeX-argument-insert br optional)
+              (format "%s" txt))))))
+      (TeX-arg-conditional (y-or-n-p "With additional optional arguments? ")
+                          ( [ 3 ] )
+                        (ignore)))
+
+    ;; 4.3.3 Copy a theme
+    '("copymenucolortheme"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((copy (TeX-read-string
+                     (TeX-argument-prompt optional nil "Copy")))
+              (orig (completing-read
+                     (TeX-argument-prompt optional nil "Original")
+                     (LaTeX-menukeys-newmenucolortheme-list))))
+          (LaTeX-add-menukeys-newmenucolorthemes copy)
+          (TeX-argument-insert copy optional)
+          (format "%s" orig)))))
+
+    ;; 4.3.4 Change a theme
+    '("changemenucolor"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Name")
+                   (LaTeX-menukeys-newmenucolortheme-list))
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Element")
+                   '("bg" "br" "txt"))
+      (TeX-arg-eval
+       (lambda ()
+        (let ((model (completing-read
+                      (TeX-argument-prompt optional nil "Model")
+                      (LaTeX-xcolor-color-models))))
+          (TeX-argument-insert model optional)
+          (if (string= model "named")
+              (let ((color (completing-read
+                            (TeX-argument-prompt optional nil "Color")
+                            (LaTeX-xcolor-definecolor-list))))
+                (format "%s" color))
+            (let ((color (TeX-read-string
+                          (TeX-argument-prompt optional nil "Color spec"))))
+              (format "%s" color)))))))
+
+    ;; Same arguments as \newmenucolortheme
+    '("renewmenucolortheme"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-menukeys-newmenucolorthemes name)
+          (format "%s" name))))
+      (TeX-arg-eval
+       (lambda ()
+        (let ((model (completing-read
+                      (TeX-argument-prompt optional nil "Model")
+                      (LaTeX-xcolor-color-models))))
+          (TeX-argument-insert model optional)
+          (if (string= model "named")
+              (let ((bg (completing-read
+                         (TeX-argument-prompt optional nil "Node background 
color")
+                         (LaTeX-xcolor-definecolor-list)))
+                    (br (completing-read
+                         (TeX-argument-prompt optional nil "Node border color")
+                         (LaTeX-xcolor-definecolor-list)))
+                    (txt (completing-read
+                          (TeX-argument-prompt optional nil "Node text color")
+                          (LaTeX-xcolor-definecolor-list))))
+                (TeX-argument-insert bg optional)
+                (TeX-argument-insert br optional)
+                (format "%s" txt))
+            (let ((bg (TeX-read-string
+                       (TeX-argument-prompt optional nil "Node background 
color spec")))
+                  (br (TeX-read-string
+                       (TeX-argument-prompt optional nil "Node border color 
spec")))
+                  (txt (TeX-read-string
+                        (TeX-argument-prompt optional nil "Node text color 
spec"))))
+              (TeX-argument-insert bg optional)
+              (TeX-argument-insert br optional)
+              (format "%s" txt))))))
+      (TeX-arg-conditional (y-or-n-p "With additional optional arguments? ")
+                          ( [ 3 ] )
+                        (ignore)))
+
+    ;; 4.4 Menu macros
+    ;; 4.4.2 Defining or changing menu macros
+    ;; \newmenumacro{<macro>} [<input sep>]{<style>}
+    '("newmenumacro"     TeX-arg-menukeys-newmenumacro)
+    '("providemenumacro" TeX-arg-menukeys-newmenumacro)
+    '("renewmenumacro"   (TeX-arg-menukeys-newmenumacro t)))
+
+   ;; 4.5 Keys: These macros are defined when definekeys option is not
+   ;; false.
+   ;; 0 : No argment, one macro
+   ;; 1 : One argument, with completion
+   ;; 2 : No argment, three macros: \<key>, \<key>win, \<key>mac
+   (unless (LaTeX-provided-package-options-member "menukeys" 
"definekeys=false")
+     (let ((keycmds '(("shift" . 0)   ("capslock" . 2)  ("tab" . 2)
+                     ("esc" . 2)     ("ctrl" . 2)      ("alt" . 2)
+                     ("AltGr" . 0)   ("cmd"   . 0)     ("Space" . 0)
+                     ("SPACE" . 0)   ("return" . 2)    ("enter"  . 2)
+                     ("winmenu" . 0) ("backspace" . 0) ("del" . 0)
+                     ("arrowkeyup" . 0)   ("arrowkeydown" . 0)
+                     ("arrowkeyleft" . 0) ("arrowkeyright" . 0)
+                     ("arrowkey" . 1)
+                     ;; Text inside some keys:
+                     ("ctrlname" . 0) ("delname" . 0) ("spacename" . 0)))
+          (os '("mac" "win"))
+          collector)
+       (dolist (cmd keycmds)
+        (cond
+         ((= (cdr cmd) 0)
+          (push (car cmd) collector))
+         ((= (cdr cmd) 1)
+          (push (list (car cmd) '(TeX-arg-eval completing-read
+                                                  "Direction: "
+                                                  '("^" "v" ">" "<")))
+                   collector))
+         ((= (cdr cmd) 2)
+          (push (car cmd) collector)
+          (dolist (x os)
+            (push (concat (car cmd) x) collector)))))
+       (apply #'TeX-add-symbols collector)))
+
+   ;; Fontification:
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("menu"            "[{")
+                               ("directory"       "[{")
+                               ("keys"            "[{")
+                               ("drawtikzfolder"  "[["))
+                             'textual)
+     (font-latex-add-keywords '(("newmenustylesimple"       "*{[{[[{")
+                               ("newmenustyle"             "*{[{[{{{[{")
+                               ("copymenustyle"            "{{")
+                               ("changemenuelement"        "*{{{")
+                               ("renewmenustylesimple"     "{[{[[{")
+                               ("providemenustylesimple"   "{[{[[{")
+                               ("providemenustyle"         "{[{[{{{[{")
+                               ("renewmenustyle"           "{[{[{{{[{")
+                               ("newmenucolortheme"        "{{{{{[[[")
+                               ("copymenucolortheme"       "{{")
+                               ("changemenucolor"          "{{{{")
+                               ("renewmenucolortheme"      "{{{{{[[[")
+                               ("newmenumacro"             "|{\\[{")
+                               ("providemenumacro"         "|{\\[{")
+                               ("renewmenumacro"           "|{\\[{"))
+                             'function)))
+ LaTeX-dialect)
+
+(defvar LaTeX-menukeys-package-options-list
+  '(("definemenumacros" ("true" "false"))
+    ("definekeys"       ("true" "false"))
+    ("mackeys"          ("text" "symbols"))
+    ("os"               ("mac"  "win")))
+  "Package options for menukeys package.")
+
+(defun LaTeX-menukeys-package-options ()
+  "Prompt for package options for the menukeys package."
+  (TeX-read-key-val t LaTeX-menukeys-package-options-list))
+
+;;; menukeys.el ends here
diff --git a/style/ntheorem.el b/style/ntheorem.el
index 2cfd4f5..b7c22ea 100644
--- a/style/ntheorem.el
+++ b/style/ntheorem.el
@@ -82,14 +82,14 @@ argument.  Use PROMPT as the prompt string."
 for label.  AUCTeX users should add ENVIRONMENT to
 `LaTeX-label-alist' via customize or in init-file with:
 
-  (add-to-list 'LaTeX-label-alist '(\"lemma\" . \"lem:\"))
+  (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
 
 RefTeX users should customize or add ENVIRONMENT to
 `LaTeX-label-alist' and `reftex-label-alist', e.g.
 
-  (add-to-list 'LaTeX-label-alist '(\"lemma\" . \"lem:\"))
-  (add-to-list 'reftex-label-alist
-              '(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
+  (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
+  (add-to-list \\='reftex-label-alist
+              \\='(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
                 nil (\"Lemma\" \"lemma\") nil))"
   (let ((opthead (TeX-read-string
                  (TeX-argument-prompt t nil "Heading"))))
diff --git a/style/paracol.el b/style/paracol.el
new file mode 100644
index 0000000..7dfddc7
--- /dev/null
+++ b/style/paracol.el
@@ -0,0 +1,274 @@
+;;; paracol.el --- AUCTeX style for `paracol.sty' (v1.32)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-05-26
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `paracol.sty' (v1.32) from 2015/10/10.
+;; `paracol.sty' is part of TeXLive.
+
+;; `paracol.sty' provides an environment (paracol) and a command
+;; (\switchcolumn) which take a star as the second (!) optional
+;; argument.  In order to make the input process easier for the users,
+;; this style provides the environment `paracol*' and the command
+;; `switchcolumn*' in the list of completion after entering C-c C-e or
+;; C-c C-m (or C-c RET).
+
+;; Further, `\switchcolumn' takes a third optional argument containing
+;; text which will be inserted spanned over the columns.  This style
+;; does not ask for this argument.  If you need it, just enter it by
+;; hand after the completion.  This is a deliberate decision since I
+;; think that over the time, the annoyance factor of hitting `RET'
+;; will be larger than the number of times where this argument is
+;; actually used.
+
+;;; Code:
+
+(defun TeX-arg-paracol-switchcolumn* (optional)
+  "Query and insert the column argument of \\switchcolum macro.
+If OPTIONAL is non-nil, insert the result in square brackets."
+  (let ((col (TeX-read-string
+             (TeX-argument-prompt optional nil "Column"))))
+    (save-excursion
+      (backward-char 1)
+      (TeX-argument-insert col optional))))
+
+(TeX-add-style-hook
+ "paracol"
+ (lambda ()
+
+   (LaTeX-add-environments
+    ;; 7.1 Environment paracol
+    ;; \begin{paracol}[numleft]{num}[text] body \end{paracol}
+    ;; \begin{paracol}[numleft]*{num}[text] body \end{paracol}
+    '("paracol" [ "Number left" ] "Number of columns" [ "Text across columns" 
] )
+    '("paracol*"
+      (lambda (_env)
+       (let ((numleft (TeX-read-string
+                       (TeX-argument-prompt  t  nil "Number left")))
+             (numcol  (TeX-read-string
+                       (TeX-argument-prompt nil nil "Number of columns")))
+             (txt     (TeX-read-string
+                       (TeX-argument-prompt  t  nil "Text across columns"))))
+         (LaTeX-insert-environment
+          ;; Simply feed the function with "paracol", other option is
+          ;; something like:
+          ;; (replace-regexp-in-string (regexp-quote "*") "" env)
+          "paracol"
+          (concat
+           (when (and numleft (not (string= numleft "")))
+             (format "[%s]" numleft))
+           "*"
+           (format "{%s}" numcol)
+           (when (and txt (not (string= txt "")))
+             (format "[%s]" txt)))))))
+
+    ;; 7.2 Column-Switching Command and Environments
+    ;; \begin{column} body \end{column}
+    ;; \begin{column*}[text] body \end{column*}
+    '("column")
+    '("column*" [ "Text across columns" ] )
+
+    ;; \begin{nthcolumn}{col} body \end{nthcolumn}
+    ;; \begin{nthcolumn*}{col}[text] body \end{nthcolumn*}
+    '("nthcolumn" "Column")
+    '("nthcolumn*" "Column" [ "Text across columns" ] )
+
+    ;; \begin{leftcolumn} body \end{leftcolumn}
+    ;; \begin{leftcolumn*}[text] body \end{leftcolumn*}
+    ;; \begin{rightcolumn} body \end{rightcolumn}
+    ;; \begin{rightcolumn*}[text] body \end{rightcolumn*}
+    '("leftcolumn")
+    '("leftcolumn*" [ "Text across columns" ] )
+    '("rightcolumn")
+    '("rightcolumn*" [ "Text across columns" ] ))
+
+   (TeX-add-symbols
+    ;; 7.2 Column-Switching Command and Environments
+    ;; \switchcolumn[col]
+    ;; \switchcolumn[col]*[text]
+    '("switchcolumn" [ "Column" ] )
+    '("switchcolumn*" [ TeX-arg-paracol-switchcolumn* ] )
+    '("thecolumn")
+    '("ensurevspace" TeX-arg-length)
+
+    ;; 7.3 Commands for Column and Gap Width
+    ;; \columnratio{r0, r1, ... , rk}[r0', r1', ... , rk']
+    '("columnratio" "Fraction(s)" [ "Fraction(s)" ] )
+
+    ;; \setcolumnwidth{s0, s1, ... , sk}[s0', s1', ... , sk']
+    ;; with s as width/gap
+    '("setcolumnwidth" "Width/Gap" [ "Width/Gap" ] )
+
+    ;; 7.4 Commands for Two-Sided Typesetting and Marginal Note Placement
+    ;; \twosided[t1t2 ... tk]
+    '("twosided" "Features (combination of p, c, m, b)")
+
+    ;; \marginparthreshold{k}[k']
+    '("marginparthreshold" "Number of columns" [ "Number of columns" ] )
+
+    ;; 7.5 Commands for Counters
+    ;; \globalcounter{ctr}
+    ;; \globalcounter*
+    '("globalcounter" TeX-arg-counter)
+    '("globalcounter*")
+
+    ;; \localcounter{ctr}
+    '("localcounter" TeX-arg-counter)
+
+    ;; \definethecounter{ctr}{col}{rep}
+    '("definethecounter" TeX-arg-counter "Column" t)
+
+    ;; \synccounter{ctr}
+    '("synccounter" TeX-arg-counter)
+    '("syncallcounters")
+
+    ;; 7.6 Page-Wise Footnotes
+    '("footnotelayout"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Layout")
+                   '("c" "m" "p")))
+
+    ;; \footnote*[num]{text}
+    ;; \footnotemark*[num]
+    ;; \footnotetext*[num]{text}
+    ;; Copied from `latex.el'
+    '("footnote*"
+      (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
+      t)
+    '("footnotetext*"
+      (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
+      t)
+    '("footnotemark*"
+      (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil))
+
+    '("fncounteradjustment" 0)
+    '("nofncounteradjustment" 0)
+
+    ;; 7.7 Commands for Coloring Texts and Column-Separating Rules
+    ;; \columncolor[mode]{color}[col]
+    ;;
+    ;; This clashes if colortbl.el is loaded since it provides a
+    ;; command with the same name but different arguments.  We add
+    ;; the command only here but not for fontification
+    '("columncolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
+                                        (TeX-arg-xcolor)
+                                      (TeX-arg-color))
+      [ "Column" ] )
+
+    ;; \normalcolumncolor[col]
+    '("normalcolumncolor" [ "Column" ] )
+    '("coloredwordhyphenated" 0)
+    '("nocoloredwordhyphenated" 0)
+
+    ;; \colseprulecolor[mode]{color}[col]
+    ;; \normalcolseprulecolor[col]
+    '("colseprulecolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
+                                            (TeX-arg-xcolor)
+                                          (TeX-arg-color))
+      [ "Column" ] )
+    '("normalcolseprulecolor" [ "Column" ] )
+
+    ;; 7.8 Commands for Background Painting
+    ;; \backgroundcolor{region}[mode]{color}
+    ;; \backgroundcolor{region(x0,y0)}[mode]{color}
+    ;; \backgroundcolor{region(x0,y0)(x1,y1)}[mode]{color}
+    '("backgroundcolor"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Region")
+                   '("c" "g" "s" "f" "n" "p" "t" "b" "l" "r"
+                     "C" "G" "S" "F" "N" "P" "T" "B" "L" "R"))
+      (TeX-arg-conditional (member "xcolor" (TeX-style-list))
+                          (TeX-arg-xcolor)
+                        (TeX-arg-color)))
+
+    ;; \nobackgroundcolor{region}
+    '("nobackgroundcolor"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Region")
+                   '("c" "g" "s" "f" "n" "p" "t" "b" "l" "r"
+                     "C" "G" "S" "F" "N" "P" "T" "B" "L" "R")))
+
+    ;; \resetbackgroundcolor
+    '("resetbackgroundcolor" 0)
+
+    ;; 7.9 Control of Contents Output
+    ;; \addcontentsonly{file}{col}
+    '("addcontentsonly"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Content file")
+                   '("toc" "lof" "lot")))
+
+    '("flushpage" 0))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+                             ;; FIXME: Syntax is \switchcolumn[num]*[text].
+                             ;; font-latex.el doesn't handle the case
+                             ;; where `*' comes after the first `['.
+                             ;; Therefore, we use this compromise to
+                             ;; get something fontified at least.
+     (font-latex-add-keywords '(("switchcolumn"                        "*["))
+                             'textual)
+     (font-latex-add-keywords '(("flushpage"                   "*["))
+                             'warning)
+     (font-latex-add-keywords '(("footnote"                    "*[{")
+                               ("footnotemark"                 "*[")
+                               ("footnotetext"                 "*[{"))
+                             'reference)
+     (font-latex-add-keywords '(("ensurevspace"                        "{")
+                               ("columnratio"                  "{[")
+                               ("setcolumnwidth"               "{[")
+                               ("twosided"                     "[")
+                               ("marginparthreshold"           "{[")
+                               ;; FIXME: Syntax is
+                               ;; \globalcounter{ctr} or
+                               ;; \globalcounter* We ignore `{' since
+                               ;; font-latex.el doesn't handle a
+                               ;; missing bracket nicely.
+                               ("globalcounter"                "*")
+                               ("definethecounter"             "{{{")
+                               ("synccounter"                  "{")
+                               ("syncallcounters"              "")
+                               ("footnotelayout"               "{")
+                               ("fncounteradjustment"          "")
+                               ("nofncounteradjustment"        "")
+                               ("normalcolumncolor"            "[")
+                               ("coloredwordhyphenated"        "")
+                               ("nocoloredwordhyphenated"      "")
+                               ("colseprulecolor"              "[{[")
+                               ("normalcolseprulecolor"        "[")
+                               ("backgroundcolor"              "{[{")
+                               ("nobackgroundcolor"            "{")
+                               ("resetbackgroundcolor"         "")
+                               ("addcontentsonly"              "{{"))
+                             'function)))
+ LaTeX-dialect)
+
+(defvar LaTeX-paracol-package-options nil
+  "Package options for the paracol package.")
+
+;;; paracol.el ends here
diff --git a/style/pdflscape.el b/style/pdflscape.el
new file mode 100644
index 0000000..33bb2ac
--- /dev/null
+++ b/style/pdflscape.el
@@ -0,0 +1,44 @@
+;;; pdflscape.el --- AUCTeX style for `pdflscape.sty' (v0.11)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-07-31
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `pdflscape.sty' (v0.11) from 2016/05/14.
+;; `pdflscape.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "pdflscape"
+ (lambda ()
+   ;; Load lscape.el and we are done
+   (TeX-run-style-hooks "lscape"))
+ LaTeX-dialect)
+
+(defvar LaTeX-pdflscape-package-options nil
+  "Package options for the pdflscape package.")
+
+;;; pdflscape.el ends here
diff --git a/style/splitidx.el b/style/splitidx.el
index 0c3ddf0..a2d9be7 100644
--- a/style/splitidx.el
+++ b/style/splitidx.el
@@ -96,7 +96,7 @@
 
 (defvar LaTeX-splitidx-newindex-regex
   `(,(concat "\\\\new\\(?:protected\\)?index"
-            "\\(?:\\[[^}]*\\]\\)?"
+            "\\(?:\\[[^]]*\\]\\)?"
             "{\\([^}]+\\)}")
     1 LaTeX-auto-splitidx-newindex)
   "Matches the argument of `\\newindex' from `splitidx.sty'.")
@@ -108,9 +108,11 @@
 (defun LaTeX-splitidx-auto-cleanup ()
   "Process parsed results for \"splitidx.sty\"."
   (when (LaTeX-provided-package-options-member "splitidx" "idxcommands")
-    (dolist (elt (mapcar 'car (LaTeX-splitidx-newindex-list)))
+    (dolist (elt (mapcar #'car (LaTeX-splitidx-newindex-list)))
       ;; Make every element available as a command
       (TeX-add-symbols `(,elt TeX-arg-index))
+      ;; Add new macros's to `ispell-tex-skip-alist': skip one argument
+      (TeX-ispell-skip-setcar `((,elt ispell-tex-arg-end)))
       ;; font-locking
       (when (and (featurep 'font-latex)
                 (eq TeX-install-font-lock 'font-latex-setup))
@@ -265,9 +267,11 @@
    ;; instead of \sindex[foo]{<entry>}
    (when (and (LaTeX-provided-package-options-member "splitidx" "idxcommands")
              (LaTeX-splitidx-newindex-list))
-     (dolist (elt (mapcar 'car (LaTeX-splitidx-newindex-list)))
+     (dolist (elt (mapcar #'car (LaTeX-splitidx-newindex-list)))
        ;; Make every `foo' available as a command
        (TeX-add-symbols `(,elt TeX-arg-index))
+       ;; Add new macros's to `ispell-tex-skip-alist': skip one argument
+       (TeX-ispell-skip-setcar `((,elt ispell-tex-arg-end)))
        ;; Cater for font-locking
        (when (and (featurep 'font-latex)
                  (eq TeX-install-font-lock 'font-latex-setup))
diff --git a/style/theorem.el b/style/theorem.el
index 8b4101e..49e55e6 100644
--- a/style/theorem.el
+++ b/style/theorem.el
@@ -75,14 +75,14 @@ argument.  Use PROMPT as the prompt string."
 for label.  AUCTeX users should add ENVIRONMENT to
 `LaTeX-label-alist' via customize or in init-file with:
 
-  (add-to-list 'LaTeX-label-alist '(\"lemma\" . \"lem:\"))
+  (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
 
 RefTeX users should customize or add ENVIRONMENT to
 `LaTeX-label-alist' and `reftex-label-alist', e.g.
 
-  (add-to-list 'LaTeX-label-alist '(\"lemma\" . \"lem:\"))
-  (add-to-list 'reftex-label-alist
-              '(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
+  (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
+  (add-to-list \\='reftex-label-alist
+              \\='(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
                 nil (\"Lemma\" \"lemma\") nil))"
   (let ((opthead (TeX-read-string
                  (TeX-argument-prompt t nil "Heading"))))
diff --git a/style/xcolor.el b/style/xcolor.el
index 2466b12..8ac0bad 100644
--- a/style/xcolor.el
+++ b/style/xcolor.el
@@ -34,13 +34,13 @@
 ;; commands take more arguments.  In order to make the commands and
 ;; font-locking work correctly, we follow this strategy: If
 ;; `xcolor.sty' is loaded after `color.sty', everything works fine.
-;; For the way around, we guard the definitions in `color.sty' with:
+;; For the way around, we guard the definitions for `color.sty' with:
 ;;
-;;     (unless (member "xcolor" (TeX-TeX-style-list))
-;;       (<define stuff from color.sty<))
+;;     (unless (member "xcolor" (TeX-style-list))
+;;       (<define stuff for color.sty>))
 ;;
-;; to make sure that we define stuff `color.sty' only if `xcolor.sty'
-;; is not already loaded.
+;; to make sure that we define stuff for `color.sty' only if AUCTeX
+;; style for `xcolor.sty' is not already loaded.
 
 ;;; Code:
 
@@ -255,7 +255,8 @@ xcolor package.")
 
 (defun LaTeX-xcolor-auto-prepare ()
   "Clear `LaTeX-auto-xcolor-definecolor' before parsing."
-  (setq        LaTeX-auto-xcolor-definecolor nil))
+  (setq LaTeX-auto-xcolor-definecolor nil
+       LaTeX-auto-xcolor-definecolorset nil))
 
 (defun LaTeX-xcolor-auto-cleanup ()
   "Process the parsed elements from `LaTeX-auto-xcolor-definecolorset'."
@@ -504,7 +505,7 @@ xcolor.sty."
                    (LaTeX-xcolor-definecolor-list))
       (TeX-arg-define-macro "Command: \\"))
 
-    ;; \extractcolorspecs{<color>}{<model-cmd>{<color-cmd>}
+    ;; \extractcolorspecs{<color>}{<model-cmd>}{<color-cmd>}
     '("extractcolorspecs"
       (TeX-arg-eval completing-read
                    (TeX-argument-prompt optional nil "Color")
diff --git a/tex-buf.el b/tex-buf.el
index db3c959..575c1ed 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -571,7 +571,7 @@ without further expansion."
                     ;; a function definition made by an external
                     ;; package (e.g. icicles) is not picked up.
                     (cond ((and (not (eq expansion 'file))
-                                (TeX-function-p expansion))
+                                (functionp expansion))
                            (apply expansion arguments))
                           ((boundp expansion)
                             (setq expansion-res
@@ -2319,7 +2319,10 @@ already in an Emacs buffer) and the cursor is placed at 
the error."
            ;; `TeX-suppress-ignored-warnings' is non-nil and there are ignore
            ;; warnings.
            (while (null (zerop arg))
-             (setq TeX-error-last-visited (1+ TeX-error-last-visited)
+             (setq TeX-error-last-visited
+                   ;; Increase or decrese `TeX-error-last-visited' depending on
+                   ;; the sign of `arg'.
+                   (+ (signum arg) TeX-error-last-visited)
                    item (if (natnump TeX-error-last-visited)
                             (nth TeX-error-last-visited TeX-error-list)
                           ;; XEmacs doesn't support `nth' with a negative 
index.
@@ -2327,9 +2330,7 @@ already in an Emacs buffer) and the cursor is placed at 
the error."
              ;; Increase or decrease `arg' only if the warning isn't to be
              ;; skipped.
              (unless (TeX-error-list-skip-warning-p (nth 0 item) (nth 10 item))
-               (setq arg (if (> arg 0)
-                             (1- arg)
-                           (1+ arg)))))
+               (setq arg (- arg (signum arg)))))
            (if (< TeX-error-last-visited -1)
                (setq TeX-error-last-visited -1))
            (cond ((or (null item)
diff --git a/tex-fold.el b/tex-fold.el
index af1191f..cf4284e 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -468,7 +468,7 @@ Return non-nil if an item was found and folded, nil 
otherwise."
                                   ((eq type 'env)
                                    (concat (regexp-quote TeX-esc)
                                            "begin[ \t]*{"
-                                           "\\([A-Za-z]+\\)}"))
+                                           "\\([A-Za-z*]+\\)}"))
                                   (t
                                    (concat (regexp-quote TeX-esc)
                                            "\\(address@hidden)"))))
diff --git a/tex-ispell.el b/tex-ispell.el
new file mode 100644
index 0000000..c519583
--- /dev/null
+++ b/tex-ispell.el
@@ -0,0 +1,289 @@
+;;; tex-ispell.el --- AUCTeX skip additions for Ispell
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Keywords: tex, wp, convenience
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file provides additions to skip list of Ispell (in this
+;; context, Ispell is synonym for Ispell, Aspell and Hunspell spelling
+;; checker programs).  Macro arguments and environments skipped by
+;; Ispell are stored in the car and/or cdr of
+;; `ispell-tex-skip-alists'.  This file uses two functions
+;; `TeX-ispell-skip-setcar' and `TeX-ispell-skip-setcdr' defined in
+;; `tex.el' to add new items to this variable.
+
+;; Ispell has a lot of LaTeX macros and environments already built-in.
+;; E.g., check this link for Hunspell program:
+
+;; https://github.com/hunspell/hunspell/blob/master/src/parsers/latexparser.cxx
+
+;; Ispell does not check spelling in the preamble of a document.
+;; Hence, only document macros and environments should be added here.
+;; Currently, this file has support for the following macro packages:
+
+;; acro.sty
+;; amsmath.sty
+;; attachfile.sty
+;; booktabs.sty
+;; cleveref.sty
+;; enumitem.sty
+;; fancyref.sty
+;; fancyvrb.sty
+;; fontaxes.sty
+;; fontspec.sty
+;; listings.sty
+;; mdframed.sty
+;; minted.sty
+;; nameref.sty
+;; siunitx.sty
+;; splitidx.sty
+;; tabularx.sty
+;; tabulary.sty
+;; tikz.sty
+;; varioref.sty
+
+;; If you have further additions, drop a line to <address@hidden>.
+
+;;; Code:
+
+(require 'tex)
+
+;; Add new macros here:
+(eval-when-compile
+  (defvar TeX-ispell-skip-cmds-list
+    '(;; acro.sty
+      ("ac" . 1)
+      ("ac*" . 1)
+      ("Ac" . 1)
+      ("Ac*" . 1)
+      ("acs" . 1)
+      ("acs*" . 1)
+      ("acl" . 1)
+      ("acl*" . 1)
+      ("Acl" . 1)
+      ("Acl*" . 1)
+      ("aca" . 1)
+      ("aca*" . 1)
+      ("acf" . 1)
+      ("acf*" . 1)
+      ("Acf" . 1)
+      ("Acf*" . 1)
+      ("acp" . 1)
+      ("acp*" . 1)
+      ("Acp" . 1)
+      ("Acp*" . 1)
+      ("acsp" . 1)
+      ("acsp*" . 1)
+      ("aclp" . 1)
+      ("aclp*" . 1)
+      ("Aclp" . 1)
+      ("Aclp*" . 1)
+      ("acap" . 1)
+      ("acap*" . 1)
+      ("acfp" . 1)
+      ("acfp*" . 1)
+      ("Acfp" . 1)
+      ("Acfp*" . 1)
+      ("Iac" . 1)
+      ("iacs" . 1)
+      ("iacl" . 1)
+      ("acflike" . 1)
+      ("acflike*" . 1)
+      ("acfplike" . 1)
+      ("acfplike*" . 1)
+      ("acsingle" . 1)
+      ("acsingle*" . 1)
+      ("Acsingle" . 1)
+      ("Acsingle*" . 1)
+      ("acreset" . 1)
+      ("acuse" . 1)
+      ("acsetup" . 1)
+      ;; attachfile.sty
+      ("attachfile" . 1)
+      ("attachfilesetup" . 1)
+      ("textattachfile" . 1)
+      ;; booktabs.sty
+      ("specialrule" . 3)
+      ;; cleveref.sty
+      ("cref" . 1)
+      ("Cref" . 1)
+      ("cref*" . 1)
+      ("Cref*" . 1)
+      ("cpageref" . 1)
+      ("Cpageref" . 1)
+      ("namecref" . 1)
+      ("nameCref" . 1)
+      ("lcnamecref" . 1)
+      ("labelcref" . 1)
+      ("crefrange" . 2)
+      ("Crefrange" . 2)
+      ("cpagerefrange" . 2)
+      ("Cpagerefrange" . 2)
+      ("crefrange*" . 2)
+      ("Crefrange*" . 2)
+      ;; fancyref.sty
+      ("fref" . 1)
+      ("Fref" . 1)
+      ;; fancyvrb.sty
+      ("fvset" . 1)
+      ("VerbatimInput" . 1)
+      ;; fontaxes.sty
+      ("figureversion" . 1)
+      ;; fontspec.sty
+      ("addfontfeatures" . 1)
+      ;; listings.sty
+      ("lstinputlisting" . 1)
+      ("lstset" . 1)
+      ;; mdframed.sty
+      ("mdfsetup" . 1)
+      ("mdfapptodefinestyle" . 2)
+      ;; minted.sty
+      ("inputminted" . 2)
+      ("setminted" . 1)
+      ("setmintedinline" . 1)
+      ;; nameref.sty
+      ("nameref" . 1)
+      ("Nameref" . 1)
+      ;; siunitx.sty
+      ("num" . 1)
+      ("si" . 1)
+      ("sisetup" . 1)
+      ("SI" . 2)
+      ;; splitidx.sty
+      ("sindex" . 1)
+      ;; varioref.sty
+      ("vref" . 1)
+      ("Vref" . 1)
+      ("vref*" . 1)
+      ("Ref" . 1)
+      ("vpageref" . 1)
+      ("vpageref*" . 1)
+      ("fullref" . 1)
+      ("vrefrange" . 2)
+      ("vrefrange*" . 2)
+      ("vpagerefrange" . 2)
+      ("vpagerefrange*" . 2) )
+    "List of commands with arguments to be skipped.
+Each element of the list is a cons cell with command name
+\(string) as car and the number of mandatory arguments to be
+skipped as cdr."))
+
+
+;; Add new environments with one optional argument here:
+(eval-when-compile
+  (defvar TeX-ispell-skip-envs-opt-arg-list
+    '(;; enumitem.sty
+      "description"
+      "description*"
+      "enumerate"
+      "enumerate*"
+      "itemize"
+      "itemize*"
+      ;; mdframed.sty
+      "mdframed")
+    "List of LaTeX environments with an opt argument to be skipped."))
+
+
+;; Add others delimited here:
+(TeX-ispell-skip-setcar
+ '(;; LaTeX-base
+   ("\\\\raisebox" TeX-ispell-tex-arg-end 1 2 0)
+   ;; booktabs.sty
+   ("\\\\cmidrule" . "\\(([^)]*)\\)?{[-0-9]+}")
+   ;; fontspec.sty
+   ("\\\\fontspec" TeX-ispell-tex-arg-end 1 1 0)
+   ;; minted.sty
+   ("\\\\mint\\(inline\\)?\\(\\[[^]]*\\]\\)?{\\([^}]+\\)}{" . "}")
+   ("\\\\mint\\(inline\\)?\\(\\[[^]]*\\]\\)?{\\([^}]+\\)}|" . "|")
+   ("\\\\mint\\(inline\\)?\\(\\[[^]]*\\]\\)?{\\([^}]+\\)}#" . "#")
+   ("\\\\mint\\(inline\\)?\\(\\[[^]]*\\]\\)?{\\([^}]+\\)}\\+" . "\\+")
+   ("\\\\mint\\(inline\\)?\\(\\[[^]]*\\]\\)?{\\([^}]+\\)}\\*" . "\\*")))
+
+
+;; Add environments here:
+(TeX-ispell-skip-setcdr
+ '(;; amsmath.sty
+   ("\\(align\\(\\*\\|at\\*?\\)?\\|flalign\\*?\\)" .
+    "\\\\end{\\(align\\(\\*\\|at\\*?\\)?\\|flalign\\*?\\)}")
+   ("gather\\*?" . "\\\\end{gather\\*?}")
+   ("multline\\*?" . "\\\\end{multline\\*?}")
+   ;; listings.sty
+   ("lstlisting" . "\\\\end{lstlisting}")
+   ;; minted.sty
+   ("minted" . "\\\\end{minted}")
+   ;; tabularx.sty, tabulary.sty, Standard LaTeX tabular*-env
+   ("tabular[*xy]" TeX-ispell-tex-arg-end)
+   ;; tikz.sty
+   ("tikzpicture" . "\\\\end{tikzpicture}")
+   ;; fancyvrb.sty: In practice, all verbatim environments have a *
+   ;; variant, which sets showspaces=true
+   ("\\(Save\\|[BL]\\)?Verbatim\\(\\*\\|Out\\)?" .
+    "\\\\end{\\(Save\\|[BL]\\)?Verbatim\\(\\*\\|Out\\)?}")))
+
+
+;; No customization below this line
+
+(eval-when-compile
+  (defun TeX-ispell-sort-skip-cmds-list (arg)
+    "Return elements from `TeX-ispell-skip-cmds-list' acc. to ARG."
+    (when (member arg '(1 2 3))
+      (let (cmds)
+       (dolist (elt TeX-ispell-skip-cmds-list)
+         (when (= (cdr elt) arg)
+           (push (car elt) cmds)))
+       (symbol-value 'cmds)))))
+
+(defvar TeX-ispell-skip-cmds-one-arg-regexp
+  (eval-when-compile
+    (concat "\\\\"
+           (regexp-opt (TeX-ispell-sort-skip-cmds-list 1) t)))
+  "Regexp of LaTeX commands with one argument to be skipped.")
+
+(defvar TeX-ispell-skip-cmds-two-args-regexp
+  (eval-when-compile
+    (concat "\\\\"
+           (regexp-opt (TeX-ispell-sort-skip-cmds-list 2) t)))
+  "Regexp of LaTeX commands with two arguments to be skipped.")
+
+(defvar TeX-ispell-skip-cmds-three-args-regexp
+  (eval-when-compile
+    (concat "\\\\"
+           (regexp-opt (TeX-ispell-sort-skip-cmds-list 3) t)))
+  "Regexp of LaTeX commands with three arguments to be skipped.")
+
+(defvar TeX-ispell-skip-envs-opt-arg-regexp
+  (eval-when-compile
+    (regexp-opt TeX-ispell-skip-envs-opt-arg-list t))
+  "Regexp of LaTeX environments with an opt argument to be skipped.")
+
+;; Make them available to Ispell:
+(TeX-ispell-skip-setcar
+ `((,TeX-ispell-skip-cmds-one-arg-regexp ispell-tex-arg-end)
+   (,TeX-ispell-skip-cmds-two-args-regexp ispell-tex-arg-end 2)
+   (,TeX-ispell-skip-cmds-three-args-regexp ispell-tex-arg-end 3)))
+
+(TeX-ispell-skip-setcdr
+ `((,TeX-ispell-skip-envs-opt-arg-regexp ispell-tex-arg-end 0)))
+
+(provide 'tex-ispell)
+
+;;; tex-ispell.el ends here
diff --git a/tex-jp.el b/tex-jp.el
index a905348..cfc37bf 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -48,6 +48,14 @@
                 (const :tag "jTeX" jtex)
                 (const :tag "upTeX" uptex)))
 
+(defcustom japanese-TeX-use-kanji-opt-flag (not (eq system-type 'windows-nt))
+  "Add kanji option to Japanese pTeX family if non-nil.
+If `TeX-japanese-process-input-coding-system' or
+`TeX-japanese-process-output-coding-system' are non-nil, the process coding
+systems are determined by their values regardless of the kanji option."
+  :group 'AUCTeX-jp
+  :type 'boolean)
+
 (setq TeX-engine-alist-builtin
       (append TeX-engine-alist-builtin
              '((ptex "pTeX" "ptex %(kanjiopt)" "platex %(kanjiopt)" "eptex")
@@ -246,11 +254,11 @@ For detail, see `TeX-command-list', to which this list is 
appended."
 ;; $B=gD4$K9T$1$PITMW$K$J$k!#(B
 (setq LaTeX-command-style
       (append '(("\\`u[jt]\\(article\\|report\\|book\\)\\'\\|\\`uplatex\\'"
-                "%(PDF)uplatex %(kanjiopt)%S%(PDFout)")
+                "%(PDF)uplatex %S%(PDFout)")
                ("\\`[jt]s?\\(article\\|report\\|book\\)\\'"
                 "%(PDF)platex %(kanjiopt)%S%(PDFout)")
                ("\\`j-\\(article\\|report\\|book\\)\\'"
-                "%(PDF)jlatex %(kanjiopt)%S%(PDFout)"))
+                "%(PDF)jlatex %S%(PDFout)"))
              LaTeX-command-style))
 
 (defcustom japanese-TeX-error-messages t
@@ -258,28 +266,19 @@ For detail, see `TeX-command-list', to which this list is 
appended."
   :group 'AUCTeX-jp
   :type 'boolean)
 
-;; FIX-ME (2007-02-09) The default coding system in recent Unix (like Fedora 
and
-;; Ubuntu) is utf-8.  But Japanese TeX system does not support utf-8 yet
-;; (platex-utf is under development, may be alpha phase).  So,
-;; process-coding-system for Japanese TeX is not defined from
-;; default-coding-system.  When platex-utf is out, we should look this setting,
-;; again.
-
-(defcustom TeX-japanese-process-input-coding-system
-  (cond ((memq system-type '(windows-nt ms-dos cygwin)) 'shift_jis-dos)
-       ((memq system-type '(mac darwin)) 'shift_jis-mac)
-       (t 'euc-jp-unix))
-  "TeX-process' coding system with standard input."
+(defcustom TeX-japanese-process-input-coding-system nil
+  "If non-nil, used for encoding input to Japanese TeX process.
+When nil, AUCTeX tries to choose suitable coding system.
+See also a user custom option `TeX-japanese-process-output-coding-system'."
   :group 'AUCTeX-jp
-  :type 'coding-system)
+  :type '(choice (const :tag "Default" nil) coding-system))
 
-(defcustom TeX-japanese-process-output-coding-system
-  (cond ((memq system-type '(windows-nt ms-dos cygwin)) 'shift_jis-dos)
-       ((memq system-type '(mac darwin)) 'shift_jis-mac)
-       (t 'euc-jp-unix))
-  "TeX-process' coding system with standard output."
+(defcustom TeX-japanese-process-output-coding-system nil
+  "If non-nil, used for decoding output from Japanese TeX process.
+When nil, AUCTeX tries to choose suitable coding system.
+See also a user custom option `TeX-japanese-process-input-coding-system'."
   :group 'AUCTeX-jp
-  :type 'coding-system)
+  :type '(choice (const :tag "Default" nil) coding-system))
 
 ;; $B=gD4$K9T$1$PITMW$K$J$k!#(B
 (defcustom japanese-TeX-command-default "pTeX"
@@ -327,19 +326,81 @@ For detail, see `TeX-command-list', to which this list is 
appended."
 
 (defun japanese-TeX-set-process-coding-system (process)
   "Set proper coding system for japanese TeX PROCESS."
-  (if (with-current-buffer TeX-command-buffer japanese-TeX-mode)
-      (set-process-coding-system process
-                                TeX-japanese-process-output-coding-system
-                                TeX-japanese-process-input-coding-system)))
+  (with-current-buffer TeX-command-buffer
+    (when japanese-TeX-mode
+      ;; TeX-engine $B$,(B ptex, jtex, uptex 
$B$N$$$:$l$+$G$"$k>l9g$N$_9M$((B
+      ;; $B$k!#(Bluatex-ja $B$J$I$N>address@hidden(B latex-mode 
$B$G$h$/!"(B
+      ;; $B$o$6$o$6(B japanese-latex-mode $B$K$9$kI,MW$,$J$$!#(B
+
+      ;; FIXME: $B0J2<$N=hM}$O(B tex engine 
$B$rBP>]$H$9$k>l9g$7$+9M$($F$$$J$$!#(B
+      ;; bibtex $B$d(B mendex 
$BEy$NJd=u%D!<%k$N>address@hidden/$J$$=hM}$+$b$7$l$J$$!#(B
+      (let*
+         ;; -kanji $B%*%W%7%g%s$"$j$N;~$NJ8;z%3!<%I!#(B
+         ((kanji (and japanese-TeX-use-kanji-opt-flag
+                      (let ((str (japanese-TeX-get-encoding-string)))
+                        (cond
+                         ((equal str "euc") 'euc-jp)
+                         ((equal str "jis") 'iso-2022-jp)
+                         ((equal str "sjis") 'shift_jis)
+                         ((equal str "utf8") 'utf-8)))))
+
+          ;; process $B$+$i$N=PNO$NJ8;z%3!<%I!#(B
+          (dec (cond
+                ;; windows $B$H(B mac $B$N>l9g!#(B
+                ((memq system-type '(windows-nt darwin))
+                 (cond
+                  ;; ptex $B$J$i(B mac $B$O(B utf-8$B!#(B
+                  ;; windows $B$G(B -kanji 
$B%*%W%7%g%s$"$j$N;~$O$=$NJ8;z%3!<%I!"(B
+                  ;; $B$J$7$N;~$O(B sjis$B!#(B
+                  ((eq TeX-engine 'ptex)
+                   (cond ((eq system-type 'darwin)
+                          'utf-8)
+                         (japanese-TeX-use-kanji-opt-flag
+                          kanji)
+                         (t 'shift_jis)))
+                  ;; jtex $B$J$i(B sjis $B$K8GDj$9$k!#(B
+                  ((eq TeX-engine 'jtex)
+                   'shift_jis)
+                  ;; uptex $B$J$i(B utf-8 $B$K8GDj$9$k!#(B
+                  (t
+                   'utf-8)))
+                ;; unix $B$N>l9g!#(B
+                (t
+                 ;; jtex $B$J$i(B euc $B$K8GDj$9$k!#(B
+                 (cond
+                  ((eq TeX-engine 'jtex)
+                   'euc-jp)
+                  ;; $B$=$l0J30$O!"(Buptex $B$G$b(B locale $B$K=>$&!#(B
+                  ;; address@hidden"(Blocale 
$B$,F|K\8l$r%5%]!<%H$7$J$$>l9g$O(B
+                  ;; euc $B$K8GDj$9$k!#(B
+                  (t
+                   (if (japanese-TeX-coding-ejsu locale-coding-system)
+                       locale-coding-system 'euc-jp))))))
+
+          ;; process $B$KM?$($kF~NO$NJ8;z%3!<%I!#(B
+          (enc (cond
+                ;; ptex $B$G(B -kanji 
$B%*%W%7%g%s$"$j$J$i!"$=$NJ8;z%3!<%I!#(B
+                ;; $B$J$7$J$i(B utf-8 $B$+(B sjis$B!#(B
+                ((eq TeX-engine 'ptex)
+                 (if japanese-TeX-use-kanji-opt-flag
+                     kanji
+                   (if (eq system-type 'windows-nt)
+                       'shift_jis 'utf-8)))
+                ;; jtex $B$J$i(B euc $B$+(B sjis $B$K8GDj$9$k!#(B
+                ((eq TeX-engine 'jtex)
+                 (if (memq system-type '(windows-nt darwin))
+                     'shift_jis 'euc-jp))
+                ;; uptex $B$J$i(B utf-8 $B$K8GDj$9$k!#(B
+                (t
+                 'utf-8))))
+       ;; Customize $BCM$,$"address@hidden(B
+       (set-process-coding-system process
+                                  (or 
TeX-japanese-process-output-coding-system dec)
+                                  (or TeX-japanese-process-input-coding-system 
enc))))))
 (when (featurep 'mule)
   (setq TeX-after-start-process-function
         #'japanese-TeX-set-process-coding-system))
 
-(defcustom japanese-TeX-use-kanji-opt-flag t
-  "Add kanji option to Japanese pTeX family if non-nil."
-  :group 'AUCTeX-jp
-  :type 'boolean)
-
 (defun japanese-TeX-coding-ejsu (coding-system)
   "Convert japanese CODING-SYSTEM to mnemonic string.
 euc-jp:    \"euc\"
@@ -348,17 +409,26 @@ shift_jis: \"sjis\"
 utf-8:     \"utf8\"
 Return nil otherwise."
   (let ((base (coding-system-base coding-system)))
+    (if (featurep 'xemacs)
+       (setq base (coding-system-name base)))
     (cdr (assq base
               '((japanese-iso-8bit . "euc")
+                (euc-jp . "euc") ; for xemacs
                 (iso-2022-jp . "jis")
                 (japanese-shift-jis . "sjis")
+                (shift_jis . "sjis") ; for xemacs
                 (utf-8 . "utf8")
+                (mule-utf-8 . "utf8") ; for emacs 21, 22
+                ;; utf-8-auto $B$d(B utf-8-emacs 
$B$rF~$l$kI,MW$O$"$k$N$+!)(B
 
-                ;; xemacs address@hidden<$NL>A0$O0c$&$+$b!D!#(B
+                ;; xemacs $B$G(B jisx0213 $B$O;H$($k$N$+!);H$($k$H$7$F!"(B
+                ;; $B$=$N(B coding system $BL>$O!)(B
                 (euc-jis-2004 . "euc")
                 (iso-2022-jp-2004 . "jis")
                 (japanese-shift-jis-2004 . "sjis")
 
+                ;; xemacs $B$K(B cp932 $B7O$N(B coding system 
$B$,$"$k$N$+(B
+                ;; $B$I$&$+$b$h$/$o$+$i$J$$!#(B
                 (japanese-cp932 . "sjis")
                 (eucjp-ms . "euc"))))))
 
@@ -497,7 +567,12 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'."
 
 (if japanese-TeX-error-messages
 (setq TeX-error-description-list
-  '(("Bad \\\\line or \\\\vector argument.*" .
+  '(("\\(?:Package Preview Error\\|Preview\\):.*" .
+"`preview'$B$X(B`auctex'$B%*%W%7%g%s$rD>@\M?$($k$N$OHr$1$F$/address@hidden(B
+$B%W%l%S%e!<$N<B9T;~0J30$G$3$N%(%i!<$,=P$?>l9g!$M>$j$K$3$_$$$C$?$3$H$r(B
+$B$7$9$.$+!$$G$J$1$l$P(BAUCTeX$B$,$R$I$$<:GT$r$7$F$$$^$9!%(B")
+
+    ("Bad \\\\line or \\\\vector argument.*" .
 
"address@hidden;XDj$9$k!$(B\\line$B$^$?$O(B\\vector$B$N:G=i$N0z?t$,address@hidden(B")
 
     ("Bad math environment delimiter.*" .
diff --git a/tex.el b/tex.el
index 8ea0b45..4f1fdd8 100644
--- a/tex.el
+++ b/tex.el
@@ -1262,8 +1262,11 @@ DE is the name of the desktop environment, either 
\"gnome\" or
 If `TeX-source-correlate-mode' is disabled, only find and pop to
 the output PDF file.  Used by default for the PDF Tools viewer
 entry in `TeX-view-program-list-builtin'."
-  (unless (featurep 'pdf-tools)
-    (error "PDF Tools are not installed"))
+  ;; Make sure `pdf-tools' is at least in the `load-path', but the user must
+  ;; take care of properly loading and installing the package.  We used to test
+  ;; "(featurep 'pdf-tools)", but that doesn't play well with deferred loading.
+  (unless (fboundp 'pdf-tools-install)
+    (error "PDF Tools are not available"))
   (unless TeX-PDF-mode
     (error "PDF Tools only work with PDF output"))
   (add-hook 'pdf-sync-backward-redirect-functions
@@ -1846,12 +1849,42 @@ file and LINE to (+ LINE offset-of-region).  Else, 
return nil."
            (list (expand-file-name (buffer-file-name TeX-region-orig-buffer))
                  (+ line offset) col)))))))
 
+(defcustom TeX-raise-frame-function #'raise-frame
+  "A function which will be called to raise the Emacs frame.
+The function is called after `TeX-source-correlate-sync-source'
+has processed an inverse search DBUS request from Evince or
+Atril in order to raise the Emacs frame.
+
+The default value is `raise-frame', however, depending on window
+manager and focus stealing policies, it might very well be that
+Emacs doesn't pop into the foreground.  So you can do whatever it
+takes here.
+
+For some users, `x-focus-frame' does the trick.  For some
+users (on GNOME 3.20),
+
+  (lambda ()
+    (run-at-time 0.5 nil #'x-focus-frame))
+
+does the trick.  Some other users use the external wmctrl tool to
+raise the Emacs frame like so:
+
+  (lambda ()
+    (call-process
+     \"wmctrl\" nil nil nil \"-i\" \"-R\"
+     (frame-parameter (selected-frame) 'outer-window-id)))"
+  :type 'function
+  :group 'TeX-view)
+
 (defun TeX-source-correlate-sync-source (file linecol &rest ignored)
   "Show TeX FILE with point at LINECOL.
 This function is called when emacs receives a SyncSource signal
 emitted from the Evince document viewer.  IGNORED absorbs an
 unused id field accompanying the DBUS signal sent by Evince-3.0.0
-or newer."
+or newer.
+
+If the Emacs frame isn't raised, customize
+`TeX-raise-frame-function'."
   ;; FILE may be given as relative path to the TeX-master root document or as
   ;; absolute file:// URL.  In the former case, the tex file has to be already
   ;; opened.
@@ -1885,7 +1918,9 @@ or newer."
        (when (or (< pos (point-min))
                  (> pos (point-max)))
          (widen))
-       (goto-char pos)))))
+       (goto-char pos))
+      (when TeX-raise-frame-function
+       (funcall TeX-raise-frame-function)))))
 
 (define-minor-mode TeX-source-correlate-mode
   "Minor mode for forward and inverse search.
@@ -4644,15 +4679,6 @@ See `match-data' for details."
       (buffer-substring-no-properties (match-beginning n) (match-end n))
     ""))
 
-(defun TeX-function-p (arg)
-  "Return non-nil if ARG is callable as a function."
-  (or (and (fboundp 'byte-code-function-p)
-          (byte-code-function-p arg))
-      (and (listp arg)
-          (eq (car arg) 'lambda))
-      (and (symbolp arg)
-          (fboundp arg))))
-
 (defun TeX-booleanp (arg)
   "Return non-nil if ARG is t or nil."
   (memq arg '(t nil)))
@@ -6486,6 +6512,86 @@ NAME may be a package, a command, or a document."
       (append '(plain-tex-mode ams-tex-mode latex-mode doctex-mode)
              ispell-tex-major-modes))
 
+(defcustom TeX-ispell-extend-skip-list t
+  "Whether to extend regions selected for skipping during spell checking."
+  :group 'TeX-misc
+  :type 'boolean)
+
+;; These functions are used to add new items to
+;; `ispell-tex-skip-alists' -- see tex-ispell.el:
+(defun TeX-ispell-skip-setcar (skip)
+  "Add SKIP to car of `ispell-tex-skip-alists'.
+SKIP is an alist with the format described in
+`ispell-tex-skip-alists'.  Each element in SKIP is added on top
+of the car of `ispell-tex-skip-alists'.  This only happens if
+`TeX-ispell-extend-skip-list' is non-nil."
+  (when TeX-ispell-extend-skip-list
+    (let ((raws (car ispell-tex-skip-alists))
+         (envs (cadr ispell-tex-skip-alists)))
+      (dolist (x skip)
+       (pushnew x raws :test #'equal))
+      (setq ispell-tex-skip-alists (list raws envs)))))
+
+(defun TeX-ispell-skip-setcdr (skip)
+  "Add SKIP to cdr of `ispell-tex-skip-alists'.
+SKIP is an alist with the format described in
+`ispell-tex-skip-alists'.  Each element in SKIP is added on top
+of the cdr of `ispell-tex-skip-alists'.  This only happens if
+`TeX-ispell-extend-skip-list' is non-nil."
+  (when TeX-ispell-extend-skip-list
+    (let ((raws (car ispell-tex-skip-alists))
+         (envs (cadr ispell-tex-skip-alists)))
+      (dolist (x skip)
+       (pushnew x envs :test #'equal))
+      (setq ispell-tex-skip-alists (list raws envs)))))
+
+(defun TeX-ispell-tex-arg-end (&optional arg1 arg2 arg3)
+  "Skip across ARG1, ARG2 and ARG3 number of braces and brackets.
+This function is a variation of `ispell-tex-arg-end'.  It should
+be used when adding skip regions to `ispell-tex-skip-alists' for
+constructs like:
+
+  \\begin{tabularx}{300pt}[t]{lrc} ...
+    or
+  \\fontspec{font name}[font features]
+
+where optional and/or mandatory argument(s) follow(s) a mandatory
+one.  ARG1 is the number of mandatory arguments before the
+optional one, ARG2 the max. number of following optional
+arguments, ARG3 is the max. number of mandatory arguments
+following.  Omitting argument means 1.
+
+Here some examples for additions to `ispell-tex-skip-alists':
+
+  \\begin{tabularx}{300pt}[t]{lrc} ...
+               ARG  1    2   3
+  (\"tabularx\" TeX-ispell-tex-arg-end) or equivalent
+  (\"tabularx\" TeX-ispell-tex-arg-end 1 1 1)
+
+  \\fontspec{font name}[font features]
+              ARG1         ARG2        ARG3=0
+  (\"\\\\\\\\fontspec\" TeX-ispell-tex-arg-end 1 1 0)
+
+  \\raisebox{lift}[height][depth]{contents}
+           ARG1       ARG2       ARG3=0 (checked by Ispell)
+  (\"\\\\\\\\raisebox\" TeX-ispell-tex-arg-end 1 2 0)
+
+Optional arguments before the first mandatory one are all
+skipped."
+  (condition-case nil
+      (progn
+       (while (looking-at "[ \t\n]*\\[") (forward-sexp))
+       (forward-sexp (or arg1 1))
+       (let ((num 0))
+         (while (and (looking-at "[ \t\n]*\\[")
+                     (< num (or arg2 1)))
+           (setq num (1+ num))
+           (forward-sexp)))
+       (forward-sexp (or arg3 1)))
+    (error
+     (message "Error skipping s-expressions at point %d" (point))
+     (sit-for 2))))
+
 
 ;;; Abbrev mode
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]