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

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

[elpa] externals/auctex f34ce5a 67/67: Merge remote-tracking branch 'ori


From: Tassilo Horn
Subject: [elpa] externals/auctex f34ce5a 67/67: Merge remote-tracking branch 'origin/master' into externals/auctex
Date: Fri, 8 Feb 2019 11:40:41 -0500 (EST)

branch: externals/auctex
commit f34ce5a0652f14b4911c7a3da347080efea198e2
Merge: eca4ffe 34eab00
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Merge remote-tracking branch 'origin/master' into externals/auctex
---
 Makefile.in                       | 110 +++----
 RELEASE                           |  18 +-
 aclocal.m4                        | 112 +-------
 bib-cite.el                       |   2 +-
 configure.ac                      | 101 +++----
 context.el                        | 107 ++++---
 doc/Makefile.in                   |  24 +-
 doc/auctex.texi                   |  79 ++++--
 doc/changes.texi                  |  17 ++
 doc/install.texi                  |  44 ++-
 doc/preview-latex.texi            |   2 +-
 doc/wininstall.texi               |   4 +-
 font-latex.el                     |  61 ++--
 latex.el                          | 276 ++++++++++--------
 plain-tex.el                      |  75 +++--
 preview.el                        |  36 ++-
 prv-install.el                    | 114 --------
 style/Alegreya.el                 |   7 +-
 style/AlegreyaSans.el             |   7 +-
 style/FiraMono.el                 |   7 +-
 style/FiraSans.el                 |   7 +-
 style/MinionPro.el                |   7 +-
 style/MyriadPro.el                |   7 +-
 style/XCharter.el                 |   7 +-
 style/acro.el                     |   7 +-
 style/acronym.el                  |   7 +-
 style/alltt.el                    |   7 +-
 style/alphanum.el                 |   5 +-
 style/amsfonts.el                 |   7 +-
 style/amsthm.el                   |   7 +-
 style/arabxetex.el                |   7 +-
 style/array.el                    |  11 +-
 style/attachfile.el               |   8 +-
 style/babel.el                    |   7 +-
 style/baskervaldx.el              |   7 +-
 style/beamer.el                   |  75 +++--
 style/biblatex.el                 |   9 +-
 style/bicaption.el                |  41 ++-
 style/bidi.el                     |   7 +-
 style/bm.el                       |   7 +-
 style/booktabs.el                 |   7 +-
 style/breqn.el                    |   4 +
 style/bulgarian.el                |   7 +-
 style/captcont.el                 |   7 +-
 style/caption.el                  |  43 ++-
 style/cleveref.el                 |   7 +-
 style/color.el                    | 223 ++++++++-------
 style/colortbl.el                 |   7 +-
 style/commath.el                  |   7 +-
 style/comment.el                  |  13 +-
 style/csquotes.el                 |   8 +-
 style/danish.el                   |   5 +
 style/dashundergaps.el            | 103 +++++++
 style/dinbrief.el                 |   6 +-
 style/emp.el                      |  41 ++-
 style/empheq.el                   |  27 +-
 style/enumitem.el                 | 132 ++++++---
 style/environ.el                  |   7 +-
 style/epigraph.el                 |   7 +-
 style/erewhon.el                  |   7 +-
 style/exam.el                     |  17 +-
 style/expl3.el                    |   7 +-
 style/fancyhdr.el                 |  11 +-
 style/fancyref.el                 |   7 +-
 style/fancyvrb.el                 | 193 +++++++------
 style/fbb.el                      |   7 +-
 style/flashcards.el               |   7 +-
 style/floatrow.el                 |  60 ++--
 style/fontaxes.el                 |   7 +-
 style/fontspec.el                 |  10 +-
 style/footmisc.el                 |   7 +-
 style/fvextra.el                  |   5 +
 style/geometry.el                 |  14 +-
 style/german.el                   |   9 +
 style/gloss-italian.el            |  10 +-
 style/graphics.el                 |   9 +-
 style/graphicx.el                 |  19 +-
 style/hologo.el                   |   7 +-
 style/hyperref.el                 |  26 +-
 style/icelandic.el                |   7 +-
 style/ifluatex.el                 |   9 +-
 style/italian.el                  |   7 +-
 style/jurabib.el                  |   9 +-
 style/kpfonts.el                  |   7 +-
 style/letter.el                   |   7 +-
 style/lettrine.el                 |   5 +
 style/listings.el                 |  62 +++-
 style/longtable.el                |   7 +-
 style/ltxtable.el                 |  11 +-
 style/luacode.el                  |   7 +-
 style/marginnote.el               |   5 +
 style/mathtools.el                |  17 +-
 style/mdframed.el                 |  12 +-
 style/mdwlist.el                  |   7 +-
 style/menukeys.el                 |  11 +-
 style/metalogo.el                 |   7 +-
 style/mflogo.el                   |   5 +
 style/minted.el                   |  16 ++
 style/mn2e.el                     |   7 +-
 style/mnras.el                    |   7 +-
 style/moodle.el                   |   7 +-
 style/multirow.el                 |   7 +-
 style/nameref.el                  |   7 +-
 style/natbib.el                   |   7 +-
 style/newfloat.el                 |   9 +-
 style/newpxtext.el                |   7 +-
 style/newtxtext.el                |   7 +-
 style/newtxttt.el                 |   7 +-
 style/ngerman.el                  |   9 +
 style/nicefrac.el                 |   7 +-
 style/nomencl.el                  |   7 +-
 style/ntheorem.el                 |  15 +-
 style/ocg-p.el                    |   5 +
 style/ocgx.el                     |   5 +
 style/paracol.el                  |   7 +-
 style/paralist.el                 |   7 +-
 style/pdfpages.el                 |   8 +-
 style/polski.el                   |   7 +-
 style/polyglossia.el              |   7 +-
 style/preview.el                  |   7 +-
 style/pst-grad.el                 |   5 +
 style/pst-node.el                 |  11 +
 style/pst-plot.el                 |  57 ++--
 style/pst-slpe.el                 |   5 +
 style/pstricks.el                 |   7 +-
 style/pythontex.el                | 570 +++++++++++++++++++++++++++++++++++++
 style/relsize.el                  |   7 +-
 style/scrbase.el                  |   8 +-
 style/scrbook.el                  |   7 +-
 style/scrlttr2.el                 |   7 +-
 style/scrpage2.el                 |   5 +
 style/scrreprt.el                 |   7 +-
 style/setspace.el                 |   7 +-
 style/shortvrb.el                 |   7 +-
 style/siunitx.el                  |   7 +-
 style/slovak.el                   |   5 +
 style/sourcecodepro.el            |   7 +-
 style/splitidx.el                 |   9 +-
 style/subcaption.el               |  10 +-
 style/subfigure.el                |   7 +-
 style/subfiles.el                 |  11 +-
 style/tcolorbox.el                |  13 +-
 style/tcolorboxlib-raster.el      |  10 +-
 style/textpos.el                  |   4 +
 style/theorem.el                  |   7 +-
 style/thm-restate.el              |   4 +
 style/thmtools.el                 |   7 +-
 style/titleps.el                  |   7 +-
 style/titlesec.el                 |   7 +-
 style/titletoc.el                 |   7 +-
 style/transparent.el              |   7 +-
 style/ulem.el                     |   7 +-
 style/unicode-math.el             |   7 +-
 style/units.el                    |   7 +-
 style/url.el                      |  21 +-
 style/varioref.el                 |   7 +-
 style/vwcol.el                    |   7 +-
 style/xcolor.el                   |  73 +++--
 style/xparse.el                   |   7 +-
 style/xspace.el                   |   7 +-
 style/zlmtt.el                    |   7 +-
 tests/latex/latex-test.el         |  65 ++++-
 tests/latex/preview-latex-test.el |  49 ++++
 tests/tex/command-expansion.el    |   8 +-
 tex-bar.el                        |  15 +-
 tex-buf.el                        | 150 ++++------
 tex-fold.el                       |  16 +-
 tex-info.el                       | 144 +++++-----
 tex-ispell.el                     |  50 +++-
 tex-style.el                      |   5 +-
 tex.el                            | 582 ++++++++++++++++----------------------
 171 files changed, 3229 insertions(+), 1775 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 6c80882..3c07c16 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2,7 +2,7 @@
 
 # Maintainer: address@hidden
 
-# Copyright (C) 2003-2008, 2010, 2013-2015 Free Software
+# Copyright (C) 2003-2008, 2010, 2013-2015, 2018 Free Software
 #   Foundation, Inc.
 
 # This file is part of AUCTeX.
@@ -37,7 +37,6 @@ address@hidden@
 previewstartfile = @previewstartfile@
 packagelispdir = @address@hidden(null)
 packagedatadir = @address@hidden(null)
-packagedir = @address@hidden(null)
 autodir = @address@hidden(null)
 address@hidden@
 styledir = $(packagedatadir)/style
@@ -74,18 +73,14 @@ DIST_PREFIX=$(PWD)/auctex-dist
 FTPDIR = $(DIST_PREFIX)/ftp
 WWWDIR = $(DIST_PREFIX)/www
 CTANDIR = $(DIST_PREFIX)/ctan
-XEMACS_BUILD_DIR = xemacs-build
 PREVIEW_BUILD_DIR = preview-build
 COMMITTER="`git config --get user.name`\ \ \<`git config --get user.email`\>"
 RPMROOT = /usr/src/redhat
 RPM_SIGN = --sign
 
-MULESRC = @MULESRC@
-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 \
+       context.el context-en.el context-nl.el tex-fold.el tex-jp.el \
        toolbar-x.el tex-bar.el bib-cite.el tex-ispell.el latex-flymake.el
 AUCELC = $(AUCSRC:.el=.elc)
 
@@ -169,19 +164,20 @@ STYLESRC = style/prosper.el \
           style/floatrow.el  style/moodle.el    style/canadian.el \
           style/arabxetex.el style/australian.el style/newzealand.el \
           style/xltabular.el style/marginnote.el style/thmtools.el \
-          style/ocg-p.el     style/ocgx.el      style/thm-restate.el
+          style/ocg-p.el     style/ocgx.el      style/thm-restate.el \
+          style/pythontex.el style/dashundergaps.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
 ifeq (@preview_enabled@,yes)
    PREVIEWSRC = @PLAT_LISP@ preview.el
    PREVIEWELC = $(PREVIEWSRC:.el=.elc)
-   PREVIEWLATEX = test "x$(packagedir)" != xno || $(MAKE) preview-latex.el
+   PREVIEWLATEX = $(MAKE) preview-latex.el
    TEXMF = (cd latex ; $(MAKE) all)
 
    # Install actions
    INS_TEXMF = (cd latex ; $(MAKE) DESTDIR=$(DESTDIR) install)
-   PREVIEW_INS_STARTUP = test $(packagedir) != no || \
+   PREVIEW_INS_STARTUP = \
      $(INSTALL_DATA) preview-latex.el $(DESTDIR)$(previewstartfile)
 else
    # Don't do anything with preview if the user doesn't want the
@@ -196,7 +192,7 @@ endif
 
 
 
-CLEANFILES = $(AUCELC) $(STYLEELC) $(MULEELC) $(PREVIEWELC) preview-latex.el
+CLEANFILES = $(AUCELC) $(STYLEELC) $(PREVIEWELC) preview-latex.el
 DISTCLEANFILES = Makefile tex-site.el tex-site.el.out auctex.el \
        auto-loads.el config.* preview.el
 DISTTEXTS = FAQ INSTALL INSTALL.windows README TODO PROBLEMS.preview
@@ -206,17 +202,17 @@ NOSEARCH = style/.nosearch
 all: texmf lisp docs
 
 .PHONY: all lisp info dvi some install install-el install-lisp docs    \
-       install-docs install-auto install-metadata install-startup      \
-       install-man clean distclean maintainer-clean extraclean         \
+       install-docs install-auto install-startup                       \
+       clean distclean maintainer-clean extraclean                     \
        tar-ball-clean check-tag check release-commit dist snapshot     \
-       patch tar-ball rpm-packages wc xemacs-package windows-package   \
+       patch tar-ball rpm-packages wc windows-package  \
        release-sign release-upload preview-ball uninstall
 
 texmf: latex/Makefile
        $(TEXMF)
 
-lisp:  tex-site.el $(AUCSRC) $(STYLESRC) $(MULESRC) $(PREVIEWSRC)
-       $(ELCC) -f batch-byte-compile $(AUCSRC) $(STYLESRC) $(MULESRC) 
$(PREVIEWSRC)
+lisp:  tex-site.el $(AUCSRC) $(STYLESRC) $(PREVIEWSRC)
+       $(ELCC) -f batch-byte-compile $(AUCSRC) $(STYLESRC) $(PREVIEWSRC)
        $(PREVIEWLATEX)
 
 preview-latex.el: preview.el
@@ -239,9 +235,9 @@ dvi:
 
 tex-site.el: tex-site.el.out auto-loads.el Makefile
        cat tex-site.el.out >$@
-       test X$(packagedir) != Xno || cat auto-loads.el >>$@
+       cat auto-loads.el >>$@
        echo "(provide 'tex-site)" >>$@ ; \
-       test X$(packagedir) != Xno || echo ";;; tex-site.el ends here" >>$@
+       echo ";;; tex-site.el ends here" >>$@
 
 tex-site.el.out: tex-site.el.in Makefile config.status
        ./config.status
@@ -264,32 +260,24 @@ doc/Makefile: doc/Makefile.in config.status ChangeLog.1
 config.status: configure
        ./config.status --recheck
 
-auto-loads.el: $(AUCSRC) $(MULESRC) Makefile
-       test X$(packagedir) != Xno || { \
-         rm -f $@ ; \
-         $(ELCC) $(AUTOLOAD) $(AUCSRC) $(MULESRC) || : ; \
-         test -r $@ || { \
-           echo ";; Auto-generated part of tex-site.el" > $@ ; \
-           echo "" >> $@ ; \
-           $(ELCC) $(AUTOLOAD) $(AUCSRC) $(MULESRC) ; \
-         } ; \
+auto-loads.el: $(AUCSRC) Makefile
+       rm -f $@
+       -$(ELCC) $(AUTOLOAD) $(AUCSRC)
+       test -r $@ || { \
+         echo ";; Auto-generated part of tex-site.el" > $@ ; \
+         echo "" >> $@ ; \
+         $(ELCC) $(AUTOLOAD) $(AUCSRC) ; \
        }
 
 some:  $(AUCELC) $(STYLEELC)
 
 install: install-texmf install-lisp install-docs install-images \
          install-startup
-       $(MAKE) 'DESTDIR=$(DESTDIR)' install-metadata
-
-install-man: doc/Makefile
-       cd doc && $(MAKE) 'DESTDIR=$(DESTDIR)' install-man
-       $(INSTALL_DATA) RELEASE $(DESTDIR)$(packagedir)/man/auctex
 
 install-startup:
        $(PREVIEWLATEX)
        $(PREVIEW_INS_STARTUP)
-       test $(packagedir) != no || \
-         $(INSTALL_DATA) auctex.el $(DESTDIR)$(auctexstartfile)
+       $(INSTALL_DATA) auctex.el $(DESTDIR)$(auctexstartfile)
 
 install-texmf:
        $(INS_TEXMF)
@@ -305,15 +293,12 @@ install-el:
            mv $(DESTDIR)$(lispdir)/tex-site.el 
$(DESTDIR)$(lispdir)/tex-site.el.save ; \
           fi; \
        }
-       if test X$(packagedir) = Xno; \
-       then $(INSTALL_DATA) tex-site.el $(DESTDIR)$(lispdir) ; \
-       else rm -f $(DESTDIR)$(lispdir)/tex-site.el ; \
-       fi
+       $(INSTALL_DATA) tex-site.el $(DESTDIR)$(lispdir)
        -$(MKINSTALLDIRS) $(DESTDIR)$(packagelispdir)
-       @: $(MAKE) ; for x in $(AUCSRC) $(MULESRC) $(PREVIEWSRC); do \
+       @: $(MAKE) ; for x in $(AUCSRC) $(PREVIEWSRC); do \
          echo '$(INSTALL_DATA)' $$x '$(DESTDIR)$(packagelispdir)' ; \
        done
-       @for x in $(AUCSRC) $(MULESRC) $(PREVIEWSRC); do \
+       @for x in $(AUCSRC) $(PREVIEWSRC); do \
          $(INSTALL_DATA) $$x $(DESTDIR)$(packagelispdir) ; \
        done;
        -$(MKINSTALLDIRS) $(DESTDIR)$(styledir)
@@ -328,10 +313,10 @@ install-el:
        -$(INSTALL_DATA) $(NOSEARCH) $(DESTDIR)$(autodir)
 
 install-lisp: some install-el
-       @: $(MAKE) ; for x in $(AUCSRC) $(MULESRC) $(PREVIEWSRC); do \
+       @: $(MAKE) ; for x in $(AUCSRC) $(PREVIEWSRC); do \
          echo '$(INSTALL_DATA)' $${x}c '$(DESTDIR)$(packagelispdir)' ; \
        done
-       @for x in $(AUCSRC) $(MULESRC) $(PREVIEWSRC); do \
+       @for x in $(AUCSRC) $(PREVIEWSRC); do \
          $(INSTALL_DATA) $${x}c $(DESTDIR)$(packagelispdir) ; \
        done
        @: $(MAKE) ; for x in $(STYLESRC) ; do \
@@ -358,28 +343,10 @@ install-docs:     doc/Makefile
 install-auto:
        @echo "Use \"M-x TeX-auto-generate-global RET\" instead."
 
-install-metadata:
-       test "x$(packagedir)" = xno || { \
-         $(MKINSTALLDIRS) $(DESTDIR)$(packagedir)/pkginfo || : ; \
-         $(ELCC) -l prv-install -f preview-make-package 
$(DESTDIR)$(packagedir) "$(PACKAGE)" \"`echo $(AUCTEXDATE)|sed 
's/\(.*\)-\(.*\)-\(.*\)/\1.\2\3/'`\" \"$(AUCTEXVERSION)\" tex-site.el && \
-         cd $(DESTDIR)$(packagedir) && \
-         find "etc/$(PACKAGE)" "lisp/$(PACKAGE)" -print 
>"pkginfo/MANIFEST.$(PACKAGE)" && \
-         for i in $(PACKAGE_INFO); do \
-           test -r "info/$$i.info" && echo "info/$$i.info" >> 
"pkginfo/MANIFEST.$(PACKAGE)" ; \
-         done && \
-         echo "pkginfo/MANIFEST.$(PACKAGE)" >> "pkginfo/MANIFEST.$(PACKAGE)" ; 
\
-       }
-
 uninstall:
        rm -rf $(DESTDIR)$(packagelispdir) $(DESTDIR)$(packagedatadir) \
                $(DESTDIR)$(autodir)
-       if test X$(packagedir) = Xno ; then \
-               rm -f $(DESTDIR)$(lispdir)/tex-site.el \
-               $(DESTDIR)$(auctexstartfile) ; \
-       else \
-               rm -f $(DESTDIR)$(packagedir)/man/auctex/RELEASE \
-               $(DESTDIR)$(packagedir)/pkginfo/MANIFEST.$(PACKAGE); \
-       fi
+       rm -f $(DESTDIR)$(lispdir)/tex-site.el $(DESTDIR)$(auctexstartfile)
        cd doc ; $(MAKE) DESTDIR=$(DESTDIR) uninstall
        rm -f $(DESTDIR)$(previewstartfile)
        rm -rf $(DESTDIR)$(packagelispdir)
@@ -407,7 +374,6 @@ extraclean: maintainer-clean
 
 tar-ball-clean: check-tag
        rm -rf auctex-$(TAG)/
-       rm -rf $(XEMACS_BUILD_DIR)/
 
 wc:
        wc $(AUCSRC) $(STYLESRC)
@@ -488,25 +454,22 @@ change-history-commit:
 # 3) dist TAG=<tag>
 #    Create the tar ball and other release files and put them into $FTPDIR.
 #
-# 4) xemacs-package TAG=<tag>
-#    Create the precompiled XEmacs package.
-#
-# 5) windows-package WEMACSVER=<emacs-version> TAG=<tag>
+# 4) windows-package WEMACSVER=<emacs-version> TAG=<tag>
 #    Create the precompiled AUCTeX package for Windows.
 #    This requires a compiled Emacs of the same version at location $WEMACS.
 #    NOTA BENE: you may need to use bash shell for this recipe to work.
 #
-# 6) release-sign TAG=<tag>
+# 5) release-sign TAG=<tag>
 #    Sign the tar ball and create directive files for upload.  NOTA BENE: you
 #    may need to use bash shell for this recipe to work.
 #
-# 7) release-upload
+# 6) release-upload
 #    Upload files to GNU FTP server.
 #
-# 8) www-doc TAG=<tag>
+# 7) www-doc TAG=<tag>
 #    Create documentation for AUCTeX home page.
 #
-# 9) preview-ball TAG=<tag>
+# 8) preview-ball TAG=<tag>
 #    Create preview package.  (Not for GNU FTP server but for CTAN.)
 
 dist: check-tag tar-ball
@@ -573,13 +536,6 @@ patch:
        diff -u auctex-$(OLD) auctex-$(TAG) | gzip --best \
                >$(FTPDIR)/auctex-$(OLD)-to-$(TAG).patch.gz
 
-xemacs-package: check-tag
-       rm -rf $(XEMACS_BUILD_DIR)
-       $(CP_A) auctex-$(TAG) $(XEMACS_BUILD_DIR)
-       cd $(XEMACS_BUILD_DIR) \
-       && ./configure INSTALL_INFO=: TEXHASH=: --with-xemacs 
--with-packagedir=`pwd`/xemacs-package --without-texmf-dir 
--with-auto-dir=etc/auctex/auto \
-       && $(MAKE) all install-man install && cd xemacs-package && tar -cf - 
--owner=root --group=root . | gzip --best > $(FTPDIR)/auctex-$(TAG)-pkg.tar.gz
-
 # Pre-compiled AUCTeX package for Emacs on Windows
 WBUILDDIR=$(PWD)/windows-package
 WEMACS=/usr/src/emacs-$(WEMACSVER)/src/emacs
diff --git a/RELEASE b/RELEASE
index c64bf1f..763957e 100644
--- a/RELEASE
+++ b/RELEASE
@@ -3,15 +3,15 @@ Release notes for AUCTeX 12.1 with preview-latex
 
 AUCTeX provides by far the most wide-spread and sophisticated
 environment for editing LaTeX, TeX, ConTeXt and Texinfo documents with
-Emacs or XEmacs.  Combined with packages like RefTeX, flyspell and
-others it is pretty much without peer as a comprehensive authoring
-solution for a large variety of operating system platforms and TeX
-distributions.  It supports document-dependent completion and syntax
-highlighting, easily accessible menus, jumping to error locations in
-the source file, a number of editing shortcuts, intelligent
-indentation and filling of text during entry, and WYSIWYG previews of
-graphical elements like math formulas right in the Emacs source
-buffer, by virtue of its preview-latex component.
+Emacs.  Combined with packages like RefTeX, flyspell and others it is
+pretty much without peer as a comprehensive authoring solution for a
+large variety of operating system platforms and TeX distributions.  It
+supports document-dependent completion and syntax highlighting, easily
+accessible menus, jumping to error locations in the source file, a
+number of editing shortcuts, intelligent indentation and filling of
+text during entry, and WYSIWYG previews of graphical elements like
+math formulas right in the Emacs source buffer, by virtue of its
+preview-latex component.
 
 One part of the preview-latex subsystem is the central `preview.sty'
 file that is independently useful for a number of applications and is
diff --git a/aclocal.m4 b/aclocal.m4
index 08b0b52..383a593 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -34,7 +34,7 @@ AC_DEFUN(EMACS_PATH_PREFIX,[
     prefix) (error "NONE"))]],[[-no-site-file]],[[cmd]],[$2])])
 
 AC_DEFUN(EMACS_PROG_EMACS, [
-# Check for (X)Emacs, report its path, flavor and prefix
+# Check for Emacs, report its path, flavor and prefix
 
 # Apparently, if you run a shell window in Emacs, it sets the EMACS
 # environment variable to 't'.  Let's undo the damage.
@@ -44,48 +44,16 @@ fi
 AC_ARG_WITH(emacs,
   [  --with-emacs@<:@=PATH@:>@     Use Emacs to build (on PATH if given)],
   [if test "${withval}" = "yes"; then EMACS=emacs
-   elif test "${withval}" = "no"; then EMACS=xemacs
    else EMACS="${withval}"; fi])
 
-AC_ARG_WITH(xemacs,
-  [  --with-xemacs@<:@=PATH@:>@    Use XEmacs to build (on PATH if given)],
-  [if test "x${withval}" != xno
-   then
-     if test "x${with_emacs}" != xno -a "x${with_emacs}" != x
-     then
-       AC_MSG_ERROR([[cannot use both Emacs and XEmacs]])
-     fi
-     if test "x${withval}" = "xyes"
-     then
-       EMACS=xemacs
-     else
-       EMACS="${withval}"
-     fi
-   elif test "x${with_emacs}" = xno
-   then
-     AC_MSG_ERROR([[need to use either Emacs or XEmacs]])
-   fi])
-
 # "${prefix}/bin" is for Windows users
-AC_PATH_PROGS(EMACS, ${EMACS} emacs xemacs, "", ${PATH} "${prefix}/bin" )
+AC_PATH_PROGS(EMACS, ${EMACS} emacs, "", ${PATH} "${prefix}/bin" )
 if test -z "${EMACS}"; then
-  AC_MSG_ERROR([(X)Emacs not found!  Aborting!])
+  AC_MSG_ERROR([Emacs not found!  Aborting!])
 fi
 
-AC_MSG_CHECKING([if ${EMACS} is XEmacs])
-EMACS_LISP(XEMACS,
-       [[(if (featurep (quote xemacs)) \"yes\" \"no\")]],[[-no-site-file]])
-if test "${XEMACS}" = "yes"; then
-  EMACS_FLAVOR=xemacs
-  EMACS_NAME="XEmacs"
-elif test "${XEMACS}" = "no"; then
   EMACS_FLAVOR=emacs
   EMACS_NAME="Emacs"
-else
-  AC_MSG_ERROR([Unable to run ${EMACS}!  Aborting!])
-fi
-  AC_MSG_RESULT(${XEMACS})
-  AC_SUBST(XEMACS)
   AC_SUBST(EMACS_FLAVOR)
   AC_MSG_CHECKING([for ${EMACS_NAME} prefix])
   EMACS_PATH_PREFIX([[emacsprefix]],[["${EMACS}"]])
@@ -189,31 +157,6 @@ AC_DEFUN(EMACS_EXAMINE_INSTALLATION_DIR,
   [prefix expanded $6],["${currentprefix}" "${expprefix}" $7])
   if test "[$]$1" != NONE; then break; fi; done])
 
-AC_DEFUN(EMACS_PATH_PACKAGEDIR,
- [AC_ARG_WITH(packagedir,
-    [  --with-packagedir=DIR   package DIR for XEmacs],
-    [packagedir="`echo ${withval} | sed 's/^~\//${HOME}\//;s/[[\/\\]]$//'`"],
-    [if test ${EMACS_FLAVOR} = xemacs; then
-      AC_MSG_CHECKING([for XEmacs package directory])
-      EMACS_EXAMINE_INSTALLATION_DIR(packagedir,
-        [['${datadir}/xemacs/xemacs-packages' \
-         '${libdir}/xemacs/xemacs-packages' \
-          '${datadir}' '${libdir}' "${emacsprefix}"]],
-        [[(list \"xemacs/site-packages\" \"xemacs/xemacs-packages\"
-                \"site-packages\" \"xemacs-packages\")]],
-        [[(if (boundp 'late-packages)
-             (append late-packages last-packages early-packages)
-           (append late-package-hierarchies last-package-hierarchies
-                   early-package-hierarchies))]])
-      if test "x${packagedir}" = xNONE -o -z "${packagedir}"; then
-        AC_MSG_ERROR([not found, exiting!])
-      fi
-      AC_MSG_RESULT(${packagedir})
-    else
-      packagedir=no
-    fi])
-  AC_SUBST(packagedir)])
-
 AC_DEFUN(EMACS_PATH_LISPDIR, [
   AC_MSG_CHECKING([where lisp files go])
   AC_ARG_WITH(lispdir,
@@ -221,24 +164,19 @@ AC_DEFUN(EMACS_PATH_LISPDIR, [
                           files will be place in a subdirectory.],
     [[lispdir="${withval}"]])
   if test "X${lispdir}" = X; then
-     if test "X${packagedir}" = Xno; then
-       # Test paths relative to prefixes
-       EMACS_EXAMINE_INSTALLATION_DIR(lispdir,
-         [['${datadir}/'${EMACS_FLAVOR} '${libdir}/'${EMACS_FLAVOR} \
-          "${emacsprefix}/share/${EMACS_FLAVOR}" \
-           '${datadir}' '${libdir}' "${emacsprefix}"]],
-        [[(list \"${EMACS_FLAVOR}/site-lisp\" \"${EMACS_FLAVOR}/site-packages\"
-                \"site-lisp\" \"site-packages\")]], load-path)
-       if test "${lispdir}" = "NONE"; then
-        # No? notify user.
-        AC_MSG_ERROR([Cannot locate lisp directory,
+    # Test paths relative to prefixes
+    EMACS_EXAMINE_INSTALLATION_DIR(lispdir,
+      [['${datadir}/'${EMACS_FLAVOR} '${libdir}/'${EMACS_FLAVOR} \
+       "${emacsprefix}/share/${EMACS_FLAVOR}" \
+        '${datadir}' '${libdir}' "${emacsprefix}"]],
+      [[(list \"${EMACS_FLAVOR}/site-lisp\" \"${EMACS_FLAVOR}/site-packages\"
+             \"site-lisp\" \"site-packages\")]], load-path)
+    if test "${lispdir}" = "NONE"; then
+      # No? notify user.
+      AC_MSG_ERROR([Cannot locate lisp directory,
 use  --with-lispdir, --datadir, or possibly --prefix to rectify this])
-       fi
-     else
-       # XEmacs
-       lispdir="${packagedir}/lisp"
-     fi
     fi
+  fi
   AC_MSG_RESULT([[${lispdir}]])
   AC_SUBST(lispdir)
 ])
@@ -511,28 +449,6 @@ AC_SUBST(auctexdir)
 ])
 
 dnl
-dnl Check if (X)Emacs supports international characters,
-dnl i.e. provides MULE libraries and runs in multibyte mode.
-dnl
-AC_DEFUN(EMACS_CHECK_MULE, [
-AC_MSG_CHECKING(for MULE support)
-EMACS_CHECK_REQUIRE(mule,silent)
-if test "${HAVE_mule}" = "yes" && test "X${EMACS_UNIBYTE}" = X; then
-  MULESRC="tex-jp.el"
-  MULEELC="tex-jp.elc"
-  AC_MSG_RESULT(yes)
-else
-  AC_MSG_RESULT(no)
-  if test "X${EMACS_UNIBYTE}" != X; then
-    AC_MSG_WARN([[EMACS_UNIBYTE environment variable set.
-Disabling features requiring international character support.]])
-  fi
-fi
-AC_SUBST(MULESRC)
-AC_SUBST(MULEELC)
-])
-
-dnl
 dnl MAKEINFO_CHECK_MACRO( MACRO, [ACTION-IF-FOUND
 dnl                                    [, ACTION-IF-NOT-FOUND]])
 dnl
diff --git a/bib-cite.el b/bib-cite.el
index 2a7e74c..d871cb0 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -7,7 +7,7 @@
 ;; Author:    Peter S. Galbraith <address@hidden>
 ;; Created:   06 July 1994
 ;; Version:   3.28  (Feb 23 2005)
-;; Keywords:  bibtex, cite, auctex, emacs, xemacs
+;; Keywords:  bibtex, cite, auctex, emacs
 
 ;;; This file is not part of GNU Emacs.
 
diff --git a/configure.ac b/configure.ac
index fe7fef6..4ba8b57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,14 +37,7 @@ AC_SUBST(PREVIEWVERSION)
 
 EMACS_PROG_EMACS
 
-if test ${EMACS_FLAVOR} = xemacs
-then
-  EMACS_CHECK_VERSION(21,4)
-else
-  EMACS_CHECK_VERSION(21,1)
-fi
-
-EMACS_CHECK_MULE
+EMACS_CHECK_VERSION(24,1)
 
 # The Debian package uses `--disable-build-dir-test'; normal users should
 # never need to modify the default behavior.
@@ -62,59 +55,40 @@ AC_ARG_ENABLE(preview,
   [preview_enabled="yes"])
 AC_SUBST(preview_enabled)
 
-if test ${EMACS_FLAVOR} = "xemacs"  ; then
-   EMACS_PATH_PACKAGEDIR
-   PLAT_LISP=prv-xemacs.el
-else
-   packagedir=no
-   PLAT_LISP=prv-emacs.el
-fi
+PLAT_LISP=prv-emacs.el
 
-if test "X${packagedir}" = Xno
+EMACS_PATH_LISPDIR
+AC_MSG_CHECKING(what file to use for auctex startup)
+AC_ARG_WITH(auctexstartfile,
+[[  --with-auctexstartfile=FILE    What file to use for auctex startup.]],
+[[ auctexstartfile="${withval}" ]],
+[ _tmpdir_="${lispdir}"
+AC_FULL_EXPAND(_tmpdir_)
+if test -d "${_tmpdir_}/site-start.d"
 then
-   EMACS_PATH_LISPDIR
-   AC_MSG_CHECKING(what file to use for auctex startup)
-   AC_ARG_WITH(auctexstartfile,
-   [[  --with-auctexstartfile=FILE    What file to use for auctex startup.]],
-   [[ auctexstartfile="${withval}" ]],
-   [ _tmpdir_="${lispdir}"
-     AC_FULL_EXPAND(_tmpdir_)
-     if test -d "${_tmpdir_}/site-start.d"
-     then
-       auctexstartfile="${lispdir}/site-start.d/auctex.el"
-     else
-       auctexstartfile="${lispdir}/auctex.el"
-     fi])
-   AC_MSG_RESULT([[${auctexstartfile}]])
-
-   AC_MSG_CHECKING(what file to use for preview startup)
-   AC_ARG_WITH(previewstartfile,
-   [[  --with-previewstartfile=FILE    What file to use for preview startup.]],
-   [[ previewstartfile="${withval}" ]],
-   [ _tmpdir_="${lispdir}"
-     AC_FULL_EXPAND(_tmpdir_)
-     if test -d "${_tmpdir_}/site-start.d"
-     then
-       previewstartfile="${lispdir}/site-start.d/preview-latex.el"
-     else
-       previewstartfile="${lispdir}/preview-latex.el"
-     fi])
-   AC_MSG_RESULT([[${previewstartfile}]])
-
-   packagelispdir="${lispdir}/auctex"
-   packagedatadir="${packagelispdir}"
-   texsitedir="${lispdir}"
+auctexstartfile="${lispdir}/site-start.d/auctex.el"
 else
-   #lispdir is only used for determining relative files.
-   lispdir="${packagedir}"
-   packagelispdir="${packagedir}/lisp/auctex"
-   texsitedir="$packagelispdir"
-   auctexstartfile="${packagelispdir}"/auto-autoloads.el
-   previewstartfile="${packagelispdir}"/auto-autoloads.el
-   packagedatadir="${packagedir}/etc/auctex"
-   infodir="${packagedir}/info"
-   INSTALL_INFO=:
-fi
+auctexstartfile="${lispdir}/auctex.el"
+fi])
+AC_MSG_RESULT([[${auctexstartfile}]])
+
+AC_MSG_CHECKING(what file to use for preview startup)
+AC_ARG_WITH(previewstartfile,
+[[  --with-previewstartfile=FILE    What file to use for preview startup.]],
+[[ previewstartfile="${withval}" ]],
+[ _tmpdir_="${lispdir}"
+AC_FULL_EXPAND(_tmpdir_)
+if test -d "${_tmpdir_}/site-start.d"
+then
+previewstartfile="${lispdir}/site-start.d/preview-latex.el"
+else
+previewstartfile="${lispdir}/preview-latex.el"
+fi])
+AC_MSG_RESULT([[${previewstartfile}]])
+
+packagelispdir="${lispdir}/auctex"
+packagedatadir="${packagelispdir}"
+texsitedir="${lispdir}"
 
 AC_SUBST(auctexstartfile)
 AC_SUBST(previewstartfile)
@@ -140,14 +114,6 @@ 
AC_LISPIFY_DIR(texsite,[["${auctexstartfile}"]],tex-site.el)
 AC_MSG_CHECKING(where the info files go)
 AC_MSG_RESULT([[${infodir}]])
 
-AC_SUBST(packagedir)
-
-if test $EMACS_FLAVOR = "xemacs" -a "$infodir" = '${prefix}/info'; then
-  if test $packagedir != 'no'; then
-   infodir='${packagedir}/info'
-  fi
-fi
-
 AUCTEX_AUTO_DIR
 AC_LISPIFY_DIR(autodir,"${texsitedir}/tex-site.el")
 
@@ -278,7 +244,7 @@ AC_PATH_PROG(TEXI2HTML, texi2html, :)
 AC_PATH_PROG(TEXI2DVI, texi2dvi, :)
 AC_PATH_PROG(TEXI2PDF, texi2pdf, :)
 
-AC_ARG_VAR(INSTALL_INFO, [install-info executable.  Set to : to skip making a 
dir file.  This is the default when installing into an XEmacs package.])
+AC_ARG_VAR(INSTALL_INFO, [install-info executable.  Set to : to skip making a 
dir file.])
 
 if test "X${INSTALL_INFO}" = X
 then
@@ -287,7 +253,6 @@ fi
 
 AC_SHELL_QUOTIFY(prefix)
 AC_SHELL_QUOTIFY(localstatedir)
-AC_SHELL_QUOTIFY(packagedir)
 AC_SHELL_QUOTIFY(packagelispdir)
 AC_SHELL_QUOTIFY(packagedatadir)
 AC_SHELL_QUOTIFY(lispdir)
diff --git a/context.el b/context.el
index ee35eb6..db2f86f 100644
--- a/context.el
+++ b/context.el
@@ -1,6 +1,6 @@
 ;;; context.el --- Support for ConTeXt documents.
 
-;; Copyright (C) 2003-2006, 2008, 2010, 2012, 2014-2017
+;; Copyright (C) 2003-2006, 2008, 2010, 2012, 2014-2018
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: Berend de Boer <address@hidden>
@@ -1482,58 +1482,57 @@ else.  There might be text before point."
 (easy-menu-define ConTeXt-mode-menu
   ConTeXt-mode-map
   "Menu used in ConTeXt mode."
-  (TeX-menu-with-help
-   `("ConTeXt"
-     (,ConTeXt-project-structure-menu-name)
-     (,ConTeXt-section-block-menu-name)
-     (,ConTeXt-numbered-section-menu-name)
-     (,ConTeXt-unnumbered-section-menu-name)
-     ["Add Table of Contents to Emacs Menu" (imenu-add-to-menubar "TOC") t]
-     "-"
-     ["Macro ..." TeX-insert-macro
-      :help "Insert a macro and possibly arguments"]
-     ["Complete" TeX-complete-symbol
-      :help "Complete the current macro or environment name"]
-     ["Show ConTeXt Macro Definition" ConTeXt-etexshow]
-     "-"
-     (,ConTeXt-environment-menu-name)
-     (,ConTeXt-environment-modify-menu-name)
-     ["Item" ConTeXt-insert-item
-      :help "Insert a new \\item into current environment"]
-     (,ConTeXt-define-menu-name)
-     (,ConTeXt-setup-menu-name)
-     (,ConTeXt-other-macro-menu-name)
-     "-"
-     ("Insert Font"
-      ["Emphasize"  (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
-      ["Bold"       (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
-      ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
-      ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
-      ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"]
-      ["Italic"     (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
-      ["Slanted"    (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
-      ["Roman"      (TeX-font nil ?\C-r) :keys "C-c C-f C-r"]
-      ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"])
-     ("Replace Font"
-      ["Emphasize"  (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
-      ["Bold"       (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
-      ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
-      ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
-      ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"]
-      ["Italic"     (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
-      ["Slanted"    (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
-      ["Roman"      (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"]
-      ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"])
-     ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
-     "-"
-     ["Comment or Uncomment Region"
-      comment-or-uncomment-region
-      :help "Make the selected region outcommented or active again"]
-     ["Comment or Uncomment Paragraph"
-      TeX-comment-or-uncomment-paragraph
-      :help "Make the current paragraph outcommented or active again"]
-     ,TeX-fold-menu
-     "-" . ,TeX-common-menu-entries)))
+  `("ConTeXt"
+    (,ConTeXt-project-structure-menu-name)
+    (,ConTeXt-section-block-menu-name)
+    (,ConTeXt-numbered-section-menu-name)
+    (,ConTeXt-unnumbered-section-menu-name)
+    ["Add Table of Contents to Emacs Menu" (imenu-add-to-menubar "TOC") t]
+    "-"
+    ["Macro ..." TeX-insert-macro
+     :help "Insert a macro and possibly arguments"]
+    ["Complete" TeX-complete-symbol
+     :help "Complete the current macro or environment name"]
+    ["Show ConTeXt Macro Definition" ConTeXt-etexshow]
+    "-"
+    (,ConTeXt-environment-menu-name)
+    (,ConTeXt-environment-modify-menu-name)
+    ["Item" ConTeXt-insert-item
+     :help "Insert a new \\item into current environment"]
+    (,ConTeXt-define-menu-name)
+    (,ConTeXt-setup-menu-name)
+    (,ConTeXt-other-macro-menu-name)
+    "-"
+    ("Insert Font"
+     ["Emphasize"  (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
+     ["Bold"       (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
+     ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
+     ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
+     ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"]
+     ["Italic"     (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
+     ["Slanted"    (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
+     ["Roman"      (TeX-font nil ?\C-r) :keys "C-c C-f C-r"]
+     ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"])
+    ("Replace Font"
+     ["Emphasize"  (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
+     ["Bold"       (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
+     ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
+     ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
+     ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"]
+     ["Italic"     (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
+     ["Slanted"    (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
+     ["Roman"      (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"]
+     ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"])
+    ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
+    "-"
+    ["Comment or Uncomment Region"
+     comment-or-uncomment-region
+     :help "Make the selected region outcommented or active again"]
+    ["Comment or Uncomment Paragraph"
+     TeX-comment-or-uncomment-paragraph
+     :help "Make the current paragraph outcommented or active again"]
+    ,TeX-fold-menu
+    "-" . ,TeX-common-menu-entries))
 
 (defun ConTeXt-menu-update (&optional menu)
   "Update entries on AUCTeX menu."
@@ -1783,7 +1782,7 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
   ;; run hooks
   (setq TeX-command-default "ConTeXt")
   (setq TeX-sentinel-default-function 'TeX-ConTeXt-sentinel)
-  (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'ConTeXt-mode-hook))
+  (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'ConTeXt-mode-hook))
 
 (defun context-guess-current-interface ()
   "Guess what ConTeXt interface the current buffer is using."
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 6a37541..6f40d82 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -2,7 +2,7 @@
 
 # Maintainer: address@hidden
 
-# Copyright (C) 2003-2008, 2013-2015 Free Software Foundation, Inc.
+# Copyright (C) 2003-2008, 2013-2015, 2018 Free Software Foundation, Inc.
 
 # This file is part of AUCTeX.
 
@@ -24,7 +24,6 @@
 address@hidden@$(null)
 address@hidden@$(null)
 address@hidden@$(null)
address@hidden@$(null)
 address@hidden@$(null)
 address@hidden@$(null)
 address@hidden@
@@ -76,21 +75,12 @@ dvi: auctex.dvi tex-ref.dvi preview-latex.dvi
 
 install: install-auctex install-preview
 
-install-man:
-       test x$(packagedir) != xno && \
-       { $(MKINSTALLDIRS) $(DESTDIR)$(packagedir)/man/auctex ; \
-       for i in $(AUCTEXTEXIFILES) $(PREVIEWTEXIFILES) tex-ref.tex ; \
-       do echo $(INSTALL_DATA) $$i $(DESTDIR)$(packagedir)/man/auctex; \
-          $(INSTALL_DATA) $$i $(DESTDIR)$(packagedir)/man/auctex; \
-       done ; \
-       }
-
 dist: $(DISTTEXTS) preview-latex.info auctex.info tex-ref.pdf
 
 extradist: html/$(TEXI2HTML_TOC) auctex.ps auctex.pdf tex-ref.ps tex-ref.pdf
 
 .PHONY: all info dvi dist install-auctex disttexts clean distclean \
-       maintainer-clean install-preview install-man uninstall html-docs \
+       maintainer-clean install-preview uninstall html-docs \
        extradist
 
 # AUCTeX
@@ -136,11 +126,9 @@ install-auctex: auctex.info tex-ref.pdf
          fi; \
        done
        -$(INSTALL_INFO)  --info-dir=$(DESTDIR)$(infodir) auctex.info
-       test X$(packagedir) != Xno || { \
-         $(MKINSTALLDIRS) $(DESTDIR)$(docdir); \
-         rm -f $(DESTDIR)$(docdir)/tex-ref.pdf; \
-         $(INSTALL_DATA) tex-ref.pdf $(DESTDIR)$(docdir); \
-       }
+       $(MKINSTALLDIRS) $(DESTDIR)$(docdir)
+       rm -f $(DESTDIR)$(docdir)/tex-ref.pdf
+       $(INSTALL_DATA) tex-ref.pdf $(DESTDIR)$(docdir)
 
 # preview
 
@@ -208,7 +196,7 @@ uninstall:
        done
        rm -f $(DESTDIR)$(infodir)/auctex.info 
$(DESTDIR)$(infodir)/auctex.info-* \
        $(DESTDIR)$(infodir)/preview-latex.info*
-       test X$(packagedir) != Xno || rm -rf -f $(DESTDIR)$(docdir)
+       rm -rf -f $(DESTDIR)$(docdir)
 
 clean:
        rm -f *.dvi *.ps *.pdf *.aux *.cp *.fn *.ky *.log *~ \#*\# \
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 9761ba7..8843fa9 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -519,7 +519,7 @@ immediately adds the corresponding right brace @samp{)}, 
@address@hidden or
 @samp{]}.  The point is left after the opening brace.  If there is an
 active region, braces are put around it.
 
-They recognize the preceeding backslash or size adjusting macros such
+They recognize the preceding backslash or size adjusting macros such
 as @samp{\left}, @samp{\bigl} etc., so the following completions will
 occur:
 @itemize @bullet
@@ -1332,13 +1332,14 @@ Note that for some macros, there are special 
mechanisms, e.g.
 Default macro to insert when invoking @code{TeX-insert-macro} first time.
 @end defopt
 
-A faster alternative is to bind the function @code{TeX-electric-macro}
-to @samp{\}.  This can be done by setting the variable
address@hidden
+A faster alternative is to enable the option
address@hidden
 
 @defopt TeX-electric-escape
-If this is non-nil when @AUCTeX{} is loaded, the @TeX{} escape
-character @samp{\} will be bound to @code{TeX-electric-macro}
+If this is non-nil, typing the @TeX{} escape character @kbd{\} will
+invoke the command @code{TeX-electric-macro}.
+
+In Texinfo mode, the command is invoked by @kbd{@@} instead.
 @end defopt
 
 The difference between @code{TeX-insert-macro} and
@@ -1354,11 +1355,12 @@ Space will complete and exit.
 
 By default @AUCTeX{} will put an empty set braces @address@hidden@}} after a
 macro with no arguments to stop it from eating the next whitespace.
-This can be stopped by entering @code{LaTeX-math-mode},
address@hidden, or by setting @code{TeX-insert-braces} to nil.
+This is suppressed inside math mode and can be disabled totally by
+setting @code{TeX-insert-braces} to nil.
 
 @defopt TeX-insert-braces
-If non-nil, append a empty pair of braces after inserting a macro.
+If non-nil, append a empty pair of braces after inserting a macro with
+no arguments.
 @end defopt
 
 @defopt TeX-insert-braces-alist
@@ -1370,7 +1372,7 @@ the macro name, and the cdr is non-nil or nil, depending 
on whether a
 pair of braces should be, respectively, appended or not to the macro.
 
 If a macro has an element in this variable, @code{TeX-parse-macro} will
-use its value to decided what to do, whatever the value of the variable
+use its value to decide what to do, whatever the value of the variable
 @code{TeX-insert-braces}.
 @end defopt
 
@@ -3645,7 +3647,7 @@ settings that work for some users.
       (lambda ()
        (call-process
         "wmctrl" nil nil nil "-i" "-R"
-        (frame-parameter (selected-frame) ’outer-window-id))))
+        (frame-parameter (selected-frame) 'outer-window-id))))
 @end lisp
 @end defopt
 
@@ -3916,6 +3918,8 @@ process was started.
 @vindex Texinfo-clean-output-suffixes
 @vindex ConTeXt-clean-intermediate-suffixes
 @vindex ConTeXt-clean-output-suffixes
address@hidden AmSTeX-clean-intermediate-suffixes
address@hidden AmSTeX-clean-output-suffixes
 Remove generated intermediate files.  In case a prefix argument is
 given, remove output files as well.
 
@@ -3933,8 +3937,10 @@ for each @AUCTeX{} mode by means of the variables
 @code{docTeX-clean-output-suffixes},
 @code{Texinfo-clean-intermediate-suffixes},
 @code{Texinfo-clean-output-suffixes},
address@hidden and
address@hidden
address@hidden,
address@hidden,
address@hidden and
address@hidden
 @end deffn
 
 @defopt TeX-clean-confirm
@@ -4348,21 +4354,26 @@ typesetting and editing documents in European languages.
 @c -> @abbr{MULE, MULtilingual Enhancement to GNU Emacs}
 @c -> @acronym{CJK, address@hidden address@hidden and Korean}
 
-For @acronym{CJK} (Chinese, Japanese, and Korean) languages, Emacs with
address@hidden (MULtilingual Enhancement to GNU Emacs) support is
-required.  @acronym{MULE} is part of Emacs by default since Emacs 20.
-Special versions of @TeX{} are needed for @acronym{CJK} languages:
address@hidden and address@hidden for Chinese, ASCII address@hidden and NTT 
address@hidden for
-Japanese, address@hidden and address@hidden for Korean.  The @address@hidden
-package is required for supporting multiple @acronym{CJK} scripts within
-a single document.
+All Emacs versions supported by current @AUCTeX{} can handle
address@hidden languages by default.
 
address@hidden characters are not usable.  Please use the
address@hidden@acronym{UCS} EmacsLisp package or Emacs 22 and later if
-you need @acronym{CJK}.
+In most cases, special versions of @TeX{} engines are needed for
+high-quality typesetting of @acronym{CJK} languages: address@hidden and
address@hidden for Chinese, ASCII address@hidden, address@hidden and NTT 
address@hidden for
+Japanese, address@hidden and address@hidden for Korean.  They are necessary as 
well
+when you want to typeset documents saved in their domestic encodings
+such as @acronym{Shift-JIS}.  Currently, @AUCTeX{} offers native support
+for address@hidden, address@hidden and address@hidden only.
 
 @c FIXME: We need more information for CTeX, ChinaTeX, KTeX, and HLaTeX.
 
+If you don't need fine tuning in the result with respect to the
+typesetting rules of their respective national standards, most unicode
+based @TeX{} engines e.g. address@hidden and address@hidden can handle
address@hidden languages by default if they are encoded in
address@hidden  The @address@hidden package is provided for
+supporting @acronym{CJK} scripts in a standard @LaTeX{} document.
+
 @menu
 * European::                    Using @AUCTeX{} with European Languages
 * Japanese::                    Using @AUCTeX{} with Japanese
@@ -4729,12 +4740,14 @@ The following two additional font commands are 
available in
 @item C-c C-f g
 @kindex C-c C-f g
 @cindex @code{\textgt}
-Insert @b{gothic face} font command @address@hidden@address@hidden or
address@hidden@address@hidden@}} depending on the context.
address@hidden @code{\mathgt}
+Insert @b{gothic face} font command @address@hidden@address@hidden or
address@hidden@address@hidden@}} depending on the context.
 
 @item C-c C-f m
 @kindex C-c C-f m
 @cindex @code{\textmc}
address@hidden @code{\mathmc}
 Insert mincho font command @address@hidden@address@hidden or
 @address@hidden@address@hidden depending on the context.
 
@@ -4991,11 +5004,18 @@ A symbol indicating a singleton containing one basic 
@TeX{} dialect,
 this symbol shall be selected among:
 @table @code
 @item :latex
-For all files in @LaTeX{} mode, or any mode derived thereof
+For all files in @LaTeX{} mode, or any mode derived thereof.
 @item :bibtex
-For all files in address@hidden mode, or any mode derived thereof
+For all files in address@hidden mode, or any mode derived thereof.
 @item :texinfo
 For all files in @acronym{Texinfo} mode.
address@hidden :plain-tex
+For all files in address@hidden mode, or any mode derived thereof.
address@hidden :context
+For all files in @ConTeXt{} mode.
address@hidden :classopt
+For class options of @LaTeX{} document.  This is provided as
+pseudo-dialect for style hooks associated with class options.
 @end table
 @item
 A logical expression like:
@@ -5069,7 +5089,7 @@ point inside braces.  Otherwise, each argument of this 
function should
 match an argument of the @TeX{} macro.  What is done depends on the argument
 type.
 
-If a macro is defined multiple times, @AUCTeX{} will chose the one with
+If a macro is defined multiple times, @AUCTeX{} will choose the one with
 the longest definition (i.e. the one with the most arguments).
 
 Thus, to overwrite
@@ -5885,5 +5905,6 @@ used by @AUCTeX{} for sectioning.
 
 @c Local Variables:
 @c mode: texinfo
address@hidden coding: utf-8
 @c TeX-master: t
 @c End:
diff --git a/doc/changes.texi b/doc/changes.texi
index 3e3f417..8475ced 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -40,6 +40,23 @@ no longer works with @previewlatex{}.  We consider this 
incompatibility
 is permissible because address@hidden extension is enabled for standard
 @LaTeX{} by default long ago.  @LaTeX{} variants such as address@hidden and
 address@hidden are not affected.
+
address@hidden
+Key binds in Texinfo mode are improved.  Typing @kbd{$}, @kbd{^},
address@hidden and @kbd{\} now just self-inserts without pointless side effects
+in Texinfo mode.
+
+In addition, the option @code{TeX-electric-escape} is now effective in
+Texinfo mode.  When it is enabled, typing @kbd{@@} will invoke
address@hidden offering completion in similar style with
+other TeX modes of @AUCTeX{}.
+
address@hidden
+Support for column specifiers @samp{w} and @samp{W} provided by
address@hidden package is added to @file{array.el}.  The correct counting
+of columns only works when the @samp{align} parameter is enclosed in
+braces, e.g., @address@hidden@address@hidden@}}.  The short version 
@address@hidden@}}
+is not supported.
 @end itemize
 
 @heading News in 12.1
diff --git a/doc/install.texi b/doc/install.texi
index d45d1d2..1940d9d 100644
--- a/doc/install.texi
+++ b/doc/install.texi
@@ -124,10 +124,10 @@ should work fine (version 7.0 and newer).
 @item GNU make
 
 Recent @AUCTeX{} uses GNU make specific capabilities in the Makefiles.
-If your OS's default @command{make} command is not GNU make, you have to
-obtain it in order to build @AUCTeX{} by yourself.  GNU make is
-sometimes provided under the name @command{gmake} in your OS's binary
-package system.
+If your @acronym{OS}'s default @command{make} command is not GNU make,
+you have to obtain it in order to build @AUCTeX{} by yourself.  GNU make
+is sometimes provided under the name @command{gmake} in your
address@hidden's binary package system.
 
 @item The @code{texinfo} package
 
@@ -178,19 +178,21 @@ binary.
 @file{/usr/local} is the default @var{prefix}, intended to be suitable
 for a site-wide installation.  If you are packaging this as an
 operating system component for distribution, the setting @file{/usr}
-will probably be the right choice.  If you are planning to install the
-package as a single non-priviledged user, you will typically set
address@hidden to your home directory.
+will probably be the right choice.  See @ref{Advice for package
+providers} for detail.
+
+If you are planning to install the package as a single non-priviledged
+user, you will typically set @var{prefix} to your home directory.
+Consult @ref{Advice for non-privileged users} for addtional
+instructions.
 
 @item address@hidden/path/to/emacs}]
 If you are using a pretest which isn't in your @code{$PATH}, or
 @command{configure} is not finding the right Emacs executable, you can
 specify it with this option.
 
-The Emacs installation scheme has the following options:
-
 @item address@hidden/dir}
-This Emacs-only option specifies the location of the @file{site-lisp}
+This option specifies the location of the @file{site-lisp}
 directory within @samp{load-path} under which the files will get
 installed (the bulk will get installed in a subdirectory).
 @file{./configure} should figure this out by itself.
@@ -434,10 +436,32 @@ directory.  In that way, resulting binaries will be 
installed under the
 personal software, since the prefix argument is supported by most
 @file{configure} scripts.
 
+You often need to specify @option{--with-lispdir} option as well.
+If you haven't installed Emacs under your home directory and use Emacs
+installed in system directories, the @file{configure} script might not
+be able to figure out suitable place to install lisp files under your
+home directory.  In that case, the @file{configure} script would
+silently choose, by default, the @file{site-lisp} directory within
address@hidden for the place, where administration privileges are
+usually required to put relevant files.  Thus you will have to tell
+the @file{configure} script explicitly where to put those files by,
+e.g., @address@hidden/home/myself/share/emacs/site-lisp}}.
+
 You'll have to add something like
 @file{/home/myself/share/emacs/site-lisp} to your @code{load-path}
 variable, if it isn't there already.
 
+In addition, you will have to tell @file{configure} script where to
+install @TeX{}-related files such as @file{preview.sty} if
address@hidden isn't disabled.  It is enough to specify
address@hidden@file{$HOME/texmf}} for most typical cases, but
+you have to create the direcotry @file{$HOME/texmf} in advance if it
+doesn't exist.  If this prescription doesn't work, consider using one or
+more of the options @address@hidden/dir}},
address@hidden, @address@hidden/dir}} and
address@hidden@var{/dir}}.  See @ref{Configure} for detail of
+these options.
+
 Now here is another thing to ponder: perhaps you want to make it easy
 for other users to share parts of your personal Emacs configuration.  In
 general, you can do this by writing @samp{~myself/} anywhere where you
diff --git a/doc/preview-latex.texi b/doc/preview-latex.texi
index 2d4941c..67e6de7 100644
--- a/doc/preview-latex.texi
+++ b/doc/preview-latex.texi
@@ -296,7 +296,7 @@ effectively changes because some included file or style 
file is
 tampered with.
 
 Note that support for preamble cache is limited for @LaTeX{} variants.
-c.f. @file{<URL:https://github.com/davidcarlisle/dpctex/issues/15>}
+c.f. @url{https://github.com/davidcarlisle/dpctex/issues/15}
 @itemize @bullet
 @item
 address@hidden cannot use preamble cache at all.  The reason is intrinsic in
diff --git a/doc/wininstall.texi b/doc/wininstall.texi
index f91f0ef..5289ab6 100644
--- a/doc/wininstall.texi
+++ b/doc/wininstall.texi
@@ -320,8 +320,8 @@ You can always use
 in order to customize more stuff, or use the @samp{Customize} menu.
 
 @item
-Load @file{preview/circ.tex} into Emacs and see if you get the
address@hidden menu. Try using it to @LaTeX{} the file.
+Load @file{circ.tex} into Emacs and see if you get the @samp{Command}
+menu. Try using it to @LaTeX{} the file.
 
 @item
 Check whether the @samp{Preview} menu is available in this file.  Use it
diff --git a/font-latex.el b/font-latex.el
index b3ab6f7..bd504a8 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -201,7 +201,6 @@ this variable directly does not take effect unless you call
 Switching from `color' to a number or vice versa does not take
 effect unless you call \\[font-lock-fontify-buffer] or restart
 Emacs."
-  ;; Possibly add some words about XEmacs here. :-(
   :type '(choice (number :tag "Scale factor")
                 (const color))
   :initialize 'custom-initialize-default
@@ -675,7 +674,7 @@ also specify two alternative arguments by prefixing them 
with
 \"*|{\\=\\[[{\".
 
 The face argument can either be an existing face or a face
-attribute.  (The latter option is not available in XEmacs.)
+attribute.
 
 There are three alternatives for the class type:
 
@@ -835,7 +834,6 @@ locking machinery will be triggered."
 
 (defcustom font-latex-fontify-script t
   "If non-nil, fontify subscript and superscript strings.
-This feature does not work in XEmacs.
 
 By default, super/subscripts are raised/lowered if this variable
 is non-nil.  This fontification only affects one level of
@@ -859,7 +857,7 @@ script operators ^ and _ are not displayed."
   :group 'font-latex)
 (put 'font-latex-fontify-script 'safe-local-variable
      (lambda (val)
-       (or (TeX-booleanp val)
+       (or (booleanp val)
           (memq val '(multi-level invisible)))))
 
 (defcustom font-latex-fontify-script-max-level 3
@@ -1385,27 +1383,14 @@ modified.  Such variables include
 `LaTeX-verbatim-environments-local',
 `LaTeX-verbatim-macros-with-braces-local',
 `LaTeX-verbatim-macros-with-delims-local'."
-  (when (if (boundp 'file-local-variables-alist)
-           ;; In Emacs we know if the value came from file or directory
-           ;; locals.  Note to self: directory-local variables are also added
-           ;; to file-local-variables-alist.
-           (let ((hacked-local-vars (mapcar #'car file-local-variables-alist)))
-             (or (memq 'LaTeX-verbatim-environments-local hacked-local-vars)
-                 (memq 'LaTeX-verbatim-macros-with-braces-local 
hacked-local-vars)
-                 (memq 'LaTeX-verbatim-macros-with-delims-local 
hacked-local-vars)))
-         ;; In XEmacs and old Emacs versions we don't know if a buffer-local
-         ;; variable has been set by a file-local variables block or somehow
-         ;; else.  So we trigger a refresh if any of those variables has a
-         ;; non-nil local binding.
-         (or (and LaTeX-verbatim-environments-local
-                  (local-variable-p LaTeX-verbatim-environments-local
-                                    (current-buffer)))
-             (and LaTeX-verbatim-macros-with-braces-local
-                  (local-variable-p LaTeX-verbatim-macros-with-braces-local
-                                    (current-buffer)))
-             (and LaTeX-verbatim-macros-with-delims-local
-                  (local-variable-p LaTeX-verbatim-macros-with-delims-local
-                                    (current-buffer)))))
+  (when
+      ;; In Emacs we know if the value came from file or directory
+      ;; locals.  Note to self: directory-local variables are also added
+      ;; to file-local-variables-alist.
+      (let ((hacked-local-vars (mapcar #'car file-local-variables-alist)))
+       (or (memq 'LaTeX-verbatim-environments-local hacked-local-vars)
+           (memq 'LaTeX-verbatim-macros-with-braces-local hacked-local-vars)
+           (memq 'LaTeX-verbatim-macros-with-delims-local hacked-local-vars)))
     ;; Ok, we need to refresh fontification.
     (font-latex-update-font-lock t)))
 
@@ -1511,8 +1496,7 @@ In docTeX mode \"%\" at the start of a line will be 
treated as whitespace."
 The text property is used to find the start or end of a multiline
 construct when unfontifying a region.  Emacs adds such a text
 property automatically if `font-lock-multiline' is set to t and
-extends the region to be unfontified automatically as well.
-XEmacs does not do this at the time of this writing."
+extends the region to be unfontified automatically as well."
   (unless (boundp 'font-lock-multiline)
     (put-text-property beg end 'font-latex-multiline t)))
 
@@ -2067,8 +2051,7 @@ END marks boundaries for searching for quotation ends."
     ;; `font-lock-apply-highlight' in CVS Emacsen since 2001-10-28.
     ;; With the introduction of this feature the variable
     ;; `font-lock-extra-managed-props' was introduced and serves here
-    ;; for feature checking.  XEmacs (CVS and 21.4.15) currently
-    ;; (2004-08-18) does not support this feature.
+    ;; for feature checking.
     (let ((extra-props-flag (boundp 'font-lock-extra-managed-props)))
       (if (eq (char-after pos) ?_)
          (if extra-props-flag
@@ -2128,26 +2111,14 @@ END marks boundaries for searching for quotation ends."
             ;; syntax-table can't deal with.  We could turn it
             ;; into a non-comment, or use `\n%' or `%^' as the comment.
             ;; Instead, we include it in the ^^A comment.
-            ;; COMPATIBILITY for Emacs 20 and XEmacs
-            (eval-when-compile (if (fboundp 'string-to-syntax)
-                                   (string-to-syntax "< b")
-                                 '(2097163)))
-          ;; COMPATIBILITY for Emacs 20 and XEmacs
-          (eval-when-compile (if (fboundp 'string-to-syntax)
-                                 (string-to-syntax ">")
-                               '(12)))))
+            (eval-when-compile (string-to-syntax "< b"))
+          (eval-when-compile (string-to-syntax ">"))))
        (let ((end (line-end-position)))
          (if (< end (point-max))
              (put-text-property end (1+ end) 'syntax-table
-                                   ;; COMPATIBILITY for Emacs 20 and XEmacs
                                    (eval-when-compile
-                                     (if (fboundp 'string-to-syntax)
-                                         (string-to-syntax "> b")
-                                       '(2097164))))))
-       ;; COMPATIBILITY for Emacs 20 and XEmacs
-       (eval-when-compile (if (fboundp 'string-to-syntax)
-                              (string-to-syntax "< b")
-                            '(2097163))))))
+                                     (string-to-syntax "> b")))))
+       (eval-when-compile (string-to-syntax "< b")))))
 
 ;; Copy and adaptation of `doctex-font-lock-syntactic-face-function'
 ;; in `tex-mode.el' of CVS Emacs (March 2004)
diff --git a/latex.el b/latex.el
index 3315614..d260006 100644
--- a/latex.el
+++ b/latex.el
@@ -1624,7 +1624,7 @@ This is necessary since index entries may contain 
commands and stuff.")
 Split the string at commas and remove Biber file extensions."
   (let ((bibs (TeX-split-string " *, *" (TeX-match-buffer match))))
     (dolist (bib bibs)
-      (LaTeX-add-bibliographies (TeX-replace-regexp-in-string
+      (LaTeX-add-bibliographies (replace-regexp-in-string
                                 (concat "\\(?:\\."
                                         (mapconcat #'identity
                                                    TeX-Biber-file-extensions
@@ -1873,9 +1873,7 @@ The value is actually the tail of the list of options 
given to PACKAGE."
 It will setup BibTeX to store keys in an auto file."
   ;; We want this to be early in the list, so we do not
   ;; add it before we enter BibTeX mode the first time.
-  (if (boundp 'local-write-file-hooks)
-      (add-hook 'local-write-file-hooks 'TeX-safe-auto-write)
-    (add-hook 'write-file-hooks 'TeX-safe-auto-write))
+  (add-hook 'write-file-functions #'TeX-safe-auto-write nil t)
   (TeX-bibtex-set-BibTeX-dialect)
   (set (make-local-variable 'TeX-auto-update) 'BibTeX)
   (set (make-local-variable 'TeX-auto-untabify) nil)
@@ -2234,7 +2232,7 @@ May be reset with `\\[universal-argument] 
\\[TeX-normal-mode]'.")
 
 To insert a hook here, you must insert it in the appropiate style file.")
 
-(defun TeX-arg-document (optional &optional _ignore)
+(defun TeX-arg-document (_optional &optional _ignore)
   "Insert arguments to documentclass.
 OPTIONAL and IGNORE are ignored."
   (let* ((TeX-file-extensions '("cls"))
@@ -2255,7 +2253,7 @@ OPTIONAL and IGNORE are ignored."
                 LaTeX-global-class-files nil nil nil nil LaTeX-default-style))
     ;; Clean up hook before use.
     (setq TeX-after-document-hook nil)
-    (TeX-run-style-hooks style)
+    (TeX-load-style style)
     (setq var (intern (format "LaTeX-%s-class-options" style)))
     (setq defopt (if (stringp LaTeX-default-options)
                     LaTeX-default-options
@@ -2318,7 +2316,7 @@ of the options, nil otherwise."
                    "Packages: " TeX-global-input-files))
     ;; Clean up hook before use in `LaTeX-arg-usepackage-insert'.
     (setq LaTeX-after-usepackage-hook nil)
-    (mapc 'TeX-run-style-hooks packages)
+    (mapc #'TeX-load-style packages)
     ;; Prompt for options only if at least one package has been supplied, 
return
     ;; nil otherwise.
     (when packages
@@ -2361,7 +2359,8 @@ OPTIONAL is ignored."
   (let* ((packages-options (LaTeX-arg-usepackage-read-packages-with-options))
         (packages (car packages-options))
         (options (cdr packages-options)))
-    (LaTeX-arg-usepackage-insert packages options)))
+    (LaTeX-arg-usepackage-insert packages options)
+    (apply #'TeX-run-style-hooks packages)))
 
 (defun LaTeX-insert-usepackages ()
   "Prompt for the insertion of usepackage macros until empty
@@ -2764,9 +2763,8 @@ string."
 (defun TeX-arg-insert-right-brace-maybe (optional)
   "Insert the suitable right brace macro such as \\rangle.
 Insertion is done when `TeX-arg-right-insert-p' is non-nil.
-If the left brace macro is preceeded by \\left, \\bigl etc.,
-supply the corresponding macro such as \\right before the right brace macro.
-OPTIONAL is ignored."
+If the left brace macro is preceded by \\left, \\bigl etc.,
+supply the corresponding macro such as \\right before the right brace macro."
   ;; Nothing is done when TeX-arg-right-insert-p is nil.
   (when TeX-arg-right-insert-p
     (let (left-brace left-macro)
@@ -2776,9 +2774,9 @@ OPTIONAL is ignored."
                          (point)
                          (progn (backward-word) (backward-char)
                                 (point)))
-             ;; Obtain the name of preceeding left macro, if any,
+             ;; Obtain the name of preceding left macro, if any,
              ;; such as "left", "bigl" etc.
-             left-macro (LaTeX-find-preceeding-left-macro-name)))
+             left-macro (LaTeX--find-preceding-left-macro-name)))
       (save-excursion
        (if (TeX-active-mark)
            (goto-char (mark)))
@@ -2817,9 +2815,9 @@ Normally bound to keys \(, { and [."
                ;; Otherwise, don't search for left macros.
                (setq skip-p t)))
          (unless skip-p
-           ;; Obtain the name of preceeding left macro, if any,
+           ;; Obtain the name of preceding left macro, if any,
            ;; such as "left", "bigl" etc.
-           (setq lmacro (LaTeX-find-preceeding-left-macro-name))))
+           (setq lmacro (LaTeX--find-preceding-left-macro-name))))
         (let ((TeX-arg-right-insert-p t)
               ;; "{" and "}" are paired temporally so that typing
              ;; a single "{" should insert a pair "{}".
@@ -2867,9 +2865,9 @@ is nil, consult user which brace should be used."
                        (or rbrace "."))) TeX-left-right-braces
                        nil nil nil nil (or rbrace ".")))))))
 
-(defun LaTeX-find-preceeding-left-macro-name ()
+(defun LaTeX--find-preceding-left-macro-name ()
   "Return the left macro name just before the point, if any.
-If the preceeding macro isn't left macros such as \\left, \\bigl etc.,
+If the preceding macro isn't left macros such as \\left, \\bigl etc.,
 return nil.
 If the point is just after unescaped `TeX-esc', return the null string."
   ;; \left-!- => "left"
@@ -2891,6 +2889,10 @@ If the point is just after unescaped `TeX-esc', return 
the null string."
             (or (string= name "")
                 (assoc name LaTeX-left-right-macros-association)))
        name)))
+(define-obsolete-function-alias
+  'LaTeX-find-preceeding-left-macro-name
+  #'LaTeX--find-preceding-left-macro-name "AUCTeX 12.2"
+  "Compatibility function for typo in its name.")
 
 (defcustom LaTeX-default-author 'user-full-name
   "Initial input to `LaTeX-arg-author' prompt.
@@ -3261,8 +3263,7 @@ Lines starting with an item is given an extra indentation 
of
                 (beginning-of-line)
                 (looking-at
                  (concat "\\([ \t]*" TeX-comment-start-regexp "+\\)+"))
-                (concat (match-string 0) (TeX-comment-padding-string)))))
-        ol-specs)
+                (concat (match-string 0) (TeX-comment-padding-string))))))
     (save-excursion
       (cond ((and fill-prefix
                  (TeX-in-line-comment)
@@ -3290,9 +3291,6 @@ Lines starting with an item is given an extra indentation 
of
             (let ((outer-indent (LaTeX-indent-calculate 'outer)))
               (when (/= (LaTeX-current-indentation 'outer) outer-indent)
                   (LaTeX-indent-outer-do outer-indent))))))
-    ;; Make the overlays invisible again.
-    (dolist (ol-spec ol-specs)
-      (set-extent-property (car ol-spec) 'invisible (cadr ol-spec)))
     (when (< (current-column) (save-excursion
                                (LaTeX-back-to-indentation) (current-column)))
       (LaTeX-back-to-indentation))))
@@ -3776,21 +3774,8 @@ space does not end a sentence, so don't break a line 
there."
          (remove-text-properties from to '(hard nil)))
        ;; Make sure first line is indented (at least) to left margin...
        (indent-according-to-mode)
-       ;; COMPATIBILITY for Emacs <= 21.1
-       (if (fboundp 'fill-delete-prefix)
-           ;; Delete the fill-prefix from every line.
-           (fill-delete-prefix from to fill-prefix)
-         ;; Delete the comment prefix and any whitespace from every
-         ;; line of the region in concern except the first. (The
-         ;; implementation is heuristic to a certain degree.)
-         (save-excursion
-           (goto-char from)
-           (forward-line 1)
-           (when (< (point) to)
-             (while (re-search-forward (concat "^[ \t]+\\|^[ \t]*"
-                                               TeX-comment-start-regexp
-                                               "+[ \t]*") to t)
-               (delete-region (match-beginning 0) (match-end 0))))))
+       ;; Delete the fill-prefix from every line.
+       (fill-delete-prefix from to fill-prefix)
 
        (setq from (point))
 
@@ -5377,9 +5362,11 @@ commands are defined:
   "Insert \\STRING{}.  If DOLLAR is non-nil, put $'s around it.
 If `TeX-electric-math' is non-nil wrap that symbols around the
 string."
-  (if dollar (insert (or (car TeX-electric-math) "$")))
-  (funcall LaTeX-math-insert-function string)
-  (if dollar (insert (or (cdr TeX-electric-math) "$"))))
+  (when dollar
+    (insert (or (car TeX-electric-math) "$"))
+    (save-excursion
+      (insert (or (cdr TeX-electric-math) "$"))))
+  (funcall LaTeX-math-insert-function string))
 
 (defun LaTeX-math-cal (char dollar)
   "Insert a {\\cal CHAR}.  If DOLLAR is non-nil, put $'s around it.
@@ -5641,79 +5628,78 @@ regenerated by the respective menu filter."
 (easy-menu-define LaTeX-mode-menu
   LaTeX-mode-map
   "Menu used in LaTeX mode."
-  (TeX-menu-with-help
-   `("LaTeX"
-     ("Section  (C-c C-s)" :filter LaTeX-section-menu-filter)
-     ["Macro..." TeX-insert-macro
-      :help "Insert a macro and possibly arguments"]
-     ["Complete Macro" TeX-complete-symbol
-      :help "Complete the current macro or environment name"]
-     ,(list LaTeX-environment-menu-name
-           :filter (lambda (ignored) (LaTeX-environment-menu-filter
-                                      LaTeX-environment-menu-name)))
-     ,(list LaTeX-environment-modify-menu-name
-           :filter (lambda (ignored) (LaTeX-environment-menu-filter
-                                      LaTeX-environment-modify-menu-name)))
-     ["Close Environment" LaTeX-close-environment
-      :help "Insert the \\end part of the current environment"]
-     ["Item" LaTeX-insert-item
-      :help "Insert a new \\item into current environment"]
-     "-"
-     ("Insert Font"
-      ["Emphasize"  (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
-      ["Bold"       (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
-      ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
-      ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
-      ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"]
-      ["Italic"     (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
-      ["Slanted"    (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
-      ["Roman"      (TeX-font nil ?\C-r) :keys "C-c C-f C-r"]
-      ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"])
-     ("Replace Font"
-      ["Emphasize"  (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
-      ["Bold"       (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
-      ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
-      ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
-      ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"]
-      ["Italic"     (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
-      ["Slanted"    (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
-      ["Roman"      (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"]
-      ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"])
-     ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
+  `("LaTeX"
+    ("Section  (C-c C-s)" :filter LaTeX-section-menu-filter)
+    ["Macro..." TeX-insert-macro
+     :help "Insert a macro and possibly arguments"]
+    ["Complete Macro" TeX-complete-symbol
+     :help "Complete the current macro or environment name"]
+    ,(list LaTeX-environment-menu-name
+          :filter (lambda (ignored) (LaTeX-environment-menu-filter
+                                     LaTeX-environment-menu-name)))
+    ,(list LaTeX-environment-modify-menu-name
+          :filter (lambda (ignored) (LaTeX-environment-menu-filter
+                                     LaTeX-environment-modify-menu-name)))
+    ["Close Environment" LaTeX-close-environment
+     :help "Insert the \\end part of the current environment"]
+    ["Item" LaTeX-insert-item
+     :help "Insert a new \\item into current environment"]
+    "-"
+    ("Insert Font"
+     ["Emphasize"  (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
+     ["Bold"       (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
+     ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
+     ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
+     ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"]
+     ["Italic"     (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
+     ["Slanted"    (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
+     ["Roman"      (TeX-font nil ?\C-r) :keys "C-c C-f C-r"]
+     ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"])
+    ("Replace Font"
+     ["Emphasize"  (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
+     ["Bold"       (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
+     ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
+     ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
+     ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"]
+     ["Italic"     (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
+     ["Slanted"    (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
+     ["Roman"      (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"]
+     ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"])
+    ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
+    "-"
+    ["Comment or Uncomment Region"
+     comment-or-uncomment-region
+     :help "Make the selected region outcommented or active again"]
+    ["Comment or Uncomment Paragraph"
+     TeX-comment-or-uncomment-paragraph
+     :help "Make the current paragraph outcommented or active again"]
+    ("Formatting and Marking"
+     ["Format Environment" LaTeX-fill-environment
+      :help "Fill and indent the current environment"]
+     ["Format Paragraph" LaTeX-fill-paragraph
+      :help "Fill and ident the current paragraph"]
+     ["Format Region" LaTeX-fill-region
+      :help "Fill and indent the currently selected region"]
+     ["Format Section" LaTeX-fill-section
+      :help "Fill and indent the current section"]
      "-"
-     ["Comment or Uncomment Region"
-      comment-or-uncomment-region
-      :help "Make the selected region outcommented or active again"]
-     ["Comment or Uncomment Paragraph"
-      TeX-comment-or-uncomment-paragraph
-      :help "Make the current paragraph outcommented or active again"]
-     ("Formatting and Marking"
-      ["Format Environment" LaTeX-fill-environment
-       :help "Fill and indent the current environment"]
-      ["Format Paragraph" LaTeX-fill-paragraph
-       :help "Fill and ident the current paragraph"]
-      ["Format Region" LaTeX-fill-region
-       :help "Fill and indent the currently selected region"]
-      ["Format Section" LaTeX-fill-section
-       :help "Fill and indent the current section"]
-      "-"
-      ["Mark Environment" LaTeX-mark-environment
-       :help "Mark the current environment"]
-      ["Mark Section" LaTeX-mark-section
-       :help "Mark the current section"]
-      "-"
-      ["Beginning of Environment" LaTeX-find-matching-begin
-       :help "Move point to the beginning of the current environment"]
-      ["End of Environment" LaTeX-find-matching-end
-       :help "Move point to the end of the current environment"])
-     ,TeX-fold-menu
-     ["Math Mode" LaTeX-math-mode
-      :style toggle :selected LaTeX-math-mode
-      :help "Toggle math mode"]
+     ["Mark Environment" LaTeX-mark-environment
+      :help "Mark the current environment"]
+     ["Mark Section" LaTeX-mark-section
+      :help "Mark the current section"]
      "-"
-      [ "Convert 209 to 2e" LaTeX-209-to-2e
-        :visible (member "latex2" (TeX-style-list)) ]
-      . ,TeX-common-menu-entries)))
+     ["Beginning of Environment" LaTeX-find-matching-begin
+      :help "Move point to the beginning of the current environment"]
+     ["End of Environment" LaTeX-find-matching-end
+      :help "Move point to the end of the current environment"])
+    ,TeX-fold-menu
+    ["Math Mode" LaTeX-math-mode
+     :style toggle :selected LaTeX-math-mode
+     :help "Toggle math mode"]
+    "-"
+    [ "Convert 209 to 2e" LaTeX-209-to-2e
+      :visible (member "latex2" (TeX-style-list)) ]
+    . ,TeX-common-menu-entries))
 
 (defcustom LaTeX-font-list
   '((?\C-a ""              ""  "\\mathcal{"    "}")
@@ -5898,8 +5884,7 @@ This happens when \\left is inserted."
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.hva\\'" . latex-mode))
 
-(when (fboundp 'declare-function)
-  (declare-function LaTeX-preview-setup "preview"))
+(declare-function LaTeX-preview-setup "preview")
 
 ;;;###autoload
 (defun TeX-latex-mode ()
@@ -5929,7 +5914,19 @@ of `LaTeX-mode-hook'."
            (lambda ()
              (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
                  (setq LaTeX-using-Biber LaTeX-biblatex-use-Biber))) nil t)
-  (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook)
+
+  ;; Run style hooks associated with class options.
+  (add-hook 'TeX-update-style-hook
+           (lambda ()
+             (let ((TeX-style-hook-dialect :classopt)
+                   ;; Don't record class option names in
+                   ;; `TeX-active-styles'.
+                   (TeX-active-styles nil))
+               (apply #'TeX-run-style-hooks
+                      (apply #'append
+                             (mapcar #'cdr LaTeX-provided-class-options)))))
+           nil t)
+  (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook)
   (when (fboundp 'LaTeX-preview-setup)
     (LaTeX-preview-setup))
   (TeX-set-mode-name)
@@ -6047,7 +6044,7 @@ function would return non-nil and `(match-string 1)' 
would return
 
   (setq TeX-header-end LaTeX-header-end
        TeX-trailer-start LaTeX-trailer-start)
-  (set (make-local-variable 'TeX-style-hook-dialect) :latex)
+  (set (make-local-variable 'TeX-style-hook-dialect) LaTeX-dialect)
 
   (require 'outline)
   (set (make-local-variable 'outline-level) 'LaTeX-outline-level)
@@ -6446,23 +6443,36 @@ function would return non-nil and `(match-string 1)' 
would return
 
   ;; There must be something better-suited, but I don't understand the
   ;; parsing properly.  -- dak
-  (TeX-add-style-hook "pdftex" 'TeX-PDF-mode-on LaTeX-dialect)
-  (TeX-add-style-hook "pdftricks" 'TeX-PDF-mode-on LaTeX-dialect)
-  (TeX-add-style-hook "pst-pdf" 'TeX-PDF-mode-on LaTeX-dialect)
-  (TeX-add-style-hook "dvips" 'TeX-PDF-mode-off LaTeX-dialect)
+  (TeX-add-style-hook "pdftex" #'TeX-PDF-mode-on :classopt)
+  (TeX-add-style-hook "pdftricks" #'TeX-PDF-mode-on :classopt)
+  (TeX-add-style-hook "pst-pdf" #'TeX-PDF-mode-on :classopt)
+  (TeX-add-style-hook "dvips"
+                     (lambda ()
+                       ;; Leave at user's choice whether to disable
+                       ;; `TeX-PDF-mode' or not.
+                       (setq TeX-PDF-from-DVI "Dvips"))
+                     :classopt)
   ;; This is now done in style/pstricks.el because it prevents other
   ;; pstricks style files from being loaded.
   ;;   (TeX-add-style-hook "pstricks" 'TeX-PDF-mode-off)
-  (TeX-add-style-hook "psfrag" 'TeX-PDF-mode-off LaTeX-dialect)
-  (TeX-add-style-hook "dvipdf" 'TeX-PDF-mode-off LaTeX-dialect)
-  (TeX-add-style-hook "dvipdfm" 'TeX-PDF-mode-off LaTeX-dialect)
+  (TeX-add-style-hook "psfrag" #'TeX-PDF-mode-off :classopt)
+  (TeX-add-style-hook "dvipdf" #'TeX-PDF-mode-off :classopt)
+  (TeX-add-style-hook "dvipdfm" #'TeX-PDF-mode-off :classopt)
+  (TeX-add-style-hook "dvipdfmx"
+                     (lambda ()
+                       (TeX-PDF-mode-on)
+                       ;; XeLaTeX normally don't use dvipdfmx
+                       ;; explicitly.
+                       (unless (eq TeX-engine 'xetex)
+                         (setq TeX-PDF-from-DVI "Dvipdfmx")))
+                     :classopt)
   ;;  (TeX-add-style-hook "DVIoutput" 'TeX-PDF-mode-off)
   ;;
   ;;  Well, DVIoutput indicates that we want to run PDFTeX and expect to
   ;;  get DVI output.  Ugh.
   (TeX-add-style-hook "ifpdf" (lambda ()
                                (TeX-PDF-mode-on)
-                               (TeX-PDF-mode-off)) LaTeX-dialect)
+                               (TeX-PDF-mode-off)) :classopt)
   ;; ifpdf indicates that we cater for either.  So calling both
   ;; functions will make sure that the default will get used unless the
   ;; user overrode it.
@@ -6610,6 +6620,26 @@ function would return non-nil and `(match-string 1)' 
would return
                      (1+ any-col)
                    beg-col))))))))
 
+;; Utilities:
+
+(defmacro LaTeX-check-insert-macro-default-style (&rest body)
+  "Check for values of `TeX-insert-macro-default-style' and 
`current-prefix-arg'.
+This is a utility macro with code taken from
+`TeX-parse-arguments'.  It should be used inside more complex
+function within AUCTeX style files where optional and mandatory
+arguments are queried and inserted.  For examples, check the
+functions `TeX-arg-color' (style/color.el) or
+`LaTeX-arg-bicaption-bicaption' (style/bicaption.el)."
+  `(unless (if (eq TeX-insert-macro-default-style 'show-all-optional-args)
+              (equal current-prefix-arg '(4))
+            (or
+             (and (eq TeX-insert-macro-default-style 'show-optional-args)
+                  (equal current-prefix-arg '(4)))
+             (and (eq TeX-insert-macro-default-style 'mandatory-args-only)
+                  (null (equal current-prefix-arg '(4))))
+             last-optional-rejected))
+     ,@body))
+
 (provide 'latex)
 
 ;;; latex.el ends here
diff --git a/plain-tex.el b/plain-tex.el
index 4c26abf..af1a74d 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -55,40 +55,39 @@ Install tool bar if `plain-TeX-enable-toolbar' is non-nil."
   "Keymap used in plain TeX mode.")
 
 (defvar plain-TeX-menu-entries
-  (TeX-menu-with-help
-   `(["Macro..." TeX-insert-macro
-      :help "Insert a macro and possibly arguments"]
-     ["Complete" TeX-complete-symbol
-      :help "Complete the current macro"]
-     "-"
-     ("Insert Font"
-      ["Emphasize"  (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
-      ["Bold"       (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
-      ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
-      ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
-      ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"]
-      ["Italic"     (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
-      ["Slanted"    (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
-      ["Roman"      (TeX-font nil ?\C-r) :keys "C-c C-f C-r"]
-      ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"])
-     ("Replace Font"
-      ["Emphasize"  (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
-      ["Bold"       (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
-      ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
-      ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
-      ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"]
-      ["Italic"     (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
-      ["Slanted"    (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
-      ["Roman"      (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"]
-      ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"])
-     ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
-     "-"
-     ["Comment or Uncomment Region" comment-or-uncomment-region
-      :help "Comment or uncomment the currently selected region"]
-     ["Comment or Uncomment Paragraph" TeX-comment-or-uncomment-paragraph
-      :help "Comment or uncomment the paragraph containing point"]
-     ,TeX-fold-menu
-     "-" . ,TeX-common-menu-entries)))
+  `(["Macro..." TeX-insert-macro
+     :help "Insert a macro and possibly arguments"]
+    ["Complete" TeX-complete-symbol
+     :help "Complete the current macro"]
+    "-"
+    ("Insert Font"
+     ["Emphasize"  (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
+     ["Bold"       (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
+     ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
+     ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
+     ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"]
+     ["Italic"     (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
+     ["Slanted"    (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
+     ["Roman"      (TeX-font nil ?\C-r) :keys "C-c C-f C-r"]
+     ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"])
+    ("Replace Font"
+     ["Emphasize"  (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
+     ["Bold"       (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
+     ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
+     ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
+     ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"]
+     ["Italic"     (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
+     ["Slanted"    (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
+     ["Roman"      (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"]
+     ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"])
+    ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
+    "-"
+    ["Comment or Uncomment Region" comment-or-uncomment-region
+     :help "Comment or uncomment the currently selected region"]
+    ["Comment or Uncomment Paragraph" TeX-comment-or-uncomment-paragraph
+     :help "Comment or uncomment the paragraph containing point"]
+    ,TeX-fold-menu
+    "-" . ,TeX-common-menu-entries))
 
 (easy-menu-define plain-TeX-mode-command-menu
     plain-TeX-mode-map
@@ -137,11 +136,9 @@ of `plain-TeX-mode-hook'."
   (setq TeX-command-default "TeX")
   (setq TeX-sentinel-default-function 'TeX-TeX-sentinel)
   (add-hook 'tool-bar-mode-on-hook 'plain-TeX-maybe-install-toolbar nil t)
-  (when (if (featurep 'xemacs)
-           (featurep 'toolbar)
-         (and (boundp 'tool-bar-mode) tool-bar-mode))
+  (when (and (boundp 'tool-bar-mode) tool-bar-mode)
     (plain-TeX-maybe-install-toolbar))
-  (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'plain-TeX-mode-hook)
+  (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'plain-TeX-mode-hook)
   (TeX-set-mode-name))
 
 (defun plain-TeX-common-initialization ()
@@ -317,7 +314,7 @@ of `AmS-TeX-mode-hook'."
 
   (setq TeX-base-mode-name "AmS-TeX")
   (setq TeX-command-default "AmSTeX")
-  (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'AmS-TeX-mode-hook)
+  (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'AmS-TeX-mode-hook)
   (TeX-set-mode-name))
 
 (defcustom AmSTeX-clean-intermediate-suffixes
diff --git a/preview.el b/preview.el
index 63c9dee..f10c930 100644
--- a/preview.el
+++ b/preview.el
@@ -343,7 +343,7 @@ LIST consists of TeX dimensions in sp (1/65536 TeX point)."
       (let ((gs (executable-find "mgs")))
        ;; Check if mgs is functional for external non-MikTeX apps.
        ;; See 
http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx
-       (when (and gs (= 0 (shell-command (concat gs " -q -dNODISPLAY -c 
quit"))))
+       (when (and gs (= 0 (shell-command (concat (shell-quote-argument gs) " 
-q -dNODISPLAY -c quit"))))
          gs))
       ;; Windows ghostscript
       (executable-find "GSWIN32C.EXE")
@@ -860,7 +860,7 @@ Pure borderless black-on-white will return an empty string."
       (delete-file
        (let ((gsfile preview-gs-file))
         (with-current-buffer TeX-command-buffer
-          (funcall (car gsfile) "dvi"))))
+          (funcall (car gsfile) "dvi" t))))
     (file-error nil))
   (when preview-ps-file
       (condition-case nil
@@ -884,7 +884,7 @@ The usual PROCESS and COMMAND arguments for
               (condition-case nil
                   (delete-file
                    (with-current-buffer TeX-command-buffer
-                     (funcall (car gsfile) "dvi")))
+                     (funcall (car gsfile) "dvi" t)))
                 (file-error nil))
               (if preview-ps-file
                   (preview-prepare-fast-conversion))
@@ -1933,7 +1933,7 @@ Deletes the dvi file when finished."
          (let ((gsfile preview-gs-file))
            (delete-file
             (with-current-buffer TeX-command-buffer
-              (funcall (car gsfile) "dvi"))))
+              (funcall (car gsfile) "dvi" t))))
        (file-error nil)))))
 
 (defun preview-active-string (ov)
@@ -2037,9 +2037,6 @@ to the close hook."
   "Fetch the next preceding or next preview-counters property.
 Factored out because of compatibility macros XEmacs would
 not use in advice."
-  ;; The following two lines are bug workaround for Emacs < 22.1.
-  (if (markerp begin)
-      (setq begin (marker-position begin)))
   (or (car (get-char-property begin 'preview-counters))
       (cdr (get-char-property (max (point-min)
                                   (1- begin))
@@ -2650,9 +2647,18 @@ Sequences of control characters such as ^^I are left 
untouched.
 Return a new string."
   ;; Since the given string can contain multibyte characters, decoding
   ;; should be performed seperately on each segment made up entirely
-  ;; with ASCII characters.
+  ;; with ASCII and raw 8-bit characters.
+  ;; Raw 8-bit characters can arise if the latex outputs multibyte
+  ;; characters with partial ^^-quoting.
   (let ((result ""))
-    (while (string-match "[\x00-\x7F]+" string)
+    ;; Here we want to collect all the ASCII and raw 8-bit bytes,
+    ;; excluding proper multibyte characters.  The regexp
+    ;; [^[:multibyte:]]+ serves for that purpose.  The alternative
+    ;; [\x00-\xFF]+ does the job as well at least for emacs 24-26, so
+    ;; use it instead if the former becomes invalid in future.
+    ;; N.B. [[:unibyte:]]+ doesn't match raw 8-bit bytes, contrary to
+    ;; naive expectation.
+    (while (string-match "[^[:multibyte:]]+" string)
       (setq result
            (concat result
                    (substring string 0 (match-beginning 0))
@@ -3140,7 +3146,7 @@ If FAST is set, do a fast conversion."
                        (TeX-command-expand preview-pdf2dsc-command
                                            (car file))
                      (setq tempdir TeX-active-tempdir
-                           pdfsource (funcall `,(car file) "pdf")))))
+                           pdfsource (funcall (car file) "pdf" t)))))
         (name "Preview-PDF2DSC"))
     (setq TeX-active-tempdir tempdir)
     (setq preview-ps-file (preview-attach-filename
@@ -3341,7 +3347,7 @@ If FORMAT-CONS is non-nil, a previous format may get 
reused."
       (TeX-save-document master)
       (prog1
          (preview-generate-preview
-          nil (file-name-nondirectory master)
+          nil master
           command)
        (add-hook 'kill-emacs-hook #'preview-cleanout-tempfiles t)
        (setq TeX-sentinel-function
@@ -3390,7 +3396,7 @@ stored in `preview-dumped-alist'."
                            (save-excursion
                              (goto-char begin)
                              (if (bolp) 0 -1))))))
-  (preview-generate-preview t (TeX-region-file nil t)
+  (preview-generate-preview t (TeX-region-file)
                            (preview-do-replacements
                             (TeX-command-expand
                              (preview-string-expand preview-LaTeX-command)
@@ -3430,7 +3436,7 @@ stored in `preview-dumped-alist'."
   (interactive)
   (TeX-save-document (TeX-master-file))
   (preview-generate-preview
-   nil (TeX-master-file nil t)
+   nil (TeX-master-file)
    (preview-do-replacements
     (TeX-command-expand
      (preview-string-expand preview-LaTeX-command)
@@ -3470,7 +3476,7 @@ environments is selected."
 (defun preview-generate-preview (region-p file command)
   "Generate a preview.
 REGION-P is the region flag, FILE the file (without default
-extension and directory), COMMAND is the command to use.
+extension), COMMAND is the command to use.
 
 It returns the started process."
   (setq TeX-current-process-region-p region-p)
@@ -3480,7 +3486,7 @@ It returns the started process."
                   (if TeX-current-process-region-p
                       'TeX-region-file
                     'TeX-master-file)
-                  file))
+                  (file-name-nondirectory file)))
         (master (TeX-master-file))
         (master-file (expand-file-name master))
         (dumped-cons (assoc master-file
diff --git a/prv-install.el b/prv-install.el
deleted file mode 100644
index 158be5a..0000000
--- a/prv-install.el
+++ /dev/null
@@ -1,114 +0,0 @@
-;;; prv-install.el --- Complicated install-time magic for preview-latex.
-
-;; Copyright (C) 2002, 2005, 2014  Free Software Foundation, Inc.
-
-;; Author: David Kastrup
-;; Keywords: convenience, tex, wp
-
-;; 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 contains package-building stuff and other install-time magic.
-;; It may well contain Emacs-version-specific code, but certain
-;; functions here should be *callable* from any Emacs version.
-
-;;; Code:
-
-(defun preview-make-package ()
-  "Do anything required to make a package in this version of Emacs,
-other than actually copying the Lisp files.
-
-Takes arguments on the comamnd line: the package directory and any
-number of Lisp files to generate autoloads from.
-
-Does nothing in Emacsen that do not support a package system."
-  (if (featurep 'xemacs)
-      (preview-make-package-xemacs))
-  (setq command-line-args-left nil))
-
-(defun preview-make-package-xemacs ()
-  "Do anything required to make a package in XEmacs,
-other than actually copying the Lisp files.
-
-Generates auto-autoloads, custom-loads, and package metadata file
-in the right locations.  Takes from the command line the package directory,
-package name, and version (to be evaluated), followed by a file to append."
-  (let* ((package-dir (pop command-line-args-left))
-        (package-name (pop command-line-args-left))
-        (release-version (eval (read (pop command-line-args-left))))
-        (author-version (eval (read (pop command-line-args-left))))
-        append-file
-         (lisp-dir (expand-file-name (format "lisp/%s/" package-name)
-                                    package-dir))
-         (metadata (expand-file-name "_pkg.el" lisp-dir))
-         (custom-load (expand-file-name "custom-load.el" lisp-dir))
-         (generated-autoload-file (expand-file-name "auto-autoloads.el"
-                                                    lisp-dir))
-         (si:message (symbol-function 'message))
-        make-backup-files noninteractive)
-    ;; Delete and regenerate the custom-load file.
-    (when (file-exists-p custom-load)
-      (delete-file custom-load))
-    (when (file-exists-p (concat custom-load "c"))
-      (delete-file (concat custom-load "c")))
-    (Custom-make-dependencies lisp-dir)
-    (when (file-exists-p custom-load)
-      (require 'cus-load)
-      (byte-compile-file custom-load))
-    ; Delete and regenerate the package metadata file.
-    ; There is no compiled form of this file.
-    (message "Updating metadata for the directory %s..." lisp-dir)
-    (with-temp-file metadata
-      (insert
-       (concat ";;;###autoload\n"
-               "(package-provide '" package-name "\n"
-               "                 :version "
-              release-version "\n"
-              "                 :author-version "
-              "\"" author-version "\"\n"
-               "                 :type 'regular)\n")))
-    ; Delete and regenerate the auto-autoloads file.
-    (message "Updating autoloads for the directory %s..." lisp-dir)
-    (when (file-exists-p generated-autoload-file)
-      (delete-file generated-autoload-file))
-    (when (file-exists-p (concat generated-autoload-file "c"))
-      (delete-file (concat generated-autoload-file "c")))
-    (defun message (fmt &rest args)
-      "Ignore useless messages while generating autoloads."
-      (cond ((and (string-equal "Generating autoloads for %s..." fmt)
-                  (file-exists-p (file-name-nondirectory (car args))))
-             (funcall si:message
-                      fmt (file-name-nondirectory (car args))))
-            ((string-equal "No autoloads found in %s" fmt))
-            ((string-equal "Generating autoloads for %s...done" fmt))
-            (t (apply si:message fmt args))))
-    (unwind-protect
-       (cond ((fboundp 'update-autoloads-from-directory)
-              (update-autoloads-from-directory lisp-dir))
-             ((fboundp 'update-autoload-files)
-              (update-autoload-files (list lisp-dir) "auctex"))
-             (t (error "Failed to generate autoloads.")))
-      (fset 'message si:message))
-    (while (setq append-file (pop command-line-args-left))
-      (when (file-exists-p generated-autoload-file)
-       (with-temp-buffer (insert-file-contents append-file)
-                         (append-to-file (point-min) (point-max)
-                                         generated-autoload-file))))
-    (byte-compile-file generated-autoload-file)))
-
-
-;;; prv-install.el ends here
diff --git a/style/Alegreya.el b/style/Alegreya.el
index af95423..5459a01 100644
--- a/style/Alegreya.el
+++ b/style/Alegreya.el
@@ -1,6 +1,6 @@
 ;;; Alegreya.el --- AUCTeX style for `Alegreya.sty' (v2015/10/22)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "Alegreya"
  (lambda ()
diff --git a/style/AlegreyaSans.el b/style/AlegreyaSans.el
index a2e7ed1..eeaec06 100644
--- a/style/AlegreyaSans.el
+++ b/style/AlegreyaSans.el
@@ -1,6 +1,6 @@
 ;;; AlegreyaSans.el --- AUCTeX style for `AlegreyaSans.sty' (v2015/10/22)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "AlegreyaSans"
  (lambda ()
diff --git a/style/FiraMono.el b/style/FiraMono.el
index d152087..febcbea 100644
--- a/style/FiraMono.el
+++ b/style/FiraMono.el
@@ -1,6 +1,6 @@
 ;;; FiraMono.el --- AUCTeX style for `FiraMono.sty' (v2016/02/13)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "FiraMono"
  (lambda ()
diff --git a/style/FiraSans.el b/style/FiraSans.el
index 0cd7a14..d9bb41d 100644
--- a/style/FiraSans.el
+++ b/style/FiraSans.el
@@ -1,6 +1,6 @@
 ;;; FiraSans.el --- AUCTeX style for `FiraSans.sty' (v2016/11/20)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "FiraSans"
  (lambda ()
diff --git a/style/MinionPro.el b/style/MinionPro.el
index 75dc931..11a461b 100644
--- a/style/MinionPro.el
+++ b/style/MinionPro.el
@@ -1,6 +1,6 @@
 ;;; MinionPro.el -- AUCTeX style for MinionPro.sty
 
-;; Copyright (C) 2005, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mark Trettin <address@hidden>
 ;; Maintainer: address@hidden
@@ -32,6 +32,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "MinionPro"
  (lambda ()
diff --git a/style/MyriadPro.el b/style/MyriadPro.el
index 8e16e4a..215aa7d 100644
--- a/style/MyriadPro.el
+++ b/style/MyriadPro.el
@@ -1,6 +1,6 @@
 ;;; MyriadPro.el --- AUCTeX style for `MyriadPro.sty' (v0.5)
 
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -33,6 +33,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "MyriadPro"
  (lambda ()
diff --git a/style/XCharter.el b/style/XCharter.el
index d1e71a9..50f1ed0 100644
--- a/style/XCharter.el
+++ b/style/XCharter.el
@@ -1,6 +1,6 @@
 ;;; XCharter.el --- AUCTeX style for `XCharter.sty' (v1.094)
 
-;; Copyright (C) 2014, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2017, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "XCharter"
  (lambda ()
diff --git a/style/acro.el b/style/acro.el
index 66781c9..caa4899 100644
--- a/style/acro.el
+++ b/style/acro.el
@@ -1,6 +1,6 @@
 ;;; acro.el --- AUCTeX style for `acro.sty' version 1.2a.
 
-;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2015, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -31,6 +31,11 @@
 
 (require 'tex) ;Indispensable when compiling the call to `TeX-auto-add-type'.
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-acro-package-options-list
   '(;; General Options
     ("version" ("0" "1"))
diff --git a/style/acronym.el b/style/acronym.el
index 648f4cf..368c35e 100644
--- a/style/acronym.el
+++ b/style/acronym.el
@@ -1,6 +1,6 @@
 ;;; acronym.el --- AUCTeX style for `acronym.sty' version 1.38.
 
-;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2015, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -31,6 +31,11 @@
 
 (require 'tex) ;Indispensable when compiling the call to `TeX-auto-add-type'.
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-auto-add-type "acronym" "LaTeX")
 
 ;; Self Parsing -- see (info "(auctex)Hacking the Parser").
diff --git a/style/alltt.el b/style/alltt.el
index ed64ac4..8ca0acc 100644
--- a/style/alltt.el
+++ b/style/alltt.el
@@ -1,6 +1,6 @@
 ;;; alltt.el --- AUCTeX style for `alltt.sty'
 
-;; Copyright (C) 2004, 2005, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2014, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
 (TeX-add-style-hook
  "alltt"
  (lambda ()
diff --git a/style/alphanum.el b/style/alphanum.el
index d680aac..6bd5a5e 100644
--- a/style/alphanum.el
+++ b/style/alphanum.el
@@ -1,6 +1,6 @@
 ;;; alphanum.el --- AUCTeX style for `alphanum.sty'
 
-;; Copyright (C) 2004 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2018 Free Software Foundation, Inc.
 
 ;; Author: Frank KĂ¼ster <address@hidden>
 ;; Maintainer: address@hidden
@@ -34,6 +34,9 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function reftex-match-string "reftex" (n))
+(defvar reftex-section-regexp)
 
 (defun TeX-arg-none (arg)
   (insert " "))
diff --git a/style/amsfonts.el b/style/amsfonts.el
index ba15ace..e7328ab 100644
--- a/style/amsfonts.el
+++ b/style/amsfonts.el
@@ -1,6 +1,6 @@
 ;;; amsfonts.el --- AUCTeX style for `amsfonts.sty' version 3.01
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "amsfonts"
  (lambda ()
diff --git a/style/amsthm.el b/style/amsthm.el
index a8cd995..d04c4c2 100644
--- a/style/amsthm.el
+++ b/style/amsthm.el
@@ -1,6 +1,6 @@
 ;;; amsthm.el --- Style hook for the AMS-LaTeX amsthm package.
 
-;; Copyright (C) 1997, 2013--2015 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2013--2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-amsthm-package-options nil
   "Package options for the amsthm package.")
 
diff --git a/style/arabxetex.el b/style/arabxetex.el
index cdd8a64..fefd63e 100644
--- a/style/arabxetex.el
+++ b/style/arabxetex.el
@@ -1,6 +1,6 @@
 ;;; arabxetex.el --- AUCTeX style for `arabxetex.sty' (v1.2.1)
 
-;; Copyright (C) 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "arabxetex"
  (lambda ()
diff --git a/style/array.el b/style/array.el
index 721e9de..d6df2eb 100644
--- a/style/array.el
+++ b/style/array.el
@@ -1,6 +1,6 @@
 ;;; array.el --- AUCTeX style for `array.sty'
 
-;; Copyright (C) 2013, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2015, 2018, 2019 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-auto-add-type "array-newcolumntype" "LaTeX")
 
 (defvar LaTeX-array-newcolumntype-regexp
@@ -57,7 +62,7 @@ and make it buffer local. "
                  (TeX-delete-duplicate-strings
                   (split-string
                    (concat LaTeX-array-column-letters
-                           (mapconcat 'car (LaTeX-array-newcolumntype-list) 
""))
+                           (mapconcat #'car (LaTeX-array-newcolumntype-list) 
""))
                    "" t))
                  "")))
 
@@ -90,7 +95,7 @@ and make it buffer local. "
 
    ;; `array.sty' adds some new column specification letters.
    (set (make-local-variable 'LaTeX-array-column-letters)
-       (concat LaTeX-array-column-letters "m" "b"))
+       (concat LaTeX-array-column-letters "m" "b" "w" "W"))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
diff --git a/style/attachfile.el b/style/attachfile.el
index c720ea1..a51cdf2 100644
--- a/style/attachfile.el
+++ b/style/attachfile.el
@@ -1,6 +1,6 @@
 ;;; attachfile.el --- AUCTeX style for `attachfile.sty' (v1.6)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,12 @@
 ;; `attachfile.sty' is part of TeXLive.
 
 ;;; Code:
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-attachfile-key-val-options
   '(("appearance" ("true" "false"))
     ("author")
diff --git a/style/babel.el b/style/babel.el
index 8f4fce4..52ee8ee 100644
--- a/style/babel.el
+++ b/style/babel.el
@@ -1,6 +1,6 @@
 ;;; babel.el --- AUCTeX style for `babel.sty' version 3.9h.
 
-;; Copyright (C) 2005, 2007, 2013-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007, 2013-2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -33,6 +33,11 @@
 (eval-when-compile
   (require 'cl-lib))
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-babel-language-list
   '("afrikaans"
     "bahasa" "indonesian" "indon" "bahasai" "bahasam" "malay" "meyalu"
diff --git a/style/baskervaldx.el b/style/baskervaldx.el
index f793e02..16b4a5c 100644
--- a/style/baskervaldx.el
+++ b/style/baskervaldx.el
@@ -1,6 +1,6 @@
 ;;; baskervaldx.el --- AUCTeX style for `baskervaldx.sty' (v1.07)
 
-;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "baskervaldx"
  (lambda ()
diff --git a/style/beamer.el b/style/beamer.el
index 6cd8327..fb69fc4 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -1,6 +1,6 @@
 ;;; beamer.el --- AUCTeX style for the latex-beamer class
 
-;; Copyright (C) 2003, 2004, 2005, 2008, 2013-2016 Free Software Foundation
+;; Copyright (C) 2003, 2004, 2005, 2008, 2013-2016, 2018 Free Software 
Foundation
 
 ;; Author: Thomas Baumann <address@hidden>
 ;; Created: 2003-12-20
@@ -29,6 +29,15 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
 (defun LaTeX-beamer-after-insert-env (env start _end)
   "Do beamer-specific stuff after the insertion of an environment."
   ;; Add `fragile' as an optional argument to the frame environment if
@@ -79,8 +88,8 @@
    (LaTeX-paragraph-commands-add-locally "frametitle")
 
    (TeX-add-symbols
-    '("alert" 1)
-    '("alt" TeX-arg-beamer-overlay-spec 2)
+    '("alert" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("alt" [ TeX-arg-beamer-overlay-spec ] 2)
     '("beamerbutton" 1)
     '("beamergotobutton" 1)
     '("beamerreturnbutton" 1)
@@ -88,41 +97,41 @@
     '("frame" TeX-arg-beamer-frametitle)
     '("frametitle"
       (TeX-arg-eval TeX-read-string "Title: " nil 
'LaTeX-beamer-frametitle-history))
-    '("hyperlink" TeX-arg-beamer-overlay-spec 2)
-    '("hyperlinkslideprev" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkslidenext" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkframestart" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkframeend" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkframestartnext" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkframeendprev" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkpresentationstart" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkpresentationend" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkappendixstart" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkappendixend" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkdocumentstart" TeX-arg-beamer-overlay-spec 1)
-    '("hyperlinkdocumentend" TeX-arg-beamer-overlay-spec 1)
-    '("hypertarget" TeX-arg-beamer-overlay-spec 2)
+    '("hyperlink" [ TeX-arg-beamer-overlay-spec ] 2)
+    '("hyperlinkslideprev" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkslidenext" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkframestart" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkframeend" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkframestartnext" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkframeendprev" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkpresentationstart" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkpresentationend" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkappendixstart" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkappendixend" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkdocumentstart" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hyperlinkdocumentend" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("hypertarget" [ TeX-arg-beamer-overlay-spec ] 2)
     '("institute" 1)
-    '("invisible" TeX-arg-beamer-overlay-spec 1)
-    '("label" TeX-arg-beamer-overlay-spec 1)
+    '("invisible" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("label" [ TeX-arg-beamer-overlay-spec ] 1)
     '("logo" 1)
     '("note" TeX-arg-beamer-note 1)
-    '("only" TeX-arg-beamer-overlay-spec 1)
-    '("onslide" TeX-arg-beamer-overlay-spec)
+    '("only" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("onslide" [ TeX-arg-beamer-overlay-spec ])
     '("partpage")
     '("pause" ["Slide number"])
-    '("structure" TeX-arg-beamer-overlay-spec 1)
-    '("temporal" TeX-arg-beamer-overlay-spec 3)
+    '("structure" [ TeX-arg-beamer-overlay-spec ] 1)
+    '("temporal" [ TeX-arg-beamer-overlay-spec ] 3)
     '("titlepage")
     '("titlegraphic" 1)
-    '("uncover" TeX-arg-beamer-overlay-spec 1)
+    '("uncover" [ TeX-arg-beamer-overlay-spec ] 1)
     '("usetheme" LaTeX-arg-beamer-theme)
     '("useinnertheme" LaTeX-arg-beamer-inner-theme)
     '("useoutertheme" LaTeX-arg-beamer-outer-theme)
     '("usecolortheme" LaTeX-arg-beamer-color-theme)
     '("usefonttheme" LaTeX-arg-beamer-font-theme)
     '("usetheme" LaTeX-arg-beamer-theme)
-    '("visible" TeX-arg-beamer-overlay-spec 1))
+    '("visible" [ TeX-arg-beamer-overlay-spec ] 1))
 
    (LaTeX-add-environments
     '("actionenv")
@@ -184,11 +193,17 @@
      (font-latex-update-font-lock t)))
  LaTeX-dialect)
 
-(defun TeX-arg-beamer-overlay-spec (_optional &optional _prompt)
-  "Prompt for overlay specification."
-  (let ((overlay (TeX-read-string "(Optional) Overlay: ")))
-    (unless (zerop (length overlay))
-      (insert "<" overlay ">"))
+(defun TeX-arg-beamer-overlay-spec (optional &optional prompt)
+  "Prompt for overlay specification.
+If OPTIONAL is non-nil, insert the specification only if
+non-empty and enclosed in \"<>\".  PROMPT replaces the standard
+one."
+  (let ((TeX-arg-opening-brace "<")
+        (TeX-arg-closing-brace ">"))
+    (TeX-argument-insert
+     (TeX-read-string
+      (TeX-argument-prompt optional prompt "Overlay"))
+     optional)
     (indent-according-to-mode)))
 
 (defun TeX-arg-beamer-frametitle (_optional &optional _prompt)
diff --git a/style/biblatex.el b/style/biblatex.el
index 4c47295..f38fee5 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -1,6 +1,6 @@
 ;;; biblatex.el --- AUCTeX style for `biblatex.sty' version 2.8a.
 
-;; Copyright (C) 2012-2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2014, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,13 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defvar reftex-cite-format-builtin)
+
 (defvar LaTeX-biblatex-entrytype
   '(;; Regular Types
     "article" "book" "mvbook" "inbook" "bookinbook" "suppbook" "booklet"
diff --git a/style/bicaption.el b/style/bicaption.el
index 47b139b..5dc4063 100644
--- a/style/bicaption.el
+++ b/style/bicaption.el
@@ -1,6 +1,6 @@
 ;;; bicaption.el --- AUCTeX style for `bicaption.sty' (v1.1-158)
 
-;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -34,6 +34,20 @@
 
 ;;; Code:
 
+(eval-when-compile
+  (require 'latex))
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function LaTeX-babel-active-languages "babel" ())
+(declare-function LaTeX-polyglossia-active-languages "polyglossia" ())
+
+(defvar LaTeX-caption-supported-float-types)
+(defvar LaTeX-caption-key-val-options)
+
 (defvar LaTeX-bicaption-key-val-options
   '(("bi-lang" ("first" "second" "both"))
     ("bi-singlelinecheck" ("false" "no" "off" "0" "true" "yes" "on" "1"))
@@ -50,6 +64,9 @@ If CAP-BOX is non-nil, also query and include optional 
arguments
 for the box command.  If LABEL-INSIDE is non-nil, insert \\label
 inside the first mandatory argument, otherwise after all
 arguments."
+  ;; \bicaption   [<list entry #1>]{<heading #1>}[<list entry #2>]{<heading 
#2>}
+  ;; \bicaptionbox[<list entry #1>]{<heading #1>}[<list entry #2>]{<heading 
#2>}
+  ;;              [<width>][<inner-pos>]{<contents>}
   (let* (;; \bisubcaption needs an environment, "minipage" will be
         ;; popular.  If so, check next higher environment to find out
         ;; where we are
@@ -100,15 +117,19 @@ arguments."
     (when cap-box
       (let* ((TeX-arg-opening-brace "[")
             (TeX-arg-closing-brace "]")
-            (width (completing-read (TeX-argument-prompt t nil "Width")
-                                    (mapcar (lambda (elt) (concat TeX-esc (car 
elt)))
-                                            (LaTeX-length-list))))
-            (inpos (if (and width (not (string-equal width "")))
-                       (completing-read (TeX-argument-prompt t nil "Inner 
position")
-                                        '("c" "l" "r" "s"))
-                     "")))
-       (TeX-argument-insert width t)
-       (TeX-argument-insert inpos t)))
+            (last-optional-rejected nil)
+            (width (LaTeX-check-insert-macro-default-style
+                    (completing-read (TeX-argument-prompt t nil "Width")
+                                     (mapcar (lambda (elt) (concat TeX-esc 
(car elt)))
+                                             (LaTeX-length-list)))))
+            (last-optional-rejected (and width (string= width "")))
+            (inpos (LaTeX-check-insert-macro-default-style
+                    (if (and width (not (string-equal width "")))
+                        (completing-read (TeX-argument-prompt t nil "Inner 
position")
+                                         '("c" "l" "r" "s"))
+                      ""))))
+       (and width (TeX-argument-insert width t))
+       (and inpos (TeX-argument-insert inpos t))))
     (LaTeX-fill-paragraph)
     ;; Insert label -- a new line is inserted only if label is there:
     (when (and (not label-inside) (not star)
diff --git a/style/bidi.el b/style/bidi.el
index 1e4fd6e..c000535 100644
--- a/style/bidi.el
+++ b/style/bidi.el
@@ -1,6 +1,6 @@
 ;;; bidi.el --- AUCTeX style for the (XeLaTeX) bidi package
 
-;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2018 Free Software Foundation, Inc.
 
 ;; Author: Uwe Brauer <address@hidden>
 ;; Created: 2016-03-06
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-bidi-package-options
   '("RTLdocument" "rldocument" "extrafootnotefeatures")
   "Package options for the bidi package.")
diff --git a/style/bm.el b/style/bm.el
index d735e62..9e7dc6d 100644
--- a/style/bm.el
+++ b/style/bm.el
@@ -1,6 +1,6 @@
 ;;; bm.el --- AUCTeX style for `bm.sty'.
 
-;; Copyright (C) 2012 Free Software Foundation, Inc.
+;; Copyright (C) 2012, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook "bm"
  (lambda ()
    (TeX-add-symbols
diff --git a/style/booktabs.el b/style/booktabs.el
index 20145af..5a58b28 100644
--- a/style/booktabs.el
+++ b/style/booktabs.el
@@ -1,6 +1,6 @@
 ;;; booktabs.el -- AUCTeX style for booktabs.sty
 
-;; Copyright (C) 2003, 2004, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004, 2013, 2018 Free Software Foundation, Inc.
 
 ;; Author:   Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defun LaTeX-booktabs-arg-paren (optional prompt)
   "Prompt for a value and use parentheses when it is inserted.
 If OPTIONAL is non-nil the parameter is labeled as optional.
diff --git a/style/breqn.el b/style/breqn.el
index 03fee3b..63821f2 100644
--- a/style/breqn.el
+++ b/style/breqn.el
@@ -48,6 +48,10 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function LaTeX-color-definecolor-list "color" ())
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+
 (defvar LaTeX-breqn-key-val-options
   '(("style" ("\\tiny" "\\scriptsize" "\\footnotesize" "\\small"
              "\\normalsize" "\\large" "\\Large" "\\LARGE"
diff --git a/style/bulgarian.el b/style/bulgarian.el
index 1f4103c..4280ab6 100644
--- a/style/bulgarian.el
+++ b/style/bulgarian.el
@@ -1,6 +1,6 @@
 ;;; bulgarian.el --- AUCTeX style for the `bulgarian' babel option.
 
-;; Copyright (C) 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
 (defvar LaTeX-bulgarian-mode-syntax-table
   (copy-syntax-table LaTeX-mode-syntax-table)
   "Syntax table used in LaTeX mode when using `bulgarian.sty'.")
diff --git a/style/captcont.el b/style/captcont.el
index b2f4b5f..d19b0c9 100644
--- a/style/captcont.el
+++ b/style/captcont.el
@@ -1,6 +1,6 @@
 ;; captcont.el --- AUCTeX style file for captcont.sty
 
-;; Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2005, 2018 Free Software Foundation, Inc.
 
 ;; Author: Reiner Steib <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "captcont"
  (lambda ()
diff --git a/style/caption.el b/style/caption.el
index f23e59d..c38c1fa 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -1,6 +1,6 @@
 ;;; caption.el --- AUCTeX style for `caption.sty' (v3.3-111)
 
-;; Copyright (C) 2015--2017 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -35,11 +35,22 @@
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl-lib))
+  (require 'cl-lib)
+  (require 'latex))
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function LaTeX-babel-active-languages "babel" ())
+(declare-function LaTeX-polyglossia-active-languages "polyglossia" ())
+
+(defvar LaTeX-bicaption-key-val-options)
+
 (defvar LaTeX-caption-key-val-options
   '(("aboveskip")
     ("belowskip")
@@ -176,10 +187,10 @@ in `caption'-completions."
              (when (and (string-equal key "labelformat")
                         (boundp 'LaTeX-subcaption-key-val-options))
                (cl-pushnew (list "subrefformat"
-                                 (TeX-delete-duplicate-strings (apply #'append 
(list val) val-match)))
+                                 (TeX-delete-duplicate-strings (apply #'append 
(list val) val-match)))
                            opts :test #'equal))
              (cl-pushnew (list key (TeX-delete-duplicate-strings (apply 
#'append (list val) val-match)))
-                         opts :test #'equal))
+                         opts :test #'equal))
          (cl-pushnew (list key (list val)) opts :test #'equal)))
       (setq LaTeX-caption-key-val-options-local (copy-alist opts))))
   ;; Support for environments defined with newfloat.sty: These
@@ -255,15 +266,19 @@ caption, insert only a caption."
     (insert TeX-grcl))
   (let* ((TeX-arg-opening-brace "[")
         (TeX-arg-closing-brace "]")
-        (width (completing-read (TeX-argument-prompt t nil "Width")
-                                (mapcar (lambda (elt) (concat TeX-esc (car 
elt)))
-                                        (LaTeX-length-list))))
-        (inpos (if (and width (not (string-equal width "")))
-                   (completing-read (TeX-argument-prompt t nil "Inner 
position")
-                                    '("c" "l" "r" "s"))
-                 "")))
-    (TeX-argument-insert width t)
-    (TeX-argument-insert inpos t))
+        (last-optional-rejected nil)
+        (width (LaTeX-check-insert-macro-default-style
+                (completing-read (TeX-argument-prompt t nil "Width")
+                                 (mapcar (lambda (elt) (concat TeX-esc (car 
elt)))
+                                         (LaTeX-length-list)))))
+        (last-optional-rejected (and width (string= width "")))
+        (inpos (LaTeX-check-insert-macro-default-style
+                (if (and width (not (string-equal width "")))
+                    (completing-read (TeX-argument-prompt t nil "Inner 
position")
+                                     '("c" "l" "r" "s"))
+                  ""))))
+    (and width (TeX-argument-insert width t))
+    (and inpos (TeX-argument-insert inpos t)))
   ;; Fill the paragraph before inserting {}.  We can use
   ;; `LaTeX-fill-paragraph' without messing up the code since
   ;; \caption starts a new paragraph with AUCTeX
diff --git a/style/cleveref.el b/style/cleveref.el
index 3150180..2774dcb 100644
--- a/style/cleveref.el
+++ b/style/cleveref.el
@@ -1,6 +1,6 @@
 ;;; cleveref.el --- Style hook for the `cleveref.sty' package.
 
-;; Copyright (C) 2014--2016 Free Software Foundation, Inc.
+;; Copyright (C) 2014--2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Matthew Leach <address@hidden>
 ;; Maintainer: address@hidden
@@ -25,6 +25,11 @@
 
 ;;; Code
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defun TeX-arg-cleveref-multiple-labels (optional &optional prompt)
   "Prompt for a series of labels completing with known labels.
 If OPTIONAL is non-nil, insert the resulting value as an optional
diff --git a/style/color.el b/style/color.el
index 0a9c74a..30e575e 100644
--- a/style/color.el
+++ b/style/color.el
@@ -1,6 +1,6 @@
 ;;; color.el --- AUCTeX style for `color.sty' (v1.1a)
 
-;; Copyright (C) 2015--2017 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -34,6 +34,14 @@
 
 ;;; Code:
 
+(eval-when-compile
+  (require 'latex))
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-color-colour-models
   '("cmyk" "gray" "named" "rgb")
   "List of color models provided by `color.sty'.")
@@ -118,111 +126,124 @@
 
 (defun TeX-arg-color (optional &optional prompt)
   "Insert arguments of various color commands from `color.sty'."
-  ;; \color{<name>} or \color[<model>]{<color spec>}
-  ;; First, ask for <model>.  `named' is removed here from completion
-  ;; if package option is not given
-  (let ((model (completing-read
-               (TeX-argument-prompt t prompt "Color model")
-               (if (not (or (LaTeX-provided-package-options-member "color" 
"dvips")
-                            (LaTeX-provided-package-options-member "color" 
"dvipsnames")))
-                   (remove "named" LaTeX-color-colour-models)
-                 LaTeX-color-colour-models))))
-    (if (string-equal model "")
-       ;; if empty, ask for <name> with completion
-       (let ((color (completing-read
-                     (TeX-argument-prompt optional prompt "Color name")
-                     (LaTeX-color-definecolor-list))))
-         (TeX-argument-insert color optional))
-      ;; if not empty, insert [<model>] and proceed
-      (insert (concat LaTeX-optop model LaTeX-optcl))
-      (cond (;; <cmyk> model
-            (string-equal model "cmyk")
-            (let ((cyan    (TeX-read-string "Value Cyan (between 0,1): "))
-                  (magenta (TeX-read-string "Value Magenta (between 0,1): "))
-                  (yellow  (TeX-read-string "Value Yellow (between 0,1): "))
-                  (black   (TeX-read-string "Value Black (between 0,1): ")))
-              (TeX-argument-insert
-               (concat cyan "," magenta "," yellow "," black) optional)))
-           ;; <rgb> model
-           ((string-equal model "rgb")
-            (let ((red   (TeX-read-string "Value Red (between 0,1): "))
-                  (green (TeX-read-string "Value Green (between 0,1): "))
-                  (blue  (TeX-read-string "Value Blue (between 0,1): ")))
-              (TeX-argument-insert
-               (concat red "," green "," blue) optional)))
-           ;; <gray> model
-           ((string-equal model "gray")
-            (let ((grayness (TeX-read-string "Value Gray (between 0,1): ")))
-              (TeX-argument-insert grayness optional)))
-           ;; <named> model; allowed are dvipsnames.
-           ((string-equal model "named")
-            (let ((color (completing-read "Named Color: "
-                                          LaTeX-color-dvipsnames-colors)))
-              (TeX-argument-insert color optional)))))))
+  ;; \color{<name>} or \color[<model>]{<color spec>} First, ask for
+  ;; <model>.  This happens depending on the values of
+  ;; `TeX-insert-macro-default-style' and if `current-prefix-arg'.
+  ;; `named' is removed here from completion if package option is not
+  ;; given.
+  (let* ((last-optional-rejected nil)
+         (model (LaTeX-check-insert-macro-default-style
+                 (completing-read
+                  (TeX-argument-prompt t prompt "Color model")
+                  (if (not (or (LaTeX-provided-package-options-member "color" 
"dvips")
+                               (LaTeX-provided-package-options-member "color" 
"dvipsnames")))
+                      (remove "named" LaTeX-color-colour-models)
+                    LaTeX-color-colour-models)))))
+    ;; If <model> is non-nil because of 'mandatory-args-only and not
+    ;; an empty string, then insert it
+    (if (and model (not (string-equal model "")))
+        (progn
+          (insert (concat LaTeX-optop model LaTeX-optcl))
+          (cond (;; <cmyk> model
+                 (string-equal model "cmyk")
+                 (let ((cyan    (TeX-read-string "Value Cyan (between 0,1): "))
+                       (magenta (TeX-read-string "Value Magenta (between 0,1): 
"))
+                       (yellow  (TeX-read-string "Value Yellow (between 0,1): 
"))
+                       (black   (TeX-read-string "Value Black (between 0,1): 
")))
+                   (TeX-argument-insert
+                    (concat cyan "," magenta "," yellow "," black) optional)))
+                ;; <rgb> model
+                ((string-equal model "rgb")
+                 (let ((red   (TeX-read-string "Value Red (between 0,1): "))
+                       (green (TeX-read-string "Value Green (between 0,1): "))
+                       (blue  (TeX-read-string "Value Blue (between 0,1): ")))
+                   (TeX-argument-insert
+                    (concat red "," green "," blue) optional)))
+                ;; <gray> model
+                ((string-equal model "gray")
+                 (let ((grayness (TeX-read-string "Value Gray (between 0,1): 
")))
+                   (TeX-argument-insert grayness optional)))
+                ;; <named> model; allowed are dvipsnames.
+                ((string-equal model "named")
+                 (let ((color (completing-read "Named Color: "
+                                               LaTeX-color-dvipsnames-colors)))
+                   (TeX-argument-insert color optional)))))
+      ;; if empty, ask for <name> with completion
+      (let ((color (completing-read
+                    (TeX-argument-prompt optional prompt "Color name")
+                    (LaTeX-color-definecolor-list))))
+        (TeX-argument-insert color optional)))))
 
 (defun TeX-arg-color-fcolorbox (optional &optional prompt)
   "Insert arguments of `\\fcolorbox' from `color.sty'. "
   ;; \fcolorbox{<frame color name>}{<box color name>}{<text>} or
   ;; \fcolorbox[<model>]{<frame color spec>}{<box color spec>}{<text>}
-  ;; First, ask for <model>; remove `named' again
-  (let ((model (completing-read
-               (TeX-argument-prompt t prompt "Color model")
-               (if (not (or (LaTeX-provided-package-options-member "color" 
"dvips")
-                            (LaTeX-provided-package-options-member "color" 
"dvipsnames")))
-                   (remove "named" LaTeX-color-colour-models)
-                 LaTeX-color-colour-models))))
-    (if (string-equal model "")
-       ;; if empty, ask for <frame color spce> with completion
-       (let ((frame-color (completing-read
-                           (TeX-argument-prompt optional prompt "Frame color 
name")
-                           (LaTeX-color-definecolor-list)))
-             (box-color   (completing-read
-                           (TeX-argument-prompt optional prompt "Box color 
name")
-                           (LaTeX-color-definecolor-list))))
-         (TeX-argument-insert frame-color optional)
-         (TeX-argument-insert box-color   optional))
-      ;; if not empty, insert [<model>] and cater for 2 mandatory args.
-      (insert (concat LaTeX-optop model LaTeX-optcl))
-      (cond (;; <cmyk> model
-            (string-equal model "cmyk")
-            (let ((cyan    (TeX-read-string "Frame value Cyan (between 0,1): 
"))
-                  (magenta (TeX-read-string "Frame value Magenta (between 
0,1): "))
-                  (yellow  (TeX-read-string "Frame value Yellow (between 0,1): 
"))
-                  (black   (TeX-read-string "Frame value Black (between 0,1): 
")))
-              (TeX-argument-insert
-               (concat cyan "," magenta "," yellow "," black) optional))
-            (let ((cyan    (TeX-read-string "Box value Cyan (between 0,1): "))
-                  (magenta (TeX-read-string "Box value Magenta (between 0,1): 
"))
-                  (yellow  (TeX-read-string "Box value Yellow (between 0,1): 
"))
-                  (black   (TeX-read-string "Box value Black (between 0,1): 
")))
-              (TeX-argument-insert
-               (concat cyan "," magenta "," yellow "," black) optional)))
-           ;; <rgb> model
-           ((string-equal model "rgb")
-            (let ((red   (TeX-read-string "Frame value Red (between 0,1): "))
-                  (green (TeX-read-string "Frame value Green (between 0,1): "))
-                  (blue  (TeX-read-string "Frame value Blue (between 0,1): ")))
-              (TeX-argument-insert
-               (concat red "," green "," blue) optional))
-            (let ((red   (TeX-read-string "Box value Red (between 0,1): "))
-                  (green (TeX-read-string "Box value Green (between 0,1): "))
-                  (blue  (TeX-read-string "box value Blue (between 0,1): ")))
-              (TeX-argument-insert
-               (concat red "," green "," blue) optional)))
-           ;; <gray> model
-           ((string-equal model "gray")
-            (let ((grayness (TeX-read-string "Frame value Gray (between 0,1): 
")))
-              (TeX-argument-insert grayness optional))
-            (let ((grayness (TeX-read-string "Box value Gray (between 0,1): 
")))
-              (TeX-argument-insert grayness optional)))
-           ;; <named> model; allowed are dvipsnames.
-           ((string-equal model "named")
-            (let ((color (completing-read "Frame named Color: "
-                                          LaTeX-color-dvipsnames-colors)))
-              (TeX-argument-insert color optional))
-            (let ((color (completing-read "Box named Color: "
-                                          LaTeX-color-dvipsnames-colors)))
-              (TeX-argument-insert color optional)))))))
+  ;; First, ask for <model> depending on
+  ;; `TeX-insert-macro-default-style' and `current-prefix-arg'.
+  ;; Remove `named' if necessary.
+  (let* ((last-optional-rejected nil)
+        (model (LaTeX-check-insert-macro-default-style
+                 (completing-read
+                  (TeX-argument-prompt t prompt "Color model")
+                  (if (not (or (LaTeX-provided-package-options-member "color" 
"dvips")
+                               (LaTeX-provided-package-options-member "color" 
"dvipsnames")))
+                      (remove "named" LaTeX-color-colour-models)
+                    LaTeX-color-colour-models)))))
+    ;; If <model> is non-nil because of 'mandatory-args-only and not
+    ;; an empty string, then insert [<model>] and cater for 2
+    ;; mandatory args.
+    (if (and model (not (string-equal model "")))
+       (progn
+         (insert (concat LaTeX-optop model LaTeX-optcl))
+         (cond (;; <cmyk> model
+                (string-equal model "cmyk")
+                (let ((cyan    (TeX-read-string "Frame value Cyan (between 
0,1): "))
+                      (magenta (TeX-read-string "Frame value Magenta (between 
0,1): "))
+                      (yellow  (TeX-read-string "Frame value Yellow (between 
0,1): "))
+                      (black   (TeX-read-string "Frame value Black (between 
0,1): ")))
+                  (TeX-argument-insert
+                   (concat cyan "," magenta "," yellow "," black) optional))
+                (let ((cyan    (TeX-read-string "Box value Cyan (between 0,1): 
"))
+                      (magenta (TeX-read-string "Box value Magenta (between 
0,1): "))
+                      (yellow  (TeX-read-string "Box value Yellow (between 
0,1): "))
+                      (black   (TeX-read-string "Box value Black (between 
0,1): ")))
+                  (TeX-argument-insert
+                   (concat cyan "," magenta "," yellow "," black) optional)))
+               ;; <rgb> model
+               ((string-equal model "rgb")
+                (let ((red   (TeX-read-string "Frame value Red (between 0,1): 
"))
+                      (green (TeX-read-string "Frame value Green (between 
0,1): "))
+                      (blue  (TeX-read-string "Frame value Blue (between 0,1): 
")))
+                  (TeX-argument-insert
+                   (concat red "," green "," blue) optional))
+                (let ((red   (TeX-read-string "Box value Red (between 0,1): "))
+                      (green (TeX-read-string "Box value Green (between 0,1): 
"))
+                      (blue  (TeX-read-string "box value Blue (between 0,1): 
")))
+                  (TeX-argument-insert
+                   (concat red "," green "," blue) optional)))
+               ;; <gray> model
+               ((string-equal model "gray")
+                (let ((grayness (TeX-read-string "Frame value Gray (between 
0,1): ")))
+                  (TeX-argument-insert grayness optional))
+                (let ((grayness (TeX-read-string "Box value Gray (between 
0,1): ")))
+                  (TeX-argument-insert grayness optional)))
+               ;; <named> model; allowed are dvipsnames.
+               ((string-equal model "named")
+                (let ((color (completing-read "Frame named Color: "
+                                              LaTeX-color-dvipsnames-colors)))
+                  (TeX-argument-insert color optional))
+                (let ((color (completing-read "Box named Color: "
+                                              LaTeX-color-dvipsnames-colors)))
+                  (TeX-argument-insert color optional)))))
+      ;; if empty, ask for {<frame color spce>}{<box color name>} with 
completion
+      (let ((frame-color (completing-read
+                         (TeX-argument-prompt optional prompt "Frame color 
name")
+                         (LaTeX-color-definecolor-list)))
+           (box-color   (completing-read
+                         (TeX-argument-prompt optional prompt "Box color name")
+                         (LaTeX-color-definecolor-list))))
+       (TeX-argument-insert frame-color optional)
+       (TeX-argument-insert box-color   optional)))))
 
 (TeX-add-style-hook
  "color"
diff --git a/style/colortbl.el b/style/colortbl.el
index 3fc1689..c878842 100644
--- a/style/colortbl.el
+++ b/style/colortbl.el
@@ -1,6 +1,6 @@
 ;;; colortbl.el --- AUCTeX style for `colortbl.sty' (v1.0a)
 
-;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "colortbl"
  (lambda ()
diff --git a/style/commath.el b/style/commath.el
index 0da55fe..71a4713 100644
--- a/style/commath.el
+++ b/style/commath.el
@@ -1,6 +1,6 @@
 ;;; commath.el --- AUCTeX style for `commath.sty' (v0.3)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "commath"
  (lambda ()
diff --git a/style/comment.el b/style/comment.el
index d6ba12d..8d2bc7d 100644
--- a/style/comment.el
+++ b/style/comment.el
@@ -1,6 +1,6 @@
 ;;; comment.el --- AUCTeX style for `comment.sty'
 
-;; Copyright (C) 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,17 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
+(defvar font-latex-syntactic-keywords-extra)
+
 (TeX-add-style-hook
  "comment"
  (lambda ()
diff --git a/style/csquotes.el b/style/csquotes.el
index e4b156d..a34a775 100644
--- a/style/csquotes.el
+++ b/style/csquotes.el
@@ -1,6 +1,6 @@
 ;;; csquotes.el --- AUCTeX style for `csquotes.sty'
 
-;; Copyright (C) 2004, 2005, 2006, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2006, 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -28,9 +28,13 @@
 
 ;; This file adds support for `csquotes.sty', version 3.7.
 
-
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 ;; FIXME: It would be nice to be able to dump this function in favor
 ;; of a generalized handling of additional arguments for environments
 ;; specified via `LaTeX-add-environments'.  `TeX-parse-arguments' and
diff --git a/style/danish.el b/style/danish.el
index fa9ab6f..a70772a 100644
--- a/style/danish.el
+++ b/style/danish.el
@@ -2,6 +2,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
 (TeX-add-style-hook
  "danish"
  (lambda ()
diff --git a/style/dashundergaps.el b/style/dashundergaps.el
new file mode 100644
index 0000000..8a59f0c
--- /dev/null
+++ b/style/dashundergaps.el
@@ -0,0 +1,103 @@
+;;; dashundergaps.el --- AUCTeX style for `dashundergaps.sty' (v2.0d)
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <address@hidden>
+;; Maintainer: address@hidden
+;; Created: 2018-11-24
+;; 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 `dashundergaps.sty' v2.0d from
+;; 2018/11/18.  `dashundergaps.sty' is part of TeXLive.
+
+;;; Code:
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defvar LaTeX-dashundergaps-key-val-options
+  `(;; 2.1.1 Gap modes
+    ("teacher-mode" ("true" "false"))
+    ("gap-mode"     ("true" "false"))
+    ("teachermode"  ("true" "false"))
+    ;; 2.1.2 Gap formatting
+    ("gap-format"        ("underline" "double-underline"
+                         "dash" "dot" "wave" "blank"))
+    ("gap-format-adjust"  ("true" "false"))
+    ("teacher-gap-format" ("underline" "double-underline"
+                          "dash" "dot" "wave" "blank"))
+    ("gap-font" ,(mapcar (lambda (x)
+                          (concat TeX-esc x))
+                        '("rmfamily" "sffamily" "ttfamily" "mdseries" 
"bfseries"
+                          "upshape" "itshape" "slshape" "scshape"
+                          "tiny"  "scriptsize" "footnotesize"
+                          "small" "normalsize" "large"
+                          "Large" "LARGE" "huge" "Huge" "normalfont")))
+    ("dash")
+    ("dot")
+    ;; 2.1.3 Gap numbers
+    ("gap-numbers"        ("true" "false"))
+    ("gap-number-format")
+    ("numbers")
+    ("display-total-gaps" ("true" "false"))
+    ("displaynbgaps")
+    ;; 2.1.4 Gap widening
+    ("gap-widen"          ("true" "false"))
+    ("gap-extend-minimum" ,(mapcar (lambda (x)
+                                    (concat TeX-esc x))
+                                  (mapcar #'car (LaTeX-length-list))))
+    ("gap-extend-percent")
+    ("widen"))
+  "Key=value options for dashundergaps macro.")
+
+(TeX-add-style-hook
+ "dashundergaps"
+ (lambda ()
+
+   ;; 2 The user interface
+   (TeX-add-symbols
+    '("gap"  [ TeX-arg-key-val LaTeX-dashundergaps-key-val-options ] t)
+    '("gap*" [ TeX-arg-key-val LaTeX-dashundergaps-key-val-options ] t)
+
+    '("TeacherModeOn" 0)
+    '("TeacherModeOff" 0)
+
+    '("dashundergapssetup"
+      (TeX-arg-key-val LaTeX-dashundergaps-key-val-options)))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("gap" "*[{"))
+                             'textual)
+     (font-latex-add-keywords '(("dashundergapssetup" "{")
+                               ("TeacherModeOn"      "")
+                               ("TeacherModeOff"     ""))
+                             'function)))
+ LaTeX-dialect)
+
+(defvar LaTeX-dashundergaps-package-options nil
+  "Package options for the dashundergaps package.")
+
+;;; dashundergaps.el ends here
diff --git a/style/dinbrief.el b/style/dinbrief.el
index 2ec5611..8c08b66 100644
--- a/style/dinbrief.el
+++ b/style/dinbrief.el
@@ -1,6 +1,6 @@
 ;;; dinbrief.el --- Special code for LaTeX-Style dinbrief.
 
-;; Copyright (C) 1994, 2013, 2014  Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2013, 2014, 2018  Free Software Foundation, Inc.
 
 ;; Author: Werner Fink <address@hidden>
 ;; Maintainer: address@hidden
@@ -67,7 +67,7 @@
 
 (defmacro LaTeX-dinbrief-insert (&rest args)
   "Insert text ignoring active markers."
-  `(progn (if (TeX-mark-active) (deactivate-mark))
+  `(progn (if mark-active (deactivate-mark))
      (insert ,@args)))
 
 (defun LaTeX-dinbrief-style ()
@@ -123,7 +123,7 @@
            (newline-and-indent)
          (if (not (zerop (length retouradr)))
              (progn
-               (if (TeX-mark-active) (deactivate-mark))
+               (if mark-active (deactivate-mark))
                (LaTeX-dinbrief-insert TeX-esc "backaddress" TeX-grop retouradr 
TeX-grcl)
                (newline-and-indent)))))
       (LaTeX-dinbrief-insert TeX-esc "enabledraftstandard")
diff --git a/style/emp.el b/style/emp.el
index e42b23c..79ce9f0 100644
--- a/style/emp.el
+++ b/style/emp.el
@@ -25,20 +25,17 @@
 
 ;;; Code:
 
-
-(TeX-add-style-hook "emp"
- (function
-  (lambda ()
-     (TeX-add-symbols "empuse" "empTeX"  "empaddtoTeX"
-                     "emprelude" "empaddtoprelude" "unitlength"
-                    )
-    (LaTeX-add-environments
-     '("empfile" LaTeX-env-empfile)
-     '("emp" LaTeX-env-emp-gen)
-     '("empdef" LaTeX-env-emp-gen)
-     '("empgraph" LaTeX-env-emp-gen)
-     '("empcmds")
-     )))
+(TeX-add-style-hook
+ "emp"
+ (lambda ()
+   (TeX-add-symbols "empuse" "empTeX"  "empaddtoTeX"
+                   "emprelude" "empaddtoprelude" "unitlength")
+   (LaTeX-add-environments
+    '("empfile" LaTeX-env-empfile)
+    '("emp" LaTeX-env-emp-gen)
+    '("empdef" LaTeX-env-emp-gen)
+    '("empgraph" LaTeX-env-emp-gen)
+    '("empcmds")))
  LaTeX-dialect)
 
 (defun LaTeX-env-emp-gen (environment-name)
@@ -51,7 +48,7 @@ Used for emp, empdef, and empgraph environments."
         ;;; emp, empdef, and empgraph environments
         ;;; we give them 1 by default
         ;;; not necessarily the best thing to do?
-        )
+        LaTeX-emp-fig-name)
      (if (not (zerop (length emp-fig-name)))
         (progn
           (setq LaTeX-emp-fig-name (concat LaTeX-optop emp-fig-name 
LaTeX-optcl))
@@ -61,20 +58,19 @@ Used for emp, empdef, and empgraph environments."
      (end-of-line)
      (insert "(" emp-fig-width "," emp-fig-height ")")
      (forward-line 1)
-     (indent-according-to-mode)
-     ))
+     (indent-according-to-mode)))
 
 (defun LaTeX-env-empfile (_optional)
-   "Ask for file. Insert empfile environment"
-   (let ((empfile (TeX-read-string "empfile: " "")))
+   "Ask for file. Insert empfile environment."
+   (let ((empfile (TeX-read-string "empfile: " ""))
+        LaTeX-emp-file-name mpost-emp-file-name)
      (if (not (zerop (length empfile)))
         (progn
           (setq LaTeX-emp-file-name (concat LaTeX-optop empfile LaTeX-optcl))
           (setq mpost-emp-file-name (concat empfile ".mp"))
           (LaTeX-insert-environment "empfile" LaTeX-emp-file-name))
-       (progn
-        (setq mpost-emp-file-name "\\jobname")
-        (LaTeX-insert-environment "empfile")))
+       (setq mpost-emp-file-name "\\jobname")
+       (LaTeX-insert-environment "empfile"))
      (if LaTeX-write18-enabled-p
         (progn
           (forward-line 1)
@@ -82,4 +78,5 @@ Used for emp, empdef, and empgraph environments."
           (newline-and-indent)
           (insert "\\immediate\\write18{mpost -tex=latex " mpost-emp-file-name 
TeX-grcl)
           (forward-line -2)))))
+
 ;;; emp.el ends here
diff --git a/style/empheq.el b/style/empheq.el
index b0231e8..e01d04c 100644
--- a/style/empheq.el
+++ b/style/empheq.el
@@ -1,6 +1,6 @@
 ;;; empheq.el --- AUCTeX style for `empheq.sty' (v2.14)
 
-;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -34,9 +34,20 @@
 (eval-when-compile
   (require 'cl-lib))
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function LaTeX-item-equation-alignat
+                 "amsmath" (&optional suppress))
+
+(defvar LaTeX-mathtools-package-options)
+(defvar font-latex-math-environments)
+
 (defvar LaTeX-empheq-key-val-options
   `(("box")
     ("innerbox")
@@ -98,6 +109,11 @@
 (defvar LaTeX-empheq-package-options
   '("overload" "overload2" "ntheorem" "newmultline" "oldmultline")
   "Package options for the empheq package.")
+(TeX-load-style "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))
 
 ;; Setup for \Declare(Left|Right)Delimiter:
 
@@ -227,7 +243,7 @@ number of ampersands if possible."
       (when (looking-at "[ \t\n\r%]*\\[")
        (forward-sexp))
       (re-search-forward "[ \t\n\r%]*{\\([^}]+\\)}")
-      (setq match (TeX-replace-regexp-in-string "[ \t\n\r%]" ""
+      (setq match (replace-regexp-in-string "[ \t\n\r%]" ""
                                                (match-string-no-properties 1)))
       (if (string-match "=" match)
          (progn
@@ -269,11 +285,6 @@ number of ampersands if possible."
    ;; 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))
diff --git a/style/enumitem.el b/style/enumitem.el
index 1518a7a..06a44d2 100644
--- a/style/enumitem.el
+++ b/style/enumitem.el
@@ -1,6 +1,6 @@
-;;; enumitem.el --- AUCTeX style for `enumitem.sty' (v3.5.2)
+;;; enumitem.el --- AUCTeX style for `enumitem.sty' (v3.6)
 
-;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -26,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `enumitem.sty' (v3.5.2) from 2011/09/28.
+;; This file adds support for `enumitem.sty' (v3.6) from 2018/11/30.
 ;; `enumitem.sty' is part of TeXLive.
 
 ;; Tassilo Horn's `minted.el' was a major source of inspiration for
@@ -41,40 +41,75 @@
 (eval-when-compile
   (require 'cl-lib))
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-enumitem-key-val-options
-  '(;; Vertical Spacing
-    ("topsep")
-    ("partopsep")
-    ("parsep")
-    ("itemsep")
-    ;; Horizontal Spacing
+  `(;; 3.1 Label and cross references format
+    ("label"  ("\\alph*"  "\\Alph*"  "\\arabic*"
+              "\\roman*" "\\Roman*" "\\value*"))
+    ("label*" ("\\alph*"  "\\Alph*"  "\\arabic*"
+              "\\roman*" "\\Roman*" "\\value*"))
+    ("ref"    ("\\alph*"  "\\Alph*"  "\\arabic*"
+              "\\roman*" "\\Roman*" "\\value*"))
+    ("font" ,(mapcar (lambda (mac)
+                      (concat TeX-esc mac))
+                    '(;; family
+                      "rmfamily" "sffamily" "ttfamily"
+                      ;; series
+                      "mdseries" "bfseries"
+                      ;; shape
+                      "upshape" "itshape" "slshape" "scshape"
+                      ;; size
+                      "tiny"  "scriptsize" "footnotesize"
+                      "small" "normalsize" "large"
+                      "Large" "LARGE" "huge" "Huge"
+                      ;; reset macro
+                      "normalfont")))
+    ("format" ,(mapcar (lambda (mac)
+                        (concat TeX-esc mac))
+                      '(;; family
+                        "rmfamily" "sffamily" "ttfamily"
+                        ;; series
+                        "mdseries" "bfseries"
+                        ;; shape
+                        "upshape" "itshape" "slshape" "scshape"
+                        ;; size
+                        "tiny"  "scriptsize" "footnotesize"
+                        "small" "normalsize" "large"
+                        "Large" "LARGE" "huge" "Huge"
+                        ;; reset macro
+                        "normalfont")))
+    ("align" ("left" "right" "parleft"))
+    ;; 3.2 Horizontal spacing of labels
+    ("labelindent" ("*" "!"))
+    ("left")
     ("leftmargin"  ("*" "!"))
     ("itemindent"  ("*" "!"))
     ("labelsep"    ("*" "!"))
     ("labelwidth"  ("*" "!"))
-    ("labelindent" ("*" "!"))
-    ("labelsep*")
-    ("labelindent*")
     ("widest")
     ("widest*")
+    ("labelsep*")
+    ("labelindent*")
     ("rightmargin")
-    ;; Labels and cross reference format
-    ("label")
-    ("label*")
-    ("ref")
-    ("font")
-    ("format")
-    ("align" ("left" "right" "parleft"))
-    ;; Numbering, stopping, resuming
+    ;; Vertical Spacing
+    ("topsep")
+    ("partopsep")
+    ("parsep")
+    ("itemsep")
+    ;; 3.3 Numbering, stopping, and resuming
     ("start")
     ("resume")
     ("resume*")
-    ;; Series
+    ;; 3.4 Series
     ("series")
-    ;; Penalties
+    ;; 3.5 Penalties
     ("beginpenalty")
     ("midpenalty")
     ("endpenalty")
@@ -82,14 +117,16 @@
     ("before*")
     ("after")
     ("after*")
-    ;; Description styles
-    ("style" ("standard" "multiline" "nextline" "sameline" "unboxed"))
-    ;; Compact lists
+    ("first")
+    ("first*")
+    ;; 3.6 Description styles
+    ("style" ("standard" "unboxed" "nextline" "sameline" "multiline"))
+    ;; 3.7 Compact lists
     ("noitemsep")
     ("nosep")
-    ;; Wide lists
+    ;; 3.8 Wide lists
     ("wide")
-    ;; Inline lists
+    ;; 4 Inline lists
     ("itemjoin")
     ("itemjoin*")
     ("afterlabel")
@@ -177,7 +214,7 @@ package.")
   ;; Now add the parsed env's to the local list.
   (when (LaTeX-enumitem-newlist-list)
     (setq LaTeX-enumitem-newlist-list-local
-         (append (mapcar 'list (mapcar 'car (LaTeX-enumitem-newlist-list)))
+         (append (mapcar #'list (mapcar #'car (LaTeX-enumitem-newlist-list)))
                  LaTeX-enumitem-newlist-list-local))))
 
 (add-hook 'TeX-auto-prepare-hook #'LaTeX-enumitem-auto-prepare t)
@@ -277,7 +314,7 @@ in `enumitem'-completions."
           (temp (copy-alist LaTeX-enumitem-key-val-options-local))
           (opts (assq-delete-all (car (assoc key temp)) temp)))
       (cl-pushnew (list key (TeX-delete-duplicate-strings (apply #'append 
(list val) val-match)))
-                 opts :test #'equal)
+                 opts :test #'equal)
       (setq LaTeX-enumitem-key-val-options-local (copy-alist opts)))))
 
 (TeX-add-style-hook
@@ -318,7 +355,7 @@ in `enumitem'-completions."
       '("description*" LaTeX-enumitem-env-with-opts))
      (add-to-list 'LaTeX-item-list '("description*" . LaTeX-item-argument)))
 
-   ;; Cloning lists
+   ;; 7 Cloning the basic lists
    (TeX-add-symbols
     ;; The easy way would be:
     ;; '("newlist"
@@ -364,9 +401,13 @@ in `enumitem'-completions."
     '("setlist"
       [TeX-arg-eval mapconcat #'identity
                    (TeX-completing-read-multiple
-                    "Environment(s), level(s): "
-                    `(,@LaTeX-enumitem-newlist-list-local
-                      ("1") ("2") ("3") ("4"))) ","]
+                    (TeX-argument-prompt optional nil "Environment(s), 
level(s)")
+                    (append
+                     (when (LaTeX-provided-package-options-member "enumitem"
+                                                                  
"includedisplayed")
+                       '("trivlist"))
+                     LaTeX-enumitem-newlist-list-local
+                     '(("1") ("2") ("3") ("4")))) ","]
       (TeX-arg-eval
        (lambda ()
         (LaTeX-enumitem-update-key-val-options)
@@ -377,9 +418,13 @@ in `enumitem'-completions."
     '("setlist*"
       [TeX-arg-eval mapconcat #'identity
                    (TeX-completing-read-multiple
-                    "Environment, level: "
-                    `(,@LaTeX-enumitem-newlist-list-local
-                      ("1") ("2") ("3") ("4"))) ","]
+                    (TeX-argument-prompt optional nil "Environment(s), 
level(s)")
+                    (append
+                     (when (LaTeX-provided-package-options-member "enumitem"
+                                                                  
"includedisplayed")
+                       '("trivlist"))
+                     LaTeX-enumitem-newlist-list-local
+                     '(("1") ("2") ("3") ("4")))) ","]
       (TeX-arg-eval
        (lambda ()
         (LaTeX-enumitem-update-key-val-options)
@@ -420,8 +465,11 @@ in `enumitem'-completions."
     ;; "Key" will be parsed and added to key-val list.
     '("SetEnumitemKey" LaTeX-arg-SetEnumitemKey)
 
-    ;; "Key" and "Value" are added to our key-val list
-    '("SetEnumitemValue" LaTeX-arg-SetEnumitemValue "Replacement"))
+    ;; "Key" and "Value" are added to our key-val list.
+    '("SetEnumitemValue" LaTeX-arg-SetEnumitemValue "Replacement")
+
+    ;; v3.6 has a macro for visual debugging.
+    '("DrawEnumitemLabel" 0))
 
    ;; Setting enumerate short label
    (when (LaTeX-provided-package-options-member "enumitem" "shortlabels")
@@ -431,6 +479,9 @@ in `enumitem'-completions."
                      '(("A") ("a") ("I") ("i") ("1")))
        "Replacement")))
 
+   ;; Add \labelindent to list of known lengths:
+   (LaTeX-add-lengths "labelitem")
+
    ;; Fontification
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
@@ -449,7 +500,8 @@ in `enumitem'-completions."
  LaTeX-dialect)
 
 (defvar LaTeX-enumitem-package-options
-  '("inline" "ignoredisplayed" "shortlabels" "loadonly")
+  '("inline" "shortlabels" "loadonly" "sizes"
+    "ignoredisplayed" "includedisplayed")
   "Package options for the enumitem package.")
 
 ;;; enumitem.el ends here
diff --git a/style/environ.el b/style/environ.el
index 16cb0ca..c5255b7 100644
--- a/style/environ.el
+++ b/style/environ.el
@@ -1,6 +1,6 @@
 ;;; environ.el --- AUCTeX style for `environ.sty' version v0.3
 
-;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -45,6 +45,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-auto-environ-NewEnviron nil
   "Temporary for parsing the arguments of `\\NewEnviron'
 from `environ' package.")
diff --git a/style/epigraph.el b/style/epigraph.el
index 1d10c6a..c607f21 100644
--- a/style/epigraph.el
+++ b/style/epigraph.el
@@ -1,6 +1,6 @@
 ;;; epigraph.el --- AUCTeX style for `epigraph.sty' v1.5c
 
-;; Copyright (C) 2012, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2012, 2017, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "epigraph"
  (lambda ()
diff --git a/style/erewhon.el b/style/erewhon.el
index b4d24e3..58b2f06 100644
--- a/style/erewhon.el
+++ b/style/erewhon.el
@@ -1,6 +1,6 @@
 ;;; erewhon.el --- AUCTeX style for `erewhon.sty' (v1.04)
 
-;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "erewhon"
  (lambda ()
diff --git a/style/exam.el b/style/exam.el
index b761128..be8126d 100644
--- a/style/exam.el
+++ b/style/exam.el
@@ -1,6 +1,6 @@
 ;;; exam.el --- AUCTeX style for the (LaTeX) exam class
 
-;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2018 Free Software Foundation, Inc.
 
 ;; Author: Uwe Brauer <address@hidden>
 ;; Created: 2016-03-06
@@ -32,10 +32,22 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defvar LaTeX-article-class-options)
+
 (defvar LaTeX-exam-class-options
   '("answers" "noanswers" "cancelspace" "nocancelspace" "addpoints")
   "Class options for the exam class.")
 
+(TeX-load-style "article")
+;; Add options from `LaTeX-article-class-options' only once:
+(dolist (opt LaTeX-article-class-options)
+  (add-to-list 'LaTeX-exam-class-options opt))
+
 (defun LaTeX-exam-insert-item ()
   "Insert a new item in an environment from exam class.
 Item inserted depends on the environment."
@@ -63,9 +75,6 @@ Arguments NAME and TYPE are the same as for the function
  "exam"
  (lambda ()
    (TeX-run-style-hooks "article")
-   ;; Add options from `LaTeX-article-class-options' only once:
-   (dolist (opt LaTeX-article-class-options)
-     (add-to-list 'LaTeX-exam-class-options opt))
    ;; Make our label prefix available ...
    (let ((envs '("questions")))
      (dolist (env envs)
diff --git a/style/expl3.el b/style/expl3.el
index 78361d7..c1bb029 100644
--- a/style/expl3.el
+++ b/style/expl3.el
@@ -1,6 +1,6 @@
 ;;; expl3.el --- AUCTeX style for `expl3.sty'
 
-;; Copyright (C) 2015, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2017, 2018 Free Software Foundation, Inc.
 
 ;; Author: Tassilo Horn <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
 (defvar LaTeX-expl3-syntax-table
   (let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
     ;; Make _ and : symbol chars
diff --git a/style/fancyhdr.el b/style/fancyhdr.el
index 47748ae..3e81e3a 100644
--- a/style/fancyhdr.el
+++ b/style/fancyhdr.el
@@ -1,6 +1,6 @@
 ;;; fancyhdr.el --- AUCTeX style for `fancyhdr.sty'
 
-;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2012, 2013, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,15 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
 (TeX-add-style-hook
  "fancyhdr"
  (lambda ()
diff --git a/style/fancyref.el b/style/fancyref.el
index ce3053d..6b9198a 100644
--- a/style/fancyref.el
+++ b/style/fancyref.el
@@ -1,6 +1,6 @@
 ;;; fancyref.el --- AUCTeX style file with support for fancyref.sty
 
-;; Copyright (C) 1999, 2014, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2014, 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
@@ -24,6 +24,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook "fancyref"
    (lambda ()
      
diff --git a/style/fancyvrb.el b/style/fancyvrb.el
index 3b33350..32adcd4 100644
--- a/style/fancyvrb.el
+++ b/style/fancyvrb.el
@@ -1,6 +1,6 @@
-;;; fancyvrb.el --- AUCTeX style for `fancyvrb.sty' version 2.8.
+;;; fancyvrb.el --- AUCTeX style for `fancyvrb.sty' version 3.0.
 
-;; Copyright (C) 2013, 2014, 2016, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2014, 2016--2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -25,7 +25,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `fancyvrb.sty' version 2.8.
+;; This file adds support for `fancyvrb.sty' version 3.0.
 
 ;; This style has some capabilities to parse user defined macros,
 ;; environments and saved blocks with `SaveVerbatim' environments and
@@ -43,11 +43,20 @@
 
 ;;; Code:
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
 (defvar LaTeX-fancyvrb-key-val-options
-  '(("commentchar" ("none"))
+  `(("commentchar" ("none"))
     ("gobble")
     ("formatcom")
     ;; Undocumented key
@@ -89,6 +98,10 @@
     ("defineactive")
     ;; Undocumented key
     ("defineactive*")
+    ;; Undocumented key and introduced in version 2.81 2011/04/06
+    ("vspace" ,(mapcar (lambda (x)
+                        (concat TeX-esc (car x)))
+                      (LaTeX-length-list)))
     ;; Actually, the following options are used only by the `BVerbatim'
     ;; environment.
     ("boxwidth" ("auto" "dimension"))
@@ -193,21 +206,27 @@ CLEANUP is non-nil, do not insert any arguments in the 
buffer and
 update only various AUCTeX variables for verbatim macros.  If
 RECUSTOM is non-nil, delete macros from the variable
 `TeX-symbol-list' before adding the new ones."
-  (let ((new-mac (unless cleanup
-                  (if recustom
+  ;; This part is only relevant when called by user:
+  (unless cleanup
+    (let ((new-mac (if recustom
                       (completing-read
                        (TeX-argument-prompt optional nil "Verbatim macro: \\" 
t)
                        (mapcar #'car (apply #'append 
LaTeX-fancyvrb-macro-list)))
                     (TeX-read-string
-                     (TeX-argument-prompt optional nil "New verbatim macro: 
\\" t)))))
-       (base-mac (unless cleanup
-                   (completing-read (TeX-argument-prompt optional nil "Based 
on macro")
-                                    LaTeX-fancyvrb-base-macros)))
-       (rec-flag (if recustom "Rec" "C")))
-    ;; We are (re-)defining a macro: Insert user queried input and use
-    ;; `LaTeX-add-fancyvrb-macros' on the input
-    (unless cleanup
-      (TeX-argument-insert new-mac optional TeX-esc)
+                     (TeX-argument-prompt optional nil "New verbatim macro: 
\\" t))))
+         (base-mac (completing-read (TeX-argument-prompt optional nil "Based 
on macro")
+                                    LaTeX-fancyvrb-base-macros))
+         (rec-flag (if recustom "Rec" "C")))
+      ;; We are (re-)defining a macro: Insert user queried input and
+      ;; use `LaTeX-add-fancyvrb-macros' on the input.  Do not enclose
+      ;; the first argument in braces as this will improve
+      ;; fontification.  Otherwise, the part between 2 closing braces
+      ;; get fontified, i.e.:
+      ;; \CustomVerbatimCommand{\foo}{Verb}{}
+      ;;                            ^     ^
+      (let ((TeX-arg-opening-brace "")
+           (TeX-arg-closing-brace ""))
+       (TeX-argument-insert new-mac optional TeX-esc))
       (TeX-argument-insert base-mac optional)
       (TeX-argument-insert
        (TeX-read-key-val optional LaTeX-fancyvrb-key-val-options-local) 
optional)
@@ -268,13 +287,21 @@ RECUSTOM is non-nil, delete macros from the variable
            ;; Anything else is considered as verbatim typesetting macro:
            (t
             (TeX-add-symbols
-             `(mac-name
+             `(,mac-name
+               [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
+               TeX-arg-verb)
+             ;; Defined macros have a starred version where the
+             ;; `showspaces' key is set to true
+             `(,(concat mac-name "*")
                [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
                TeX-arg-verb))
-            (add-to-list 'LaTeX-verbatim-macros-with-delims-local mac-name t)
+            (add-to-list 'LaTeX-verbatim-macros-with-delims-local
+                         mac-name t)
+            (add-to-list 'LaTeX-verbatim-macros-with-delims-local
+                         (concat mac-name "*") t)
             (when (and (fboundp 'font-latex-add-keywords)
                        (fboundp 'font-latex-update-font-lock))
-              (font-latex-add-keywords `((,mac-name "["))
+              (font-latex-add-keywords `((,mac-name "*["))
                                        'textual))))))
   ;; Update font-lock:
   (when (and (fboundp 'font-latex-add-keywords)
@@ -287,70 +314,70 @@ RECUSTOM is non-nil, delete macros from the variable
 If OPTIONAL is non-nil, insert the arguments in brackets.  If
 CLEANUP is non-nil, do not insert any arguments in the buffer and
 update only various AUCTeX variables for verbatim environments."
-  (let ((new-env (unless cleanup
-                  (TeX-read-string
-                   (TeX-argument-prompt optional nil "New verbatim 
environment"))))
-       (base-env (unless cleanup
-                   (completing-read (TeX-argument-prompt optional nil "Based 
on environment")
-                                    LaTeX-fancyvrb-base-environments))))
-    ;; We are defining a new env: First insert the arguments and the
-    ;; run `LaTeX-add-fancyvrb-environments' on '(new-env base-env).
-    ;; If base-env is SaveVerbatim, run
-    ;; `LaTeX-add-fancyvrb-saveverbatims' on new-env as well.
-    (unless cleanup
-      (TeX-argument-insert (car new-env) optional)
+  (unless cleanup
+    (let ((new-env (TeX-read-string
+                   (TeX-argument-prompt optional nil "New verbatim 
environment")))
+         (base-env (completing-read
+                    (TeX-argument-prompt optional nil "Based on environment")
+                    LaTeX-fancyvrb-base-environments)))
+      ;; We are defining a new env: First insert the arguments and then
+      ;; run `LaTeX-add-fancyvrb-environments' on '(new-env base-env).
+      ;; If base-env is SaveVerbatim, run
+      ;; `LaTeX-add-fancyvrb-saveverbatims' on new-env as well.
+      (TeX-argument-insert new-env optional)
       (TeX-argument-insert base-env optional)
       (TeX-argument-insert
        (TeX-read-key-val optional LaTeX-fancyvrb-key-val-options-local) 
optional)
       (LaTeX-add-fancyvrb-environments `(,new-env ,base-env))
       (when (string= base-env "SaveVerbatim")
-       (LaTeX-add-fancyvrb-saveverbatims new-env)))
-    ;;
-    ;; Now run the procdure:
-    (dolist (elt (LaTeX-fancyvrb-environment-list))
-      (let ((env (car elt))
-           (type (cadr elt)))
-       (cond ((string= type "VerbatimOut")
-              (LaTeX-add-environments
-               `(,env (lambda (env)
-                        (let ((options (TeX-read-key-val t 
LaTeX-fancyvrb-key-val-options-local))
-                              (file (TeX-read-string "Output file: ")))
-                          (LaTeX-insert-environment
-                           env
-                           (concat
-                            (unless (zerop (length options))
-                              (concat LaTeX-optop options LaTeX-optcl))
-                            (concat TeX-grop file TeX-grcl))))))))
-             ((string= type "SaveVerbatim")
-              (TeX-auto-add-regexp `(,(concat "\\\\begin{"
-                                              env
-                                              "}"
-                                              
LaTeX-fancyvrb-key-val-skip-regexp
-                                              "{\\([^}]+\\)}")
-                                     1 LaTeX-auto-fancyvrb-saveverbatim)))
-             (t
-              ;; Regular verbatim environments have a starred
-              ;; version; so add them here; the non-starred additions
-              ;; to `LaTeX-verbatim-environments-local' and
-              ;; `LaTeX-indent-environment-list' are done outside
-              ;; (cond ...):
-              (LaTeX-add-environments
-               `(,env LaTeX-env-args
-                      [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local 
]))
-              (LaTeX-add-environments
-               `(,(concat env "*") LaTeX-env-args
-                 [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]))
-              (add-to-list 'LaTeX-verbatim-environments-local (concat env "*"))
-              (add-to-list 'LaTeX-indent-environment-list
-                           `(,(concat env "*") current-indentation) t)))
-       ;; These apply for all environments defined:
-       (add-to-list 'LaTeX-verbatim-environments-local env)
-       (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation) 
t)))
-    ;; Update font-lock:
-    (when (and (fboundp 'font-latex-add-keywords)
-              (fboundp 'font-latex-update-font-lock)
-              (eq TeX-install-font-lock 'font-latex-setup))
-      (font-latex-update-font-lock t))))
+       (LaTeX-add-fancyvrb-saveverbatims new-env))))
+  ;;
+  ;; Now run the procdure:
+  (dolist (elt (LaTeX-fancyvrb-environment-list))
+    (let ((env (car elt))
+         (type (cadr elt)))
+      (cond ((string= type "VerbatimOut")
+            (LaTeX-add-environments
+             `(,env (lambda (env)
+                      (let ((options (TeX-read-key-val
+                                      t LaTeX-fancyvrb-key-val-options-local))
+                            (file (TeX-read-string "Output file: ")))
+                        (LaTeX-insert-environment
+                         env
+                         (concat
+                          (unless (zerop (length options))
+                            (concat LaTeX-optop options LaTeX-optcl))
+                          (concat TeX-grop file TeX-grcl))))))))
+           ((string= type "SaveVerbatim")
+            (TeX-auto-add-regexp `(,(concat "\\\\begin{"
+                                            env
+                                            "}"
+                                            LaTeX-fancyvrb-key-val-skip-regexp
+                                            "{\\([^}]+\\)}")
+                                   1 LaTeX-auto-fancyvrb-saveverbatim)))
+           (t
+            ;; Regular verbatim environments have a starred
+            ;; version; so add them here; the non-starred additions
+            ;; to `LaTeX-verbatim-environments-local' and
+            ;; `LaTeX-indent-environment-list' are done outside
+            ;; (cond ...):
+            (LaTeX-add-environments
+             `(,env LaTeX-env-args
+                    [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]))
+            (LaTeX-add-environments
+             `(,(concat env "*") LaTeX-env-args
+               [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]))
+            (add-to-list 'LaTeX-verbatim-environments-local (concat env "*"))
+            (add-to-list 'LaTeX-indent-environment-list
+                         `(,(concat env "*") current-indentation) t)))
+      ;; These apply for all environments defined:
+      (add-to-list 'LaTeX-verbatim-environments-local env)
+      (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation) 
t)))
+  ;; Update font-lock:
+  (when (and (fboundp 'font-latex-add-keywords)
+            (fboundp 'font-latex-update-font-lock)
+            (eq TeX-install-font-lock 'font-latex-setup))
+    (font-latex-update-font-lock t)))
 
 (defun LaTeX-fancyvrb-arg-file-relative (optional)
   "Query and insert a file name relative to current master file.
@@ -380,6 +407,8 @@ If OPTIONAL is non-nil, insert the file name in brackets."
     "VerbatimFootnotes"
     ;; Improved verbatim commands
     '("Verb" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local] 
TeX-arg-verb)
+    ;; \Verb also has a starred version:
+    '("Verb*" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local] 
TeX-arg-verb)
     '("DefineShortVerb" (TeX-arg-eval
                         TeX-read-string
                         (TeX-argument-prompt optional nil "Character")
@@ -503,13 +532,14 @@ If OPTIONAL is non-nil, insert the file name in brackets."
    (add-to-list 'LaTeX-indent-environment-list '("SaveVerbatim" 
current-indentation) t)
    (add-to-list 'LaTeX-indent-environment-list '("VerbatimOut" 
current-indentation) t)
    (add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb")
+   (add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb*")
 
    ;; Fontification
    (when (and (fboundp 'font-latex-add-keywords)
              (fboundp 'font-latex-update-font-lock)
              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("CustomVerbatimCommand"       "{{{")
-                               ("RecustomVerbatimCommand"     "{{{")
+     (font-latex-add-keywords '(("CustomVerbatimCommand"       "|{\\{{")
+                               ("RecustomVerbatimCommand"     "|{\\{{")
                                ("DefineVerbatimEnvironment"   "{{{")
                                ("RecustomVerbatimEnvironment" "{{{")
                                ("DefineShortVerb"   "{")
@@ -520,8 +550,7 @@ If OPTIONAL is non-nil, insert the file name in brackets."
                                ("BVerbatimInput" "[{")
                                ("LVerbatimInput" "[{"))
                              'reference)
-     (font-latex-add-keywords '(("Verb" "[") ; The second argument should
-                                       ; actually be verbatim.
+     (font-latex-add-keywords '(("Verb" "*[") ; The second argument is 
verbatim.
                                ("SaveVerb"     "[{")
                                ("UseVerb"      "{")
                                ("UseVerbatim"  "{")
diff --git a/style/fbb.el b/style/fbb.el
index c195c57..62d6bd4 100644
--- a/style/fbb.el
+++ b/style/fbb.el
@@ -1,6 +1,6 @@
 ;;; fbb.el --- AUCTeX style for `fbb.sty' (v1.07)
 
-;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "fbb"
  (lambda ()
diff --git a/style/flashcards.el b/style/flashcards.el
index 6f26c15..4dab852 100644
--- a/style/flashcards.el
+++ b/style/flashcards.el
@@ -1,6 +1,6 @@
 ;;; flashcards.el --- AUCTeX style for the flashcards class.
 
-;; Copyright (C) 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "flashcards"
  (lambda ()
diff --git a/style/floatrow.el b/style/floatrow.el
index 4adc052..baad7cf 100644
--- a/style/floatrow.el
+++ b/style/floatrow.el
@@ -1,6 +1,6 @@
 ;;; floatrow.el --- AUCTeX style for `floatrow.sty' (v0.3b)
 
-;; Copyright (C) 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -58,13 +58,23 @@
 
 ;;; Code:
 
-;; Needed for compiling `cl-pushnew':
+;; Needed for compiling `cl-pushnew' & 
`LaTeX-check-insert-macro-default-style':
 (eval-when-compile
-  (require 'cl-lib))
+  (require 'cl-lib)
+  (require 'latex))
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function reftex-compile-variables
+                 "reftex"
+                 ())
+
 (defvar LaTeX-floatrow-key-val-options
   '(;; 3.1.1 Float Style
     ("style" ("plain" "plaintop" "Plaintop"
@@ -337,27 +347,33 @@ If OPTIONAL is non-nil, indicate optional argument during 
query."
   ;; `TeX-argument-insert':
   (let* ((TeX-arg-opening-brace "[")
         (TeX-arg-closing-brace "]")
-        (width (completing-read
-                (TeX-argument-prompt t nil "Width")
-                (mapcar (lambda (x) (concat TeX-esc (car x)))
-                        (LaTeX-length-list))))
-        (height (completing-read
-                 (TeX-argument-prompt t nil "Height")
-                (mapcar (lambda (x) (concat TeX-esc (car x)))
-                        (LaTeX-length-list))))
-        (vertpos (if (string= height "")
-                     ""
-                   (completing-read
-                    (TeX-argument-prompt t nil "Vertical alignment")
-                    '("t" "c" "b" "s")))))
-    (TeX-argument-insert width t)
+        (last-optional-rejected nil)
+        (width (LaTeX-check-insert-macro-default-style
+                (completing-read
+                 (TeX-argument-prompt t nil "Width")
+                 (mapcar (lambda (x) (concat TeX-esc (car x)))
+                         (LaTeX-length-list)))))
+        (last-optional-rejected (and width (string= width "")))
+        (height (LaTeX-check-insert-macro-default-style
+                 (completing-read
+                  (TeX-argument-prompt t nil "Height")
+                  (mapcar (lambda (x) (concat TeX-esc (car x)))
+                          (LaTeX-length-list)))))
+        (last-optional-rejected (and height (string= height "")))
+        (vertpos (LaTeX-check-insert-macro-default-style
+                  (if (string= height "")
+                      ""
+                    (completing-read
+                     (TeX-argument-prompt t nil "Vertical alignment")
+                     '("t" "c" "b" "s"))))))
+    (and width (TeX-argument-insert width t))
     ;; Insert an extra pair of brackets if only `height' is given,
     ;; otherwise it will become `width'
-    (when (and (string= width "")
+    (when (and width (string= width "")
               height (not (string= height "")))
       (insert "[]"))
-    (TeX-argument-insert height t)
-    (TeX-argument-insert vertpos t))
+    (and (TeX-argument-insert height t))
+    (and (TeX-argument-insert vertpos t)))
   ;; Now query for the (short-)caption.  Also check for the
   ;; float-type; if we're inside (sub)?floatrow*?, then check for the
   ;; next outer environment:
@@ -434,7 +450,7 @@ entries are available under \"rawfigure*?\" and 
\"rawtable*?\"."
   "Create raw floating ENV with floatrow.sty.
 Also insert the macro \"\\RawFloats\" when finished with user
 queries."
-  (let ((environment (TeX-replace-regexp-in-string "raw" "" env)))
+  (let ((environment (replace-regexp-in-string "raw" "" env)))
     (LaTeX-env-figure environment)
     (save-excursion
       ;; `LaTeX-find-matching-begin' will not work for us as we don't
diff --git a/style/fontaxes.el b/style/fontaxes.el
index 0db15e5..6524a5a 100644
--- a/style/fontaxes.el
+++ b/style/fontaxes.el
@@ -1,6 +1,6 @@
 ;;; fontaxes.el --- AUCTeX style for `fontaxes.sty' version v1.0d
 
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -34,6 +34,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "fontaxes"
  (lambda ()
diff --git a/style/fontspec.el b/style/fontspec.el
index 9446b72..03e5178 100644
--- a/style/fontspec.el
+++ b/style/fontspec.el
@@ -1,6 +1,6 @@
 ;;; fontspec.el --- AUCTeX style for `fontspec.sty' version 2.6a.
 
-;; Copyright (C) 2013, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2017, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -34,6 +34,14 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function LaTeX-color-definecolor-list "color" ())
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+
 (defvar LaTeX-fontspec-font-features
   '(;; 5 Font selection
     ("Extension" (".otf" ".ttf" ".ttc" ".dfont"))
diff --git a/style/footmisc.el b/style/footmisc.el
index dec612e..ebe80f8 100644
--- a/style/footmisc.el
+++ b/style/footmisc.el
@@ -1,6 +1,6 @@
 ;;; footmisc.el --- AUCTeX style for `footmisc.sty'
 
-;; Copyright (C) 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Created: 2011-04-08
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "footmisc"
  (lambda ()
diff --git a/style/fvextra.el b/style/fvextra.el
index 7f49d6c..e5f5d19 100644
--- a/style/fvextra.el
+++ b/style/fvextra.el
@@ -35,6 +35,11 @@
 (eval-when-compile
   (require 'cl-lib))
 
+(declare-function LaTeX-color-definecolor-list "color" ())
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+
+(defvar LaTeX-fancyvrb-key-val-options-local)
+
 (defvar LaTeX-fvextra-key-val-options
   '(;; 3 General options
     ("curlyquotes" ("true" "false"))
diff --git a/style/geometry.el b/style/geometry.el
index 7e59fe0..3022418 100644
--- a/style/geometry.el
+++ b/style/geometry.el
@@ -1,6 +1,6 @@
 ;;; geometry.el --- AUCTeX style for `geometry.sty' (v5.6)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-geometry-always-key-val-options
   '(("layout") ("layoutwidth") ("layoutheight") ("layoutsize")
     ("layouthoffset") ("layoutvoffset") ("layoutoffset") ("hscale")
@@ -137,7 +142,12 @@ package.")
                                ("newgeometry"   "{")
                                ("savegeometry"  "{")
                                ("loadgeometry"  "{"))
-                             'function)))
+                             'function))
+
+   ;; Option management
+   (if (and (LaTeX-provided-package-options-member "geometry" "dvipdfmx")
+           (not (eq TeX-engine 'xetex)))
+       (setq TeX-PDF-from-DVI "Dvipdfmx")))
  LaTeX-dialect)
 
 (defun LaTeX-geometry-package-options ()
diff --git a/style/german.el b/style/german.el
index 51a35fe..688e5bf 100644
--- a/style/german.el
+++ b/style/german.el
@@ -8,6 +8,15 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
+(declare-function font-latex-add-to-syntax-alist
+                 "font-latex"
+                 (list))
+
 (defvar LaTeX-german-mode-syntax-table
   (copy-syntax-table LaTeX-mode-syntax-table)
   "Syntax table used in LaTeX mode when using `german.sty'.")
diff --git a/style/gloss-italian.el b/style/gloss-italian.el
index c786bb4..dd3ec07 100644
--- a/style/gloss-italian.el
+++ b/style/gloss-italian.el
@@ -1,6 +1,6 @@
 ;;; gloss-italian.el --- Italian support for polyglossia package.
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,14 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
+(declare-function LaTeX-polyglossia-lang-option-member
+                 "polyglossia" (language option))
+
 (defvar TeX-language-it-hook nil
   "Hook run for Italian texts.")
 
diff --git a/style/graphics.el b/style/graphics.el
index a48e612..b74cd4d 100644
--- a/style/graphics.el
+++ b/style/graphics.el
@@ -2,11 +2,16 @@
 
 ;;; Code:
 
+;; Load "graphicx" explicitly to access `LaTeX-graphicx-package-options'
+;; before running style hook "graphics".  This is necessary to have
+;; support for completion of package options of "usepackage".
+(TeX-load-style "graphicx")
+(defvar LaTeX-graphics-package-options LaTeX-graphicx-package-options)
+
 (TeX-add-style-hook "graphics"
  (function
   (lambda ()
-    (TeX-run-style-hooks "graphicx")
-    (setq LaTeX-graphics-package-options LaTeX-graphicx-package-options)))
+    (TeX-run-style-hooks "graphicx")))
  LaTeX-dialect)
 
 ;;; graphics.el ends here.
diff --git a/style/graphicx.el b/style/graphicx.el
index bb89b13..c27cfac 100644
--- a/style/graphicx.el
+++ b/style/graphicx.el
@@ -1,6 +1,6 @@
 ;;; graphicx.el --- AUCTeX style file for graphicx.sty
 
-;; Copyright (C) 2000, 2004, 2005, 2014--2017 by Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2004, 2005, 2014--2018 by Free Software Foundation, Inc.
 
 ;; Author: Ryuichi Arafune <address@hidden>
 ;; Created: 1999/3/20
@@ -32,6 +32,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-graphicx-key-val-options
   '(("bb")
     ("bbllx")
@@ -198,14 +203,11 @@ Offers all graphic files found in the TeX search path.  
See
   "Read image file for \\includegraphics.
 
 Lists all graphic files in the master directory and its
-subdirectories and inserts the relative file name.  This option
-doesn't works with Emacs 21.3 or XEmacs.  See
+subdirectories and inserts the relative file name.  See
 `LaTeX-includegraphics-read-file' for more."
   (file-relative-name
    (read-file-name
     "Image file: " nil nil nil nil
-    ;; FIXME: Emacs 21.3 and XEmacs 21.4.15 don't have PREDICATE as the sixth
-    ;; argument (Emacs 21.3: five args; XEmacs 21.4.15: sixth is HISTORY).
     (lambda (fname)
       (or (file-directory-p fname)
          (string-match (LaTeX-includegraphics-extensions) fname))))
@@ -299,7 +301,12 @@ doesn't works with Emacs 21.3 or XEmacs.  See
      (font-latex-add-keywords '(("graphicspath"              "{")
                                ("DeclareGraphicsExtensions" "{")
                                ("DeclareGraphicsRule"       "{{{{"))
-                             'function)))
+                             'function))
+
+   ;; Option management
+   (if (and (LaTeX-provided-package-options-member "graphicx" "dvipdfmx")
+           (not (eq TeX-engine 'xetex)))
+       (setq TeX-PDF-from-DVI "Dvipdfmx")))
  LaTeX-dialect)
 
 (defvar LaTeX-graphicx-package-options
diff --git a/style/hologo.el b/style/hologo.el
index 1bcb816..61bcb4e 100644
--- a/style/hologo.el
+++ b/style/hologo.el
@@ -1,6 +1,6 @@
 ;;; hologo.el --- AUCTeX style for `hologo.sty' (v1.10)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-hologo-logo-names
   '("(La)TeX"
     "AmSLaTeX"
diff --git a/style/hyperref.el b/style/hyperref.el
index 87ab1d8..02d886e 100644
--- a/style/hyperref.el
+++ b/style/hyperref.el
@@ -1,6 +1,6 @@
 ;;; hyperref.el --- AUCTeX style for `hyperref.sty' v6.83m
 
-;; Copyright (C) 2008, 2013--2016 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2013--2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-hyperref-package-options-list
   '(;; See https://www.tug.org/applications/hyperref/manual.html#x1-40003
     ;; General options
@@ -221,6 +226,9 @@
    (TeX-add-symbols
     '("hypersetup" (TeX-arg-key-val LaTeX-hyperref-package-options-list))
     '("href" [ (TeX-arg-key-val LaTeX-hyperref-href-options) ] "URL" "Text")
+    ;; Completion for \url is provided via url.el.  Hence the entry in
+    ;; this style is commented:
+    ;; '("url" "URL" ignore)
     '("nolinkurl" t)
     '("hyperbaseurl" t)
     '("hyperimage" "Image URL" "Text")
@@ -267,11 +275,12 @@
    (LaTeX-add-environments
     '("Form"))
 
-   ;; Do not indent the content of the "Form"-env; it is odd if the whole
-   ;; document is indented.  Append to `LaTeX-indent-environment-list' in order
-   ;; not to override custom settings.
-   (make-local-variable 'LaTeX-indent-environment-list)
-   (add-to-list 'LaTeX-indent-environment-list '("Form" current-indentation) t)
+   ;; Do not indent the content of the "Form"-env; it is odd if the
+   ;; whole document is indented.  Append it to a local version of
+   ;; `LaTeX-document-regexp':
+   (unless (string-match-p "Form" LaTeX-document-regexp)
+     (set (make-local-variable 'LaTeX-document-regexp)
+         (concat LaTeX-document-regexp "\\|" "Form")))
 
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
@@ -305,6 +314,11 @@
      ;; For syntactic fontification, e.g. verbatim constructs.
      (font-latex-set-syntactic-keywords))
 
+   ;; Option management
+   (if (and (LaTeX-provided-package-options-member "hyperref" "dvipdfmx")
+            (not (eq TeX-engine 'xetex)))
+       (setq TeX-PDF-from-DVI "Dvipdfmx"))
+
    ;; Activate RefTeX reference style.
    (and LaTeX-reftex-ref-style-auto-activate
        (fboundp 'reftex-ref-style-activate)
diff --git a/style/icelandic.el b/style/icelandic.el
index 64507e1..b7efd3b 100644
--- a/style/icelandic.el
+++ b/style/icelandic.el
@@ -1,6 +1,6 @@
 ;;; icelandic.el --- AUCTeX style for the `icelandic' babel option.
 
-;; Copyright (C) 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
 (defvar LaTeX-icelandic-mode-syntax-table
   (copy-syntax-table LaTeX-mode-syntax-table)
   "Syntax table used in LaTeX mode when using `icelandic.sty'.")
diff --git a/style/ifluatex.el b/style/ifluatex.el
index 923b554..20d3c8d 100644
--- a/style/ifluatex.el
+++ b/style/ifluatex.el
@@ -1,6 +1,6 @@
 ;;; ifluatex.el --- AUCTeX style for `ifluatex.sty' version 1.3.
 
-;; Copyright (C) 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Davide G. M. Salvetti <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,7 +29,12 @@
 
 ;;; Code:
 
-(defun LaTeX-ifluatex-set-exit-mark (optional)
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defun LaTeX-ifluatex-set-exit-mark (_optional)
   "Discard OPTIONAL and set exit-mark to current point."
   (set-marker exit-mark (point)))
 
diff --git a/style/italian.el b/style/italian.el
index 6cb72fe..8a69c65 100644
--- a/style/italian.el
+++ b/style/italian.el
@@ -1,6 +1,6 @@
 ;;; italian.el --- Setup AUCTeX for editing Italian text.
 
-;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2018 Free Software Foundation, Inc.
 
 ;; Author: Davide G. M. Salvetti <address@hidden>
 ;; Maintainer: Davide G. M. Salvetti <address@hidden>
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
 (defvar TeX-language-it-hook nil
   "Hook run for Italian texts.")
 
diff --git a/style/jurabib.el b/style/jurabib.el
index b8fc87c..077af4a 100644
--- a/style/jurabib.el
+++ b/style/jurabib.el
@@ -1,6 +1,6 @@
 ;;; jurabib.el --- AUCTeX style for the `jurabib' package
 
-;; Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2007, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -35,6 +35,13 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defvar reftex-cite-format-builtin)
+
 (TeX-add-style-hook
  "jurabib"
  (lambda ()
diff --git a/style/kpfonts.el b/style/kpfonts.el
index 78bc9ab..2e8ffc3 100644
--- a/style/kpfonts.el
+++ b/style/kpfonts.el
@@ -1,6 +1,6 @@
 ;;; kpfonts.el --- AUCTeX style for `kpfonts.sty' version 3.31.
 
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 ;;; Kpfonts Minor Mode (heavily based on LaTeX Math Minor Mode code)
 
 (defconst LaTeX-kpfonts-default
diff --git a/style/letter.el b/style/letter.el
index a4a5b38..5757b06 100644
--- a/style/letter.el
+++ b/style/letter.el
@@ -1,6 +1,6 @@
 ;;; letter.el - Special code for letter style.
 
-;; Copyright (C) 1993, 2012, 2013, 2014  Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2012, 2013, 2014, 2018  Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Maintainer: address@hidden
@@ -25,6 +25,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-letter-class-options
   '("a4paper" "a5paper" "b5paper" "letterpaper" "legalpaper" "executivepaper"
     "landscape" "10pt" "11pt" "12pt" "oneside" "twoside" "draft" "final"
diff --git a/style/lettrine.el b/style/lettrine.el
index 111f7b3..9b3c60e 100644
--- a/style/lettrine.el
+++ b/style/lettrine.el
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-lettrine-key-val-options
   '(("lines")
     ("depth")
diff --git a/style/listings.el b/style/listings.el
index 44c7e6e..c488c51 100644
--- a/style/listings.el
+++ b/style/listings.el
@@ -36,6 +36,8 @@
 ;;
 ;; January 2017: Put label in opt. argument of environment.
 ;;
+;; October 2018: Extract label context for RefTeX.
+;;
 ;; FIXME: Please make me more sophisticated!
 
 ;;; Code:
@@ -44,6 +46,15 @@
 (eval-when-compile
   (require 'cl-lib))
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
 ;; The following are options taken from chapter 4 of the listings
 ;; manual (2007/02/22 Version 1.4).
 (defvar LaTeX-listings-key-val-options
@@ -264,7 +275,7 @@ from `listings' package.")
    "\\(?:\\[[^][]*"
      "\\(?:{[^}{]*"
        "\\(?:{[^}{]*"
-         "\\(?:{[^}{]*}[^}{]*\\)*"
+        "\\(?:{[^}{]*}[^}{]*\\)*"
        "}[^}{]*\\)*"
      "}[^][]*\\)*"
    "label[ \t]*=[ \t]*{\\([^}]+\\)}"
@@ -287,7 +298,7 @@ with user-defined values via the \"lstdefinestyle\" macro."
         (opts (assq-delete-all (car (assoc key temp)) temp)))
     (cl-pushnew (list key (TeX-delete-duplicate-strings
                           (mapcar #'car (LaTeX-listings-lstdefinestyle-list))))
-               opts :test #'equal)
+               opts :test #'equal)
     (setq LaTeX-listings-key-val-options-local
          (copy-alist opts))))
 
@@ -329,7 +340,9 @@ with user-defined values via the \"lstdefinestyle\" macro."
       ;; Tell RefTeX
       (when (fboundp 'reftex-add-label-environments)
        (reftex-add-label-environments
-        `((,env ?l "lst:" "~\\ref{%s}" nil (regexp "[Ll]isting")))))
+        `((,env ?l "lst:" "~\\ref{%s}"
+                LaTeX-listings-reftex-label-context-function
+                (regexp "[Ll]isting")))))
       ;; Fontification
       (when (and (fboundp 'font-latex-add-keywords)
                 (fboundp 'font-latex-update-font-lock)
@@ -345,6 +358,39 @@ with user-defined values via the \"lstdefinestyle\" macro."
 (add-hook 'TeX-auto-cleanup-hook #'LaTeX-listings-auto-cleanup t)
 (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
 
+(defun LaTeX-listings-reftex-label-context-function (env)
+  "Extract and return a context string for RefTeX.
+The context string is the value given to the caption key.  If no
+caption key is found, an error is issued."
+  (let* ((envstart (save-excursion
+                    (re-search-backward (concat "\\\\begin{" env "}")
+                                        nil t)))
+        (capt-key (save-excursion
+                    (re-search-backward "caption[ \t\n\r%]*=[ \t\n\r%]*"
+                                        envstart t)))
+        capt-start capt-end)
+    (if capt-key
+       (save-excursion
+         (goto-char capt-key)
+         (re-search-forward
+          "caption[ \t\n\r%]*=[ \t\n\r%]*" nil t)
+         (cond (;; Short caption inside [] is available, extract it only
+                (looking-at-p (regexp-quote (concat TeX-grop LaTeX-optop)))
+                (forward-char)
+                (setq capt-start (1+ (point)))
+                (setq capt-end (1- (progn (forward-sexp) (point)))))
+               ;; Extract the entire caption which is enclosed in braces
+               ((looking-at-p TeX-grop)
+                (setq capt-start (1+ (point)))
+                (setq capt-end (1- (progn (forward-sexp) (point)))))
+               ;; Extract everything to next comma ,
+               (t
+                (setq capt-start (point))
+                (setq capt-end (progn (skip-chars-forward "^,") (point)))))
+         ;; Return the extracted string
+         (buffer-substring-no-properties capt-start capt-end))
+      (error "No caption found"))))
+
 (TeX-add-style-hook
  "listings"
  (lambda ()
@@ -400,6 +446,16 @@ with user-defined values via the \"lstdefinestyle\" macro."
    (add-to-list 'LaTeX-verbatim-environments-local "lstlisting")
    (add-to-list 'LaTeX-verbatim-macros-with-delims-local "lstinline")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "lstinline")
+
+   ;; RefTeX support lstlistings environment via
+   ;; `reftex-label-alist-builtin'.  We add the same thing here only
+   ;; with our function as 5th element:
+   (when (fboundp 'reftex-add-label-environments)
+     (reftex-add-label-environments
+      '(("lstlisting" ?l "lst:" "~\\ref{%s}"
+        LaTeX-listings-reftex-label-context-function
+        (regexp "[Ll]isting")))))
+
    ;; Fontification
    (when (and (fboundp 'font-latex-add-keywords)
              (fboundp 'font-latex-update-font-lock)
diff --git a/style/longtable.el b/style/longtable.el
index 0231b7b..0c6b881 100644
--- a/style/longtable.el
+++ b/style/longtable.el
@@ -1,6 +1,6 @@
 ;;; longtable.el --- AUCTeX style for `longtable.sty'.
 
-;; Copyright (C) 2013--2017  Free Software Foundation, Inc.
+;; Copyright (C) 2013--2018  Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-longtable-skipping-regexp
   (regexp-opt '("[l]" "[r]" "[c]" ""))
   "Regexp matching between \\begin{longtable} and column specification.
diff --git a/style/ltxtable.el b/style/ltxtable.el
index 8924a52..233ffeb 100644
--- a/style/ltxtable.el
+++ b/style/ltxtable.el
@@ -1,6 +1,6 @@
 ;;; ltxtable.el --- AUCTeX style for `ltxtable.sty' (v0.2)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,15 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function reftex-compile-variables
+                 "reftex"
+                 ())
+
 (defvar LaTeX-ltxtable-file-regexp
   `(,(concat "\\\\LTXtable"
             "{\\(?:[^}]+\\)}"
diff --git a/style/luacode.el b/style/luacode.el
index 9d29c64..8632163 100644
--- a/style/luacode.el
+++ b/style/luacode.el
@@ -1,6 +1,6 @@
 ;;; luacode.el --- AUCTeX style for `luacode.sty' version 1.2a.
 
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "luacode"
  (lambda ()
diff --git a/style/marginnote.el b/style/marginnote.el
index 706182f..9d3410e 100644
--- a/style/marginnote.el
+++ b/style/marginnote.el
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "marginnote"
  (lambda ()
diff --git a/style/mathtools.el b/style/mathtools.el
index f36a13d..83bef3e 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, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2012, 2014, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Created: 2011-02-13
@@ -36,9 +36,16 @@
 
 ;;; Code:
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defvar LaTeX-amsmath-package-options)
+
 ;; amsmath options which can be passed directly to mathtools are
 ;; appended in the style hook below
 (defvar LaTeX-mathtools-package-options
@@ -47,6 +54,9 @@
     ;; via nonrobust package option)
     "nonrobust")
   "Package options for the mathtools package.")
+(TeX-load-style "amsmath")
+(dolist (elt LaTeX-amsmath-package-options)
+  (add-to-list 'LaTeX-mathtools-package-options elt))
 
 (defvar LaTeX-mathtools-key-val-options
   '(("showonlyrefs")
@@ -240,9 +250,6 @@ Put line break macro on the last line.  Next, insert an 
ampersand."
    ;; mathtools requires amsmath, as some bugs in amsmath are fixed
    (TeX-run-style-hooks "amsmath")
 
-   (dolist (elt LaTeX-amsmath-package-options)
-     (add-to-list 'LaTeX-mathtools-package-options elt))
-
    (LaTeX-add-environments
     ;; 3.4.1 Matrices
     '("matrix*"  [ "Vertical alignment (l, r or c (default))" ])
diff --git a/style/mdframed.el b/style/mdframed.el
index ed643da..ec5e73a 100644
--- a/style/mdframed.el
+++ b/style/mdframed.el
@@ -1,6 +1,6 @@
 ;;; mdframed.el --- AUCTeX style for `mdframed.sty' (v1.9b)
 
-;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -41,9 +41,17 @@
 (eval-when-compile
   (require 'cl-lib))
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function LaTeX-color-definecolor-list "color" ())
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+
 (defvar LaTeX-mdframed-key-val-options
   '(;; 6.2. Restoring the settings
     ("style" ("defaultoptions"))
diff --git a/style/mdwlist.el b/style/mdwlist.el
index af6c9b9..13245a2 100644
--- a/style/mdwlist.el
+++ b/style/mdwlist.el
@@ -1,6 +1,6 @@
 ;;; mdwlist.el --- AUCTeX style for `mdwlist.sty'
 
-;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: tex
@@ -28,6 +28,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "mdwlist"
  (lambda ()
diff --git a/style/menukeys.el b/style/menukeys.el
index 2ac0560..8134b7c 100644
--- a/style/menukeys.el
+++ b/style/menukeys.el
@@ -1,6 +1,6 @@
 ;;; menukeys.el --- AUCTeX style for `menukeys.sty' (v1.4)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,9 +31,16 @@
 
 ;;; Code:
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+
 (defvar LaTeX-menukeys-input-separators-list
   '("/" "=" "*" "+" "," ";" ":" "-" ">" "<" "bslash")
   "List of input separators for macros of menukeys package.")
diff --git a/style/metalogo.el b/style/metalogo.el
index 055347e..a5bb1f0 100644
--- a/style/metalogo.el
+++ b/style/metalogo.el
@@ -1,6 +1,6 @@
 ;;; metalogo.el --- AUCTeX style for `metalogo.sty' version 0.12.
 
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "metalogo"
  (lambda ()
diff --git a/style/mflogo.el b/style/mflogo.el
index 957e86d..1d4b96d 100644
--- a/style/mflogo.el
+++ b/style/mflogo.el
@@ -28,6 +28,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "mflogo"
  (lambda ()
diff --git a/style/minted.el b/style/minted.el
index 3340efc..24005c2 100644
--- a/style/minted.el
+++ b/style/minted.el
@@ -32,6 +32,22 @@
 
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
+(declare-function LaTeX-color-definecolor-list "color" ())
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+(declare-function LaTeX-add-newfloat-DeclareFloatingEnvironments
+                 "newfloat" (&rest newfloat-declarefloatingenvironments))
+
+(defvar font-latex-syntactic-keywords-extra)
+
 (defvar LaTeX-minted-key-val-options
   '(("autogobble" ("true" "false"))
     ("baselinestretch" ("auto"))
diff --git a/style/mn2e.el b/style/mn2e.el
index 0c6d9f6..14a449c 100644
--- a/style/mn2e.el
+++ b/style/mn2e.el
@@ -1,6 +1,6 @@
 ;;; mn2e.el --- AUCTeX style for `mn2e.cls' version 2.2.
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "mn2e"
  (lambda ()
diff --git a/style/mnras.el b/style/mnras.el
index 9f2ab33..e3abfc1 100644
--- a/style/mnras.el
+++ b/style/mnras.el
@@ -1,6 +1,6 @@
 ;;; mnras.el --- AUCTeX style for `mnras.cls' version 3.0.
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "mnras"
  (lambda ()
diff --git a/style/moodle.el b/style/moodle.el
index 92c623c..f13d891 100644
--- a/style/moodle.el
+++ b/style/moodle.el
@@ -1,6 +1,6 @@
 ;;; moodle.el --- AUCTeX style for `moodle.sty' (v0.5)
 
-;; Copyright (C) 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -35,6 +35,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-moodle-key-val-options
   '(("points")
     ("default grade")
diff --git a/style/multirow.el b/style/multirow.el
index d025e1f..771cea4 100644
--- a/style/multirow.el
+++ b/style/multirow.el
@@ -1,6 +1,6 @@
 ;;; multirow.el --- AUCTeX style for `multirow.sty'
 
-;; Copyright (C) 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "multirow"
  (lambda ()
diff --git a/style/nameref.el b/style/nameref.el
index 49e7202..8421b75 100644
--- a/style/nameref.el
+++ b/style/nameref.el
@@ -1,6 +1,6 @@
 ;;; nameref.el --- AUCTeX style for `nameref.sty'
 
-;; Copyright (C) 2013, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "nameref"
  (lambda ()
diff --git a/style/natbib.el b/style/natbib.el
index f0664fd..596c86d 100644
--- a/style/natbib.el
+++ b/style/natbib.el
@@ -1,6 +1,6 @@
 ;;; natbib.el --- AUCTeX style for `natbib.sty' version 8.31b
 
-;; Copyright (C) 1997, 1998, 2004, 2007, 2014, 2016 Free Software Foundation, 
Inc.
+;; Copyright (C) 1997, 1998, 2004, 2007, 2014--2018 Free Software Foundation, 
Inc.
 
 ;; Authors: Berwin Turlach <address@hidden>
 ;;          Carsten Dominik <address@hidden>
@@ -26,6 +26,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "natbib"
  (lambda ()
diff --git a/style/newfloat.el b/style/newfloat.el
index 5475577..9f88a2d 100644
--- a/style/newfloat.el
+++ b/style/newfloat.el
@@ -1,6 +1,6 @@
 ;;; newfloat.el --- AUCTeX style for `newfloat.sty' (v1.1-109)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -54,9 +54,14 @@
 
 ;;; Code:
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-newfloat-key-val-options
   '(("fileext")
     ("listname")
diff --git a/style/newpxtext.el b/style/newpxtext.el
index b571001..4112be9 100644
--- a/style/newpxtext.el
+++ b/style/newpxtext.el
@@ -1,6 +1,6 @@
 ;;; newpxtext.el --- AUCTeX style for `newpxtext.sty' (v1.232)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "newpxtext"
  (lambda ()
diff --git a/style/newtxtext.el b/style/newtxtext.el
index 16a860b..5f9c14f 100644
--- a/style/newtxtext.el
+++ b/style/newtxtext.el
@@ -1,6 +1,6 @@
 ;;; newtxtext.el --- AUCTeX style for `newtxtext.sty' (v1.434)
 
-;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "newtxtext"
  (lambda ()
diff --git a/style/newtxttt.el b/style/newtxttt.el
index 48362bc..1cfae90 100644
--- a/style/newtxttt.el
+++ b/style/newtxttt.el
@@ -1,6 +1,6 @@
 ;;; newtxtt.el --- AUCTeX style for `newtxtt.sty' (v1.05)
 
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "newtxtt"
  (lambda ()
diff --git a/style/ngerman.el b/style/ngerman.el
index 9c49ee6..814688a 100644
--- a/style/ngerman.el
+++ b/style/ngerman.el
@@ -8,6 +8,15 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
+(declare-function font-latex-add-to-syntax-alist
+                 "font-latex"
+                 (list))
+
 (defvar LaTeX-german-mode-syntax-table
   (copy-syntax-table LaTeX-mode-syntax-table)
   "Syntax table used in LaTeX mode when using `german.sty'.")
diff --git a/style/nicefrac.el b/style/nicefrac.el
index 3bd308e..4d68329 100644
--- a/style/nicefrac.el
+++ b/style/nicefrac.el
@@ -1,6 +1,6 @@
 ;;; nicefrac.el --- AUCTeX style for the LaTeX package `nicefrac.sty' (v0.9b)
 
-;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2018 Free Software Foundation, Inc.
 
 ;; Author: Christian Schlauer <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "nicefrac"
  (lambda ()
diff --git a/style/nomencl.el b/style/nomencl.el
index b22c054..b74405b 100644
--- a/style/nomencl.el
+++ b/style/nomencl.el
@@ -1,6 +1,6 @@
 ;;; nomencl.el --- AUCTeX style for the nomencl class.
 
-;; Copyright (C) 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-nomencl-package-options
   '("refeq" "norefeq" "refpage" "norefpage" "prefix" "noprefix" "cfg" "nocfg"
     "intoc" "notintoq" "compatible" "noncompatible" "croatian" "danish"
diff --git a/style/ntheorem.el b/style/ntheorem.el
index b7a4433..19e0dbf 100644
--- a/style/ntheorem.el
+++ b/style/ntheorem.el
@@ -1,6 +1,6 @@
 ;;; ntheorem.el --- AUCTeX style for `ntheorem.sty' (v1.33)
 
-;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -36,6 +36,19 @@
 
 ;;; Code
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function LaTeX-color-definecolor-list
+                 "color"
+                 ())
+
+(declare-function LaTeX-xcolor-definecolor-list
+                 "xcolor"
+                 ())
+
 (defvar LaTeX-ntheorem-theoremstyle-list
   '(("plain") ("break") ("change") ("changebreak") ("margin")
     ("marginbreak") ("nonumberplain") ("nonumberbreak") ("empty"))
diff --git a/style/ocg-p.el b/style/ocg-p.el
index 099a7f3..3ebd41e 100644
--- a/style/ocg-p.el
+++ b/style/ocg-p.el
@@ -34,6 +34,11 @@
 ;; Needed for auto-parsing.
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 ;; Setup for layer id's defined with
 ;; \begin{ocg}[<opt-arg>]{<layer name>}{<layer id>}{<initial visibility>}:
 
diff --git a/style/ocgx.el b/style/ocgx.el
index b6da24f..0e8d5c3 100644
--- a/style/ocgx.el
+++ b/style/ocgx.el
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "ocgx"
  (lambda ()
diff --git a/style/paracol.el b/style/paracol.el
index fdab8ba..308ac46 100644
--- a/style/paracol.el
+++ b/style/paracol.el
@@ -1,6 +1,6 @@
 ;;; paracol.el --- AUCTeX style for `paracol.sty' (v1.32)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -46,6 +46,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (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."
diff --git a/style/paralist.el b/style/paralist.el
index c9a7072..d25a9a6 100644
--- a/style/paralist.el
+++ b/style/paralist.el
@@ -1,6 +1,6 @@
 ;;; paralist.el -- AUCTeX style for paralist.sty
 
-;; Copyright (C) 2003-2005, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author:   Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 ;; Insert an itemize-ish environment and ask for an optional label
 (defun LaTeX-paralist-env-item-opt-label (environment)
   "Insert ENVIRONMENT, an optional label and the first item."
diff --git a/style/pdfpages.el b/style/pdfpages.el
index 6e7c8c3..f32441b 100644
--- a/style/pdfpages.el
+++ b/style/pdfpages.el
@@ -1,6 +1,6 @@
 ;;; pdfpages.el --- AUCTeX style for `pdfpages.sty' (v0.4v)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -33,6 +33,12 @@
 ;; `pdfpages.sty' in the first place.
 
 ;;; Code:
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-pdfpages-key-val-options
   '(;; Main options:
     ("pages" ("-"))
diff --git a/style/polski.el b/style/polski.el
index 5e51082..249d48c 100644
--- a/style/polski.el
+++ b/style/polski.el
@@ -1,6 +1,6 @@
 ;;; polski.el --- AUCTeX style for `polski.sty'.
 
-;; Copyright (C) 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
 (defvar LaTeX-polski-package-options
   '("plmath" "nomathsymbols" "MeX" "T1" "QX" "OT1" "OT4" "prefixinginverb"
     "noprefixinginverb" "roku" "r." "noroku")
diff --git a/style/polyglossia.el b/style/polyglossia.el
index 6e902a4..c9366d0 100644
--- a/style/polyglossia.el
+++ b/style/polyglossia.el
@@ -1,6 +1,6 @@
 ;;; polyglossia.el --- AUCTeX style for `polyglossia.sty' version 1.42.0.
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -37,6 +37,11 @@
 
 (require 'tex) ;Indispensable when compiling the call to `TeX-auto-add-type'.
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-auto-add-type "polyglossia-lang" "LaTeX")
 
 ;; Self Parsing -- see (info "(auctex)Hacking the Parser").
diff --git a/style/preview.el b/style/preview.el
index 26987e1..fb3c123 100644
--- a/style/preview.el
+++ b/style/preview.el
@@ -1,6 +1,6 @@
 ;;; preview.el --- AUCTeX style for `preview.sty' (v2010/02/14)
 
-;; Copyright (C) 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defun LaTeX-preview-arg-ifpreview (_optional)
   "Insert \\else and \\fi part of \\ifPreview command from preview.sty.
 OPTIONAL is ignored."
diff --git a/style/pst-grad.el b/style/pst-grad.el
index 1e74d8a..829e190 100644
--- a/style/pst-grad.el
+++ b/style/pst-grad.el
@@ -33,6 +33,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(defvar LaTeX-pst-fillstyle-list)
+(defvar LaTeX-pst-parameters-completion-regexp)
+(defvar LaTeX-pst-parameters-name-list)
+
 ;;; Parameters
 (defvar LaTeX-pstgrad-parameters-name-list
   '("gradangle" "gradbegin" "gradend" "gradlines" "gradmidpoint"
diff --git a/style/pst-node.el b/style/pst-node.el
index cc6b151..7b174cd 100644
--- a/style/pst-node.el
+++ b/style/pst-node.el
@@ -35,6 +35,17 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function LaTeX-package-parameter-value
+                 "pstricks" (param pname))
+(declare-function LaTeX-package-parameters-pref-and-chosen
+                 "pstricks" (param pname noskip))
+(declare-function LaTeX-package-parameters
+                 "pstricks" (optional pname preparam param))
+(declare-function LaTeX-pst-angle  "pstricks" ())
+(declare-function LaTeX-pst-point  "pstricks" ())
+(declare-function LaTeX-pst-arrows "pstricks" ())
+
 (defalias 'LaTeX-pst-node 'LaTeX-pst-point)
 
 (defvar LaTeX-pstnode-parameters-completion-regexp
diff --git a/style/pst-plot.el b/style/pst-plot.el
index 2d61d88..d4ddfe5 100644
--- a/style/pst-plot.el
+++ b/style/pst-plot.el
@@ -35,31 +35,14 @@
 
 ;;; Code:
 
-;; Self Parsing -- see (info "(auctex)Hacking the Parser")
-(defvar LaTeX-auto-pstplot-regexp-list
-  '(("\\\\\\(save\\|read\\)data{?\\(\\\\[a-zA-Z]+\\)}?"
-     2 LaTeX-auto-pstplot))
-  "List of regular expressions to extract arguments of \\*data
-  macros.")
-
-(defvar LaTeX-auto-pstplot nil
-  "Temporary for parsing \\*data definitions.")
-
-(defun LaTeX-pstplot-cleanup ()
-  "Move symbols from `LaTeX-auto-pstplot to `TeX-auto-symbol'."
-  (mapcar (lambda (symbol)
-            ;; (setq TeX-symbol-list (cons (list symbol 0) TeX-symbol-list))
-            ;; (setq TeX-auto-symbol (cons (list symbol 0) TeX-auto-symbol)))
-            (add-to-list 'LaTeX-pstplot-datasets symbol))
-            LaTeX-auto-pstplot))
-
-(defun LaTeX-pstplot-prepare ()
-  "Clear `LaTeX-auto-pstplot' before use."
-  (setq LaTeX-auto-pstplot nil))
+;; Silence the compiler:
+(declare-function LaTeX-pst-arrows "pstricks" ())
+(declare-function LaTeX-pst-point  "pstricks" ())
+(declare-function TeX-arg-compl-list
+                 "pstricks" (list &optional prompt hist))
 
-(add-hook 'TeX-auto-prepare-hook #'LaTeX-pstplot-prepare t)
-(add-hook 'TeX-auto-cleanup-hook #'LaTeX-pstplot-cleanup t)
-(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+(defvar LaTeX-pst-parameters-completion-regexp)
+(defvar LaTeX-pst-parameters-name-list)
 
 ;;; Parameters
 (defvar LaTeX-pstplot-datasets nil
@@ -85,6 +68,32 @@
 (defvar LaTeX-pst-axesstyle-list '(t "axes" "frame" "none")
   "A list of values for axesstyles in pst-plot.")
 
+;; Self Parsing -- see (info "(auctex)Hacking the Parser")
+(defvar LaTeX-auto-pstplot-regexp-list
+  '(("\\\\\\(save\\|read\\)data{?\\(\\\\[a-zA-Z]+\\)}?"
+     2 LaTeX-auto-pstplot))
+  "List of regular expressions to extract arguments of \\*data
+  macros.")
+
+(defvar LaTeX-auto-pstplot nil
+  "Temporary for parsing \\*data definitions.")
+
+(defun LaTeX-pstplot-cleanup ()
+  "Move symbols from `LaTeX-auto-pstplot' to `TeX-auto-symbol'."
+  (mapcar (lambda (symbol)
+            ;; (setq TeX-symbol-list (cons (list symbol 0) TeX-symbol-list))
+            ;; (setq TeX-auto-symbol (cons (list symbol 0) TeX-auto-symbol)))
+            (add-to-list 'LaTeX-pstplot-datasets symbol))
+            LaTeX-auto-pstplot))
+
+(defun LaTeX-pstplot-prepare ()
+  "Clear `LaTeX-auto-pstplot' before use."
+  (setq LaTeX-auto-pstplot nil))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-pstplot-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-pstplot-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
 ;;; Macros
 (defun LaTeX-pst-macro-psaxes (_optional &optional _arg)
   "Return \\psaxes arguments after querying."
diff --git a/style/pst-slpe.el b/style/pst-slpe.el
index a3f456f..6efed09 100644
--- a/style/pst-slpe.el
+++ b/style/pst-slpe.el
@@ -33,6 +33,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(defvar LaTeX-pst-fillstyle-list)
+(defvar LaTeX-pst-parameters-completion-regexp)
+(defvar LaTeX-pst-parameters-name-list)
+
 ;;; Parameters
 (defvar LaTeX-pstslpe-parameters-name-list
   '("slopeangle" "slopecenter" "slopecolors" "slopebegin" "slopeend"
diff --git a/style/pstricks.el b/style/pstricks.el
index 9762b68..33652f9 100644
--- a/style/pstricks.el
+++ b/style/pstricks.el
@@ -1,7 +1,6 @@
 ;;; pstricks.el --- AUCTeX style for the `pstricks' package.
 
-;; Copyright (C) 2007, 2009, 2013-2015,
-;;               2018  Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2009, 2013-2015, 2018  Free Software Foundation, Inc.
 
 ;; Author: Holger Sparr <address@hidden>
 ;; Maintainer: address@hidden
@@ -232,7 +231,7 @@ package PNAME"
 
 (defun LaTeX-pst-point-in-parens (_optional)
   "Enclose point in parentheses."
-  (LaTeX-pst-enclose-obj 'LaTeX-pst-point ?( ?)))
+  (LaTeX-pst-enclose-obj 'LaTeX-pst-point ?\( ?\)))
 
 ;;; Angles
 (defvar LaTeX-pst-angle-list (list "0")
@@ -720,7 +719,7 @@ comma separated list. Point has to be within the sexp to 
modify."
         (progn
           (re-search-backward "\\\\\\([a-zA-Z]\\)")
           (forward-word 1)
-          (insert-pair nil ?[ ?]))
+          (insert-pair nil ?\[ ?\]))
       (up-list 1)
       (backward-char 1)
       (save-excursion
diff --git a/style/pythontex.el b/style/pythontex.el
new file mode 100644
index 0000000..6aecb93
--- /dev/null
+++ b/style/pythontex.el
@@ -0,0 +1,570 @@
+;;; pythontex.el --- AUCTeX style for `pythontex.sty' (v0.16)
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <address@hidden>
+;; Maintainer: address@hidden
+;; Created: 2018-12-01
+;; 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 `pythontex.sty' v0.16 from
+;; 2017/07/20.  `pythontex.sty' is part of TeXLive.
+
+;;; Code:
+
+;; Silence the compiler:
+;; `LaTeX-fancyvrb-key-val-options-local' will be defined after
+;; loading `fvextra.el' which loads `fancyvrb.el' in return:
+(defvar LaTeX-fancyvrb-key-val-options-local)
+
+;; These are provided by `font-latex.el':
+(defvar font-latex-syntactic-keywords-extra)
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
+;; The next two are provided by `newfloat.el':
+(declare-function LaTeX-add-newfloat-DeclareFloatingEnvironments
+                 "newfloat"
+                 (&rest newfloat-declarefloatingenvironments))
+(declare-function LaTeX-newfloat-auto-cleanup
+                 "newfloat" ())
+
+;; Needed for auto-parsing:
+(require 'tex)
+
+(defvar LaTeX-pythontex-pygmentize-program (executable-find "pygmentize")
+  "Path to pygmentize executable.")
+
+(defvar LaTeX-pythontex-language-list nil
+  "List containing languages provided by pymentize program.")
+
+(defun LaTeX-pythontex-language-list (&rest _ignored)
+  "Return a list of languages provided by pymentize program.
+Update the variable `LaTeX-pythontex-language-list' if still nil."
+  (or LaTeX-pythontex-language-list
+      (when LaTeX-pythontex-pygmentize-program
+       (with-temp-buffer
+         (shell-command (concat LaTeX-pythontex-pygmentize-program " -L 
lexers")
+                        (current-buffer))
+         (goto-char (point-min))
+         (let (languages)
+           (while (re-search-forward "^\\*[[:space:]]\\([^:]+\\):" nil t)
+             (dolist (lang (split-string (match-string 1) "[[:space:],]" t))
+               (push lang languages)))
+           (setq LaTeX-pythontex-language-list languages))))))
+
+(defvar LaTeX-pythontex-package-options-list
+  `(("usefamily"         ("py" "sympy" "pylab" "rb" "ruby" "jl" "julia" 
"octave"))
+    ("gobble"            ("none" "auto"))
+    ("beta"              ("true" "false"))
+    ("runall"            ("true" "false"))
+    ("rerun"             ("never" "modified" "errors" "warnings" "always"))
+    ("hashdependencies"  ("true" "false"))
+    ("autoprint"         ("true" "false"))
+    ("autostdout"        ("true" "false"))
+    ("debug")
+    ("makestderr"        ("true" "false"))
+    ("stderrfilename"    ("full" "session" "genericfile" "genericscript"))
+    ("pyfuture"          ("none" "all" "default"))
+    ("pyconfuture"       ("none" "all" "default"))
+    ("upquote"           ("true" "false"))
+    ("fixlr"             ("true" "false"))
+    ("keeptemps"         ("all" "code" "none"))
+    ("prettyprinter"     ("pygments" "fancyvrb"))
+    ("prettyprintinline" ("true" "false"))
+    ("pygments"          ("true" "false"))
+    ("pyginline"         ("true" "false"))
+    ("pyglexer"          ,(LaTeX-pythontex-language-list))
+    ("pygopt"            ("style" "texcomments" "mathescape"))
+    ("fvextfile")
+    ("pyconbanner"       ("none" "standard" "default" "pyversion"))
+    ("pyconfilename"     ("stdin" "console"))
+    ("depythontex"       ("true" "false")))
+  "Package options for the pythontex package.")
+
+(defun LaTeX-pythontex-package-options ()
+  "Prompt for package options for the pythontex package."
+  (TeX-read-key-val t LaTeX-pythontex-package-options-list))
+
+(defvar LaTeX-pythontex-family-list
+  '("py" "sympy" "pylab" "rb" "ruby" "jl" "julia" "octave")
+  "List of language families provided by pythontex package.")
+
+(defun LaTeX-env-pythontex (environment)
+  "Insert ENVIRONMENT provided by pythontex package."
+  (let ((session (TeX-read-string
+                 (TeX-argument-prompt t nil "Session")))
+       (fvkeyval (TeX-read-key-val t LaTeX-fancyvrb-key-val-options-local)))
+    (LaTeX-insert-environment environment
+                             (concat
+                              (when (and session (not (string= session "")))
+                                (concat LaTeX-optop session LaTeX-optcl))
+                              ;; We need an extra pair of brackets
+                              ;; when no session is given but
+                              ;; key=vals are available
+                              (when (and session (string= session "")
+                                         fvkeyval (not (string= fvkeyval "")))
+                                (concat LaTeX-optop LaTeX-optcl))
+                              (when (and fvkeyval (not (string= fvkeyval "")))
+                                (concat LaTeX-optop fvkeyval LaTeX-optcl))))))
+
+;; Setup for \saveprintpythontex & \savestdoutpythontex &
+;; \savestderrpythontex
+(TeX-auto-add-type "pythontex-savecontent" "LaTeX")
+
+(defvar LaTeX-pythontex-savecontent-regexp
+  `(,(concat "\\\\"
+            (regexp-opt '("saveprintpythontex"
+                          "savestdoutpythontex"
+                          "savestderrpythontex")
+                        "\\(?:")
+            "{\\([^}]+\\)}")
+    1 LaTeX-auto-pythontex-savecontent)
+  "Matches the argument of \\save(print|stdout|stderr)pythontex macros.")
+
+;; Setup for \setpythontexlistingenv:
+(TeX-auto-add-type "pythontex-setpythontexlistingenv" "LaTeX")
+
+(defvar LaTeX-pythontex-setpythontexlistingenv-regexp
+  '("\\\\setpythontexlistingenv{\\([^}]+\\)}"
+    1 LaTeX-auto-pythontex-setpythontexlistingenv)
+  "Matches the argument of \\setpythontexlistingenv macro.")
+
+(defun LaTeX-pythontex-auto-prepare ()
+  "Clear various `LaTeX-auto-pythontex-*' before parsing."
+  (setq LaTeX-auto-pythontex-savecontent nil
+       LaTeX-auto-pythontex-setpythontexlistingenv nil))
+
+(defun LaTeX-pythontex-auto-cleanup ()
+  "Process the parsing results for \\setpythontexlistingenv macro."
+  ;; Use `LaTeX-add-newfloat-DeclareFloatingEnvironments' on parsed
+  ;; elements and then run `LaTeX-newfloat-auto-cleanup'.
+  (dolist (env (mapcar #'car (LaTeX-pythontex-setpythontexlistingenv-list)))
+    (LaTeX-add-newfloat-DeclareFloatingEnvironments `(,env "verbatim")))
+  (LaTeX-newfloat-auto-cleanup))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-pythontex-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-pythontex-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun LaTeX-pythontex-add-syntactic-keywords-extra (type macro)
+  "Add MACRO from pythontex.sty to `font-latex-syntactic-keywords-extra'.
+TYPE is one of the symbols `brace' or `delim' indicating how
+verbatim text is enclosed after the macro.  MACRO is a string or
+a list of strings."
+  (let ((syntax (if (eq type 'brace)
+                   '((1 "|") (2 "|"))
+                 '((1 "\"") (2 ".") (3 "\""))))
+       regexp)
+    (when (listp macro)
+      (setq macro (regexp-opt macro "\\(?:")))
+    (setq regexp `(,(concat
+                    ;; The backslash
+                    (regexp-quote TeX-esc)
+                    ;; Name of the macro(s)
+                    macro
+                    ;; The first mandatory argument is the lexer
+                    "\\(?:{[^}]+}\\)"
+                    ;; With 'brace, allow braced sub-groups otherwise
+                    ;; we stop matching too early.  With 'delim, copy
+                    ;; font-latex.el:
+                    (if (eq type 'brace)
+                        (concat "\\({\\)"
+                                  "\\(?:[^}{]*"
+                                    "\\(?:{[^}{]*"
+                                      "\\(?:{[^}{]*"
+                                        "\\(?:{[^}{]*}[^}{]*\\)*"
+                                      "}[^}{]*\\)*"
+                                    "}[^}{]*\\)*"
+                                  "\\)"
+                                "\\(}\\)")
+                      (concat
+                       ;; Opening delimiter
+                       "\\(address@hidden).*?"
+                       ;; Closing delimiter
+                       "\\(" (regexp-quote TeX-esc) "*\\)\\(\\1\\)")))))
+    (add-to-list 'font-latex-syntactic-keywords-extra (append regexp syntax))))
+
+(TeX-add-style-hook
+ "pythontex"
+ (lambda ()
+
+   ;; Load only the relevant style hooks within AUCTeX
+   (TeX-run-style-hooks "fvextra" "newfloat")
+
+   ;; Add pythontex to the parser:
+   (TeX-auto-add-regexp LaTeX-pythontex-savecontent-regexp)
+   (TeX-auto-add-regexp LaTeX-pythontex-setpythontexlistingenv-regexp)
+
+   ;; We need this for Filling:
+   (make-local-variable 'LaTeX-indent-environment-list)
+
+   ;; 4.2.4 Default families
+   (let* ((verb-macs '(;; python
+                      "py" "pyc" "pys" "pyv" "pyb"
+                      "pycon" "pyconc" "pyconv"
+                      ;; Python + pylab (matplotlib module)
+                      "pylab" "pylabc" "pylabs" "pylabv" "pylabb"
+                      "pylabcon" "pylabconc" "pylabconv"
+                      ;; Python + SymPy
+                      "sympy" "sympyc" "sympys" "sympyv" "sympyb"
+                      "sympycon" "sympyconc" "sympyconv"))
+         (verb-envs '(;;python
+                      "pycode" "pysub" "pyverbatim" "pyblock"
+                      "pyconsole" "pyconcode" "pyconverbatim"
+                      ;; Python + pylab (matplotlib module)
+                      "pylabcode" "pylabsub" "pylabverbatim" "pylabblock"
+                      "pylabconsole" "pylabconcode" "pylabconverbatim"
+                      ;; Python + SymPy
+                      "sympycode" "sympysub" "sympyverbatim" "sympyblock"
+                      "sympyconsole" "sympyconcode" "sympyconverbatim"))
+         (verb-envs-regexp (regexp-opt verb-envs "\\(?:")))
+     (apply #'TeX-add-symbols
+           (mapcar (lambda (mac)
+                     (list mac [ "Session" ] 'TeX-arg-verb-delim-or-brace))
+                   verb-macs))
+     (apply #'LaTeX-add-environments
+           (mapcar (lambda (env)
+                     (list env 'LaTeX-env-pythontex))
+                   verb-envs))
+     ;; Filling:
+     (dolist (mac verb-macs)
+       (add-to-list 'LaTeX-verbatim-macros-with-delims-local mac)
+       (add-to-list 'LaTeX-verbatim-macros-with-braces-local mac))
+     (dolist (env verb-envs)
+       (add-to-list 'LaTeX-indent-environment-list
+                   `(,env current-indentation) t))
+     ;; Fontification
+     (when (and (fboundp 'font-latex-add-keywords)
+               (fboundp 'font-latex-update-font-lock)
+               (boundp 'font-latex-syntactic-keywords-extra)
+               (eq TeX-install-font-lock 'font-latex-setup))
+       (font-latex-add-keywords (mapcar (lambda (mac)
+                                         (list mac "["))
+                                       verb-macs)
+                               'textual)
+       ;; We can't use the fontification provided when verbatim
+       ;; environments are added to
+       ;; `LaTeX-verbatim-environments-local' -- pythontex
+       ;; environments have 2 optional arguments and `font-latex.el'
+       ;; recognizes only 1 optional which breaks the fontification.
+       ;; We add the envs to `font-latex-syntactic-keywords-extra' and
+       ;; define a customized regexp to match 2 optional arguments.
+       (add-to-list 'font-latex-syntactic-keywords-extra
+                   `(,(concat
+                       "^[ \t]*\\\\begin *{\\(?:"
+                       verb-envs-regexp
+                       "\\)}"
+                       "[ \t]*\\(?:%.*\n[ \t]*\\)?"
+                       
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)\\{0,2\\}"
+                       "\\(\n\\|.\\)")
+                     (1 "|" t)))
+       (add-to-list 'font-latex-syntactic-keywords-extra
+                   `(,(concat "\\(\\\\\\)end *{\\(?:"
+                              verb-envs-regexp
+                              "\\)}")
+                     (1 "|" t))))
+     ;; Tell font-lock about the update.
+     (font-latex-update-font-lock t))
+
+   (TeX-add-symbols
+    ;; 4.2.5 Custom code
+    ;; pythontexcustomc[<position>]{<family>}{<code>}
+    '("pythontexcustomc"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Position")
+                    '("begin" "end") ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Family")
+                   LaTeX-pythontex-family-list)
+      t)
+
+    ;; 4.2.7 Formatting of typeset code
+    ;; \setpythontexfv[<family>]{<fancyvrb settings>}
+    '("setpythontexfv"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Family")
+                    LaTeX-pythontex-family-list ]
+      (TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local))
+
+    ;; \setpythontexprettyprinter[<family>]{<printer>}
+    '("setpythontexprettyprinter"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Family")
+                    (cons "auto" LaTeX-pythontex-family-list) ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Printer")
+                   '("text" "bw" "fancyvrb" "pygments")))
+
+    ;; \setpythontexpyglexer[<family>]{<pygments lexer>}
+    '("setpythontexpyglexer"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Family")
+                    LaTeX-pythontex-family-list ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Pygments lexer")
+                   (LaTeX-pythontex-language-list)))
+
+    ;; \setpythontexpygopt[<family>]{<pygments options>}
+    '("setpythontexpygopt"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Family")
+                    LaTeX-pythontex-family-list ]
+      (TeX-arg-key-val
+       (("style") ("texcomments") ("mathescape"))))
+
+    ;; 4.2.8 Access to printed content (stdout)
+    ;; \printpythontex[<mode>][<options>]
+    '("printpythontex"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Mode")
+                    '("raw" "verb" "verbatim") ]
+      [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ] )
+
+    ;; \stdoutpythontex[<mode>][<options>]
+    '("stdoutpythontex"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Mode")
+                    '("raw" "verb" "verbatim") ]
+      [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ] )
+
+    ;;\saveprintpythontex{<name>}
+    '("saveprintpythontex"
+      (TeX-arg-eval (lambda ()
+                     (let ((name (TeX-read-string
+                                  (TeX-argument-prompt optional nil "Name"))))
+                       (LaTeX-add-pythontex-savecontents name)
+                       (format "%s" name)))))
+
+    ;;\savestdoutpythontex{<name>}
+    '("savestdoutpythontex"
+      (TeX-arg-eval (lambda ()
+                     (let ((name (TeX-read-string
+                                  (TeX-argument-prompt optional nil "Name"))))
+                       (LaTeX-add-pythontex-savecontents name)
+                       (format "%s" name)))))
+
+    ;; \useprintpythontex[<verbatim options>][<fancyvrb options>]{<name>}
+    ;; I assume <verbatim options> is meant to be <mode>
+    '("useprintpythontex"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Mode")
+                    '("raw" "verb" "verbatim") ]
+      [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Name")
+                   (LaTeX-pythontex-savecontent-list)))
+
+    ;; \usestdoutpythontex[<verbatim options>][<fancyvrb options>]{<name>}
+    ;; I assume <verbatim options> is meant to be <mode>
+    '("usestdoutpythontex"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Mode")
+                    '("raw" "verb" "verbatim") ]
+      [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Name")
+                   (LaTeX-pythontex-savecontent-list)))
+
+    ;; \stderrpythontex[<mode>][<fancyvrb options>]
+    '("stderrpythontex"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Mode")
+                    '("raw" "verb" "verbatim") ]
+      [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ] )
+
+
+    ;;\savestderrpythontex{<name>}
+    '("savestderrpythontex"
+      (TeX-arg-eval (lambda ()
+                     (let ((name (TeX-read-string
+                                  (TeX-argument-prompt optional nil "Name"))))
+                       (LaTeX-add-pythontex-savecontents name)
+                       (format "%s" name)))))
+
+    ;; \usestderrpythontex[<mode>][<fancyvrb options>]{<name>}
+    '("usestderrpythontex"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Mode")
+                    '("raw" "verb" "verbatim") ]
+      [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Name")
+                   (LaTeX-pythontex-savecontent-list)))
+
+    ;;\setpythontexautoprint{<boolean>}
+    '("setpythontexautoprint"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Boolean value")
+                   '("true" "false")))
+
+    ;; \setpythontexautostdout{<boolean>}
+    '("setpythontexautostdout"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Boolean value")
+                   '("true" "false")))
+
+    ;; 4.3 Pygments commands and environments
+    ;; \pygment{<lexer>}<opening delim><code><closing delim>
+    '("pygment"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Lexer")
+                   (LaTeX-pythontex-language-list))
+      TeX-arg-verb-delim-or-brace)
+
+    ;; \inputpygments[<fancyvrb settings>]{<lexer>}{<external file>}
+    '("inputpygments"
+      [ TeX-arg-eval LaTeX-fancyvrb-key-val-options-local ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Lexer")
+                   (LaTeX-pythontex-language-list))
+      TeX-arg-file-name)
+
+    ;; \setpygmentsfv[<lexer>]{<fancyvrb settings>}
+    '("setpygmentsfv"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Lexer")
+                    (LaTeX-pythontex-language-list) ]
+      (TeX-arg-eval LaTeX-fancyvrb-key-val-options-local))
+
+    ;; \setpygmentspygopt[<lexer>]{<pygments options>}
+    '("setpygmentspygopt"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Lexer")
+                    (LaTeX-pythontex-language-list) ]
+      (TeX-arg-key-val
+       (("style") ("texcomments") ("mathescape"))))
+
+    ;; \setpygmentsprettyprinter{<printer>}
+    '("setpygmentsprettyprinter"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Printer")
+                   '("text" "bw" "fancyvrb" "pygments")))
+
+    ;; 4.5  Advanced PythonTeX usage
+    ;; \setpythontexcontext{<key-value pairs>}
+    '("setpythontexcontext" t)
+
+    ;; \restartpythontexsession{<counter value(s)>}
+    '("restartpythontexsession" t)
+
+    ;; \setpythontexoutputdir{<output directory>}
+    '("setpythontexoutputdir" t)
+
+    ;; \setpythontexworkingdir{<working directory>}
+    '("setpythontexworkingdir" t)
+
+    ;; 4.5  Advanced PythonTeX usage
+    '("setpythontexcontext" t)
+    '("restartpythontexsession" TeX-arg-counter)
+    '("setpythontexoutputdir" t)
+    '("setpythontexworkingdir" t) )
+
+   ;; 4.4.1 Listings float
+   ;; Only add it if not already defined somewhere else.
+   (unless (assoc-string "listing" (LaTeX-environment-list))
+     (LaTeX-add-newfloat-DeclareFloatingEnvironments
+      '("listing" "verbatim")))
+
+   ;; Cater for \setpythontexlistingenv:
+   (TeX-add-symbols
+    '("setpythontexlistingenv"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Listing environment 
name"))))
+          (LaTeX-add-newfloat-DeclareFloatingEnvironments `(,name "verbatim"))
+          (LaTeX-newfloat-auto-cleanup)
+          (format "%s" name))))))
+
+   (LaTeX-add-environments
+    ;; 4.2.5 Custom code
+    '("pythontexcustomcode" LaTeX-env-args
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Position")
+                    '("begin" "end") ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Family")
+                   LaTeX-pythontex-family-list))
+
+    ;; \begin{pygments}[<fancyvrb settings>]{<lexer>}
+    '("pygments" LaTeX-env-args
+      [ TeX-arg-eval LaTeX-fancyvrb-key-val-options-local ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Lexer")
+                   (LaTeX-pythontex-language-list))) )
+
+   ;; Filling
+   (add-to-list 'LaTeX-indent-environment-list
+               '("pythontexcustomcode" current-indentation) t)
+   (add-to-list 'LaTeX-indent-environment-list
+               '("pygments" current-indentation) t)
+   (add-to-list 'LaTeX-verbatim-environments-local "pythontexcustomcode")
+   (add-to-list 'LaTeX-verbatim-environments-local "pygments")
+
+   ;; Fontification
+   (when (and (fboundp 'font-latex-add-keywords)
+             (fboundp 'font-latex-update-font-lock)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("pythontexcustomc"         "[{{")
+                               ("setpythontexfv"           "[{")
+                               ("setpythontexprettyprinter" "[{")
+                               ("setpythontexpyglexer"     "[{")
+                               ("setpythontexpygopt"       "[{")
+                               ("printpythontex"           "[[")
+                               ("stdoutpythontex"          "[[")
+                               ("saveprintpythontex"       "{")
+                               ("savestdoutpythontex"      "{")
+                               ("useprintpythontex"        "[[{")
+                               ("usestdoutpythontex"       "[[{")
+                               ("stderrpythontex"          "[[")
+                               ("savestderrpythontex"      "{")
+                               ("usestderrpythontex"       "[[{")
+                               ("setpythontexautoprint"    "{")
+                               ("setpythontexautostdout"   "{")
+                               ("inputpygments"            "[{{")
+                               ("setpygmentsfv"            "[{")
+                               ("setpygmentspygopt"        "[{")
+                               ("setpygmentsprettyprinter" "{")
+                               ("setpythontexcontext"      "{")
+                               ("restartpythontexsession"  "{")
+                               ("setpythontexoutputdir"    "{")
+                               ("setpythontexworkingdir"   "{")
+                               ("setpythontexlistingenv"   "{")
+                               ("setpythontexcontext"      "{")
+                               ("restartpythontexsession"  "{")
+                               ("setpythontexoutputdir"    "{")
+                               ("setpythontexworkingdir"   "{"))
+                             'function)
+     (font-latex-add-keywords '(("pygment" "{"))
+                             'textual)
+     (LaTeX-pythontex-add-syntactic-keywords-extra 'brace "pygment")
+     (LaTeX-pythontex-add-syntactic-keywords-extra 'delim "pygment")
+     ;; Tell font-lock about the update.
+     (font-latex-update-font-lock t)))
+ LaTeX-dialect)
+
+;;; pythontex.el ends here
diff --git a/style/relsize.el b/style/relsize.el
index 0a47b01..131a152 100644
--- a/style/relsize.el
+++ b/style/relsize.el
@@ -1,6 +1,6 @@
 ;;; relsize.el --- AUCTeX style for `relsize.sty' version v4.1
 
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "relsize"
  (lambda ()
diff --git a/style/scrbase.el b/style/scrbase.el
index 169b6ec..e55d2bb 100644
--- a/style/scrbase.el
+++ b/style/scrbase.el
@@ -1,6 +1,6 @@
 ;;; scrbase.el --- AUCTeX style for the KOMA-Script bundle.
 
-;; Copyright (C) 2002, 2004, 2005, 2007, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2005, 2007, 2014, 2018 Free Software Foundation, 
Inc.
 
 ;; Author: Mark Trettin <address@hidden>
 ;; Created: 2002-09-26
@@ -31,6 +31,12 @@
 ;; You need this file since it's loaded from the class-styles.
 
 ;;; Code:
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook "scrbase"
   (lambda ()
     (TeX-add-symbols
diff --git a/style/scrbook.el b/style/scrbook.el
index d4e7152..2e10cf0 100644
--- a/style/scrbook.el
+++ b/style/scrbook.el
@@ -1,6 +1,6 @@
 ;;; scrbook.el --- AUCTeX style for scrbook.cls
 
-;; Copyright (C) 2002, 2005 Free Software Foundation
+;; Copyright (C) 2002, 2005, 2018 Free Software Foundation
 
 ;; Author: Mark Trettin <address@hidden>
 ;; Created: 2002-09-26
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook "scrbook"
   (lambda ()
     (LaTeX-largest-level-set "chapter")
diff --git a/style/scrlttr2.el b/style/scrlttr2.el
index e697316..28e3ea9 100644
--- a/style/scrlttr2.el
+++ b/style/scrlttr2.el
@@ -1,6 +1,6 @@
 ;;; scrlttr2.el --- AUCTeX style for scrlttr2.cls.
 
-;; Copyright (C) 2002, 2007, 2014 Free Software Foundation
+;; Copyright (C) 2002, 2007, 2014, 2018 Free Software Foundation
 
 ;; Author: Mark Trettin <address@hidden>
 ;; Created: 2002-10-26
@@ -37,6 +37,11 @@
 
 ;;; Code
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook "scrlttr2"
   (lambda ()
     (TeX-add-symbols
diff --git a/style/scrpage2.el b/style/scrpage2.el
index 34b8497..841a8c9 100644
--- a/style/scrpage2.el
+++ b/style/scrpage2.el
@@ -27,6 +27,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "scrpage2"
  (lambda ()
diff --git a/style/scrreprt.el b/style/scrreprt.el
index 636b14e..2507960 100644
--- a/style/scrreprt.el
+++ b/style/scrreprt.el
@@ -1,6 +1,6 @@
 ;;; scrreprt.el --- AUCTeX style for scrreprt.cls.
 
-;; Copyright (C) 2002, 2005 Free Software Foundation
+;; Copyright (C) 2002, 2005, 2018 Free Software Foundation
 
 ;; Author: Mark Trettin <address@hidden>
 ;; Created: 2002-09-26
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "scrreprt"
  (lambda ()
diff --git a/style/setspace.el b/style/setspace.el
index 206033e..4e32044 100644
--- a/style/setspace.el
+++ b/style/setspace.el
@@ -1,6 +1,6 @@
 ;;; setspace.el --- AUCTeX style for `setspace.sty'
 
-;; Copyright (C) 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Created: 2011-04-16
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "setspace"
  (lambda ()
diff --git a/style/shortvrb.el b/style/shortvrb.el
index 49143f3..b0d8be4 100644
--- a/style/shortvrb.el
+++ b/style/shortvrb.el
@@ -1,6 +1,6 @@
 ;;; shortvrb.el --- AUCTeX style for `shortvrb.sty'
 
-;; Copyright (C) 2009, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -41,6 +41,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-to-syntax-alist
+                 "font-latex"
+                 (list))
+
 (defcustom LaTeX-shortvrb-chars nil
   "List of characters toggling verbatim mode.
 When your document uses the shortvrb style and you have a
diff --git a/style/siunitx.el b/style/siunitx.el
index 9fad553..85fef14 100644
--- a/style/siunitx.el
+++ b/style/siunitx.el
@@ -1,6 +1,6 @@
 ;;; siunitx.el --- AUCTeX style for `siunitx.sty' version 2.5s.
 
-;; Copyright (C) 2012-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -31,6 +31,11 @@
 
 (require 'tex) ;Indispensable when compiling the call to `TeX-auto-add-type'.
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-auto-add-type "siunitx-unit" "LaTeX")
 
 ;; Self Parsing -- see (info "(auctex)Hacking the Parser").  
`\\(?:\\[.*\\]\\)?'
diff --git a/style/slovak.el b/style/slovak.el
index 3dc107e..dacf6c5 100644
--- a/style/slovak.el
+++ b/style/slovak.el
@@ -1,5 +1,10 @@
 ;;; slovak.el --- Setup AUCTeX for editing Slovak text.
 
+;; Silence the compiler:
+(declare-function font-latex-add-quotes
+                 "font-latex"
+                 (quotes))
+
 (TeX-add-style-hook
  "slovak"
  (lambda ()
diff --git a/style/sourcecodepro.el b/style/sourcecodepro.el
index 4dc0014..289906d 100644
--- a/style/sourcecodepro.el
+++ b/style/sourcecodepro.el
@@ -1,6 +1,6 @@
 ;;; sourcecodepro.el --- AUCTeX style for `sourcecodepro.sty' (v2.6)
 
-;; Copyright (C) 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "sourcecodepro"
  (lambda ()
diff --git a/style/splitidx.el b/style/splitidx.el
index 7af22f1..41141b9 100644
--- a/style/splitidx.el
+++ b/style/splitidx.el
@@ -1,6 +1,6 @@
 ;;; splitidx.el --- AUCTeX style for `splitidx.sty' (v1.2a)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -88,9 +88,14 @@
 
 ;;; Code:
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 ;; Setup parsing for \newindex:
 (TeX-auto-add-type "splitidx-newindex" "LaTeX" "splitidx-newindices")
 
diff --git a/style/subcaption.el b/style/subcaption.el
index f158f44..8bffa8a 100644
--- a/style/subcaption.el
+++ b/style/subcaption.el
@@ -1,6 +1,6 @@
 ;;; subcaption.el --- AUCTeX style for `subcaption.sty' (v1.1-100)
 
-;; Copyright (C) 2015--2017 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,14 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defvar LaTeX-caption-key-val-options-local)
+(defvar LaTeX-caption-key-val-options)
+
 (defvar LaTeX-subcaption-key-val-options
   '(("subrefformat" ("default" "empty" "simple" "brace" "parens")))
   "Key=value options for subcaption package.  This key takes the
diff --git a/style/subfigure.el b/style/subfigure.el
index 5d7525b..9d96655 100644
--- a/style/subfigure.el
+++ b/style/subfigure.el
@@ -1,6 +1,6 @@
 ;;; subfigure.el --- AUCTeX style file for subfigure.sty
 
-;; Copyright (C) 2003, 2005, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2005, 2013, 2018 Free Software Foundation, Inc.
 
 ;; Author: Reiner Steib  <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "subfigure"
  (lambda ()
diff --git a/style/subfiles.el b/style/subfiles.el
index 4900a38..4937bc4 100644
--- a/style/subfiles.el
+++ b/style/subfiles.el
@@ -1,6 +1,6 @@
 ;;; subfiles.el --- AUCTeX style for the subfiles package.
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Uwe Brauer <address@hidden>
 ;; Created: 07 Nov 2016
@@ -33,6 +33,15 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function reftex-compile-variables
+                 "reftex"
+                 ())
+
 (defvar LaTeX-subfiles-package-options nil
   "Package options for the subfiles package.")
 
diff --git a/style/tcolorbox.el b/style/tcolorbox.el
index b8e6512..d8e9ffb 100644
--- a/style/tcolorbox.el
+++ b/style/tcolorbox.el
@@ -1,6 +1,6 @@
 ;;; tcolorbox.el --- AUCTeX style for `tcolorbox.sty' (v4.00)
 
-;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Tassilo Horn <address@hidden>
 ;; Maintainer: address@hidden
@@ -44,9 +44,16 @@
 (eval-when-compile
   (require 'cl-lib))
 
-;; Needed for auto-parsing.
+;; Needed for auto-parsing:
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+
 ;; FIXME: Anything missing?
 (defvar LaTeX-tcolorbox-keyval-options
   '(;; 4.1 Title
@@ -454,7 +461,7 @@ e.g. \"tcolorboxlib-raster.el\"."
   (when (LaTeX-tcolorbox-tcbuselibrary-list)
     (let (libs)
       (dolist (x (LaTeX-tcolorbox-tcbuselibrary-list))
-       (push (TeX-replace-regexp-in-string "[ %\n\r\t]" "" (car x)) libs))
+       (push (replace-regexp-in-string "[ %\n\r\t]" "" (car x)) libs))
       (setq libs (mapconcat #'identity libs ","))
       (dolist (x (split-string libs "," t))
        (TeX-run-style-hooks (concat "tcolorboxlib-" x)))))
diff --git a/style/tcolorboxlib-raster.el b/style/tcolorboxlib-raster.el
index 822e267..8d0ab79 100644
--- a/style/tcolorboxlib-raster.el
+++ b/style/tcolorboxlib-raster.el
@@ -1,6 +1,6 @@
 ;;; tcolorboxlib-raster.el --- AUCTeX style for `raster' library from tcolorbox
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,14 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defvar LaTeX-tcolorbox-keyval-options-local)
+(defvar LaTeX-tcolorbox-keyval-options-full)
+
 (defvar LaTeX-tcolorbox-lib-raster-keyval-options
   '(;; 14.3 Option Keys of the Library
     ("raster columns")
diff --git a/style/textpos.el b/style/textpos.el
index 437ca5a..86f9728 100644
--- a/style/textpos.el
+++ b/style/textpos.el
@@ -31,6 +31,10 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function LaTeX-color-definecolor-list "color" ())
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+
 (defun LaTeX-env-arg-textpos-textblock (env)
   "Query for the arguments of `textblock' environment and insert
 them."
diff --git a/style/theorem.el b/style/theorem.el
index f6ce86d..7b595e5 100644
--- a/style/theorem.el
+++ b/style/theorem.el
@@ -1,6 +1,6 @@
 ;;; theorem.el --- AUCTeX style for `theorem.sty' (v2.2c)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -36,6 +36,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-theorem-theoremstyle-list
   '(("plain") ("break") ("margin") ("change")
     ("marginbreak") ("changebreak"))
diff --git a/style/thm-restate.el b/style/thm-restate.el
index 595a582..2176515 100644
--- a/style/thm-restate.el
+++ b/style/thm-restate.el
@@ -35,6 +35,10 @@
 ;; Needed for auto-parsing.
 (require 'tex)
 
+;; Silence the parser:
+(declare-function LaTeX-thmtools-declaretheorem-list
+                 "thmtools" ())
+
 ;; Setup for macro names defined with
 ;; \begin{restatable}[<Heading>]{<env-name>}{<macro name>}:
 
diff --git a/style/thmtools.el b/style/thmtools.el
index 9c3b51c..b344c62 100644
--- a/style/thmtools.el
+++ b/style/thmtools.el
@@ -31,7 +31,12 @@
 
 ;;; Code:
 
-;; Needed for auto-parsing.
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+;; Needed for auto-parsing:
 (require 'tex)
 
 ;; Setup for \declaretheoremstyle:
diff --git a/style/titleps.el b/style/titleps.el
index 19a3d92..5580fbb 100644
--- a/style/titleps.el
+++ b/style/titleps.el
@@ -1,6 +1,6 @@
 ;;; titleps.el --- AUCTeX style for `titleps.sty' (v1.1.1)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-titleps-section-command-list
   '("part"
     "chapter"
diff --git a/style/titlesec.el b/style/titlesec.el
index d723970..519ce4e 100644
--- a/style/titlesec.el
+++ b/style/titlesec.el
@@ -1,6 +1,6 @@
 ;;; titlesec.el --- AUCTeX style for `titlesec.sty' (v2.10.0)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-titlesec-key-val-options
   '(("page" ("even" "odd"))
     ("numberless"))
diff --git a/style/titletoc.el b/style/titletoc.el
index 25a06c4..454fc9a 100644
--- a/style/titletoc.el
+++ b/style/titletoc.el
@@ -1,6 +1,6 @@
 ;;; titletoc.el --- AUCTeX style for `titletoc.sty' (v1.6)
 
-;; Copyright (C) 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-titletoc-section-command-list
   '("part"
     "chapter"
diff --git a/style/transparent.el b/style/transparent.el
index a345924..309eb01 100644
--- a/style/transparent.el
+++ b/style/transparent.el
@@ -1,6 +1,6 @@
 ;;; transparent.el --- AUCTeX style for `transparent.sty' (v1.0)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "transparent"
  (lambda ()
diff --git a/style/ulem.el b/style/ulem.el
index c3b3491..77bf1d3 100644
--- a/style/ulem.el
+++ b/style/ulem.el
@@ -1,6 +1,6 @@
 ;;; ulem.el --- AUCTeX style for `ulem.sty'
 
-;; Copyright (C) 2012 Free Software Foundation, Inc.
+;; Copyright (C) 2012, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Keywords: tex
@@ -28,6 +28,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "ulem"
  (lambda ()
diff --git a/style/unicode-math.el b/style/unicode-math.el
index d7ed089..395e137 100644
--- a/style/unicode-math.el
+++ b/style/unicode-math.el
@@ -1,6 +1,6 @@
 ;;; unicode-math.el --- AUCTeX style for `unicode-math.sty' version 0.7e.
 
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-unicode-math-package-options-list
   '(("math-style" ("ISO" "TeX" "french" "upright" "literal"))
     ("bold-style" ("ISO" "TeX" "upright" "literal"))
diff --git a/style/units.el b/style/units.el
index 8320e52..f174453 100644
--- a/style/units.el
+++ b/style/units.el
@@ -1,6 +1,6 @@
 ;;; units.el --- AUCTeX style for the LaTeX package `units.sty' (v0.9b)
 
-;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2018 Free Software Foundation, Inc.
 
 ;; Author: Christian Schlauer <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "units"
  (lambda ()
diff --git a/style/url.el b/style/url.el
index 0f4bb25..1f856af 100644
--- a/style/url.el
+++ b/style/url.el
@@ -30,6 +30,15 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(declare-function font-latex-update-font-lock
+                 "font-latex"
+                 (&optional syntactic-kws))
+
 (TeX-add-style-hook
  "url"
  (lambda ()
@@ -47,12 +56,20 @@
     "UrlRight"
     "UrlSpecials"
     '("path" (TeX-arg-verb-delim-or-brace "Path"))
-    '("url" (TeX-arg-verb-delim-or-brace "Url"))
+    ;; "hyperref" redefines \url so that the argument is only in
+    ;; braces.  We check here if hyperref is loaded:
+    '("url" (TeX-arg-conditional (member "hyperref" (TeX-style-list))
+                                ("Url")
+                              ((TeX-arg-verb-delim-or-brace "Url"))))
     "urldef"
     '("urlstyle" TeX-arg-urlstyle))
 
    (add-to-list 'LaTeX-verbatim-macros-with-delims-local "path")
-   (add-to-list 'LaTeX-verbatim-macros-with-delims-local "url")
+   ;; hyperref.el has some code to remove "url" from
+   ;; `LaTeX-verbatim-macros-with-delims-local', but we check here as
+   ;; well if "hyperref" is already loaded:
+   (unless (member "hyperref" (TeX-style-list))
+     (add-to-list 'LaTeX-verbatim-macros-with-delims-local "url"))
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "path")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "url")
 
diff --git a/style/varioref.el b/style/varioref.el
index 1d87507..ce840e7 100644
--- a/style/varioref.el
+++ b/style/varioref.el
@@ -1,6 +1,6 @@
 ;;; varioref.el --- AUCTeX style file with support for varioref.sty
 
-;; Copyright (C) 1999, 2013, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2013, 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;;         Mads Jensen <address@hidden>
@@ -25,6 +25,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook "varioref"
    (lambda ()
 
diff --git a/style/vwcol.el b/style/vwcol.el
index 7fbc10d..c85e815 100644
--- a/style/vwcol.el
+++ b/style/vwcol.el
@@ -1,6 +1,6 @@
 ;;; vwcol.el --- AUCTeX style for `vwcol.sty' (v0.2)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-vwcol-key-val-options
   '(("widths")
     ("sep"       ("fill"))
diff --git a/style/xcolor.el b/style/xcolor.el
index 771bcff..db820c7 100644
--- a/style/xcolor.el
+++ b/style/xcolor.el
@@ -1,6 +1,6 @@
 ;; xcolor.el --- AUCTeX style for `xcolor.sty' (v2.12)
 
-;; Copyright (C) 2016--2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -44,6 +44,14 @@
 
 ;;; Code:
 
+(eval-when-compile
+  (require 'latex))
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-xcolor-core-color-models
   '("rgb" "cmy" "cmyk" "hsb" "gray")
   "List of core color models provided by xcolor.sty.")
@@ -264,7 +272,7 @@ xcolor package.")
     (let ((head (car colset))
          (tail (cadr colset))
          (cols (split-string
-                (TeX-replace-regexp-in-string "[ %\n\r\t]" "" (nth 2 colset))
+                (replace-regexp-in-string "[ %\n\r\t]" "" (nth 2 colset))
                 "\\(,[^;]+;\\|,[^;]+$\\)" t)))
       (dolist (color cols)
        (LaTeX-add-xcolor-definecolors (concat head color tail))))))
@@ -274,12 +282,13 @@ xcolor package.")
 (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
 
 (defun TeX-arg-xcolor-definecolor (optional)
-  "Insert arguments of \\definecolor and similar macros from
-xcolor.sty."
+  "Insert arguments of \\definecolor and similar macros from xcolor.sty."
   ;; \definecolor[<type>]{<name>}{<model-list>}{<spec-list>}
-  (let* ((xcoltype  (completing-read
-                    (TeX-argument-prompt t nil "Type")
-                    LaTeX-xcolor-type-color-models))
+  (let* ((last-optional-rejected nil)
+        (xcoltype  (LaTeX-check-insert-macro-default-style
+                    (completing-read
+                     (TeX-argument-prompt t nil "Type")
+                     LaTeX-xcolor-type-color-models)))
         (xcolname  (TeX-read-string
                     (TeX-argument-prompt optional nil "Color name")))
         (xcolmodel (completing-read
@@ -301,14 +310,15 @@ xcolor.sty."
     (TeX-argument-insert xcolspec optional)))
 
 (defun TeX-arg-xcolor-definecolorset (optional)
-  "Insert arguments of \\definecolorset and similar macros from
-xcolor.sty."
-  (let ((xcoltype (completing-read
-                  (TeX-argument-prompt t nil "Type")
-                  LaTeX-xcolor-type-color-models))
-       (xcolmodel (completing-read
-                   (TeX-argument-prompt optional nil "Model")
-                   (LaTeX-xcolor-color-models t))))
+  "Insert arguments of \\definecolorset and similar macros from xcolor.sty."
+  (let* ((last-optional-rejected nil)
+        (xcoltype (LaTeX-check-insert-macro-default-style
+                   (completing-read
+                    (TeX-argument-prompt t nil "Type")
+                    LaTeX-xcolor-type-color-models)))
+        (xcolmodel (completing-read
+                    (TeX-argument-prompt optional nil "Model")
+                    (LaTeX-xcolor-color-models t))))
     (when (and xcoltype (not (string= xcoltype "")))
       (insert (format "[%s]" xcoltype)))
     (TeX-argument-insert xcolmodel optional)))
@@ -316,9 +326,11 @@ xcolor.sty."
 (defun TeX-arg-xcolor (optional)
   "Insert arguments of various color commands from xcolor.sty."
   ;; \color{<name>} or \color[<model-list>]{<spec-list>}
-  (let* ((xcolmodel (completing-read
-                    (TeX-argument-prompt t nil "Model (list)")
-                    (LaTeX-xcolor-color-models t)))
+  (let* ((last-optional-rejected nil)
+        (xcolmodel (LaTeX-check-insert-macro-default-style
+                    (completing-read
+                     (TeX-argument-prompt t nil "Model (list)")
+                     (LaTeX-xcolor-color-models t))))
         (xcolor (if (and xcolmodel (not (string= xcolmodel "")))
                     (TeX-read-string
                      (TeX-argument-prompt optional nil (concat xcolmodel " 
spec (list)")))
@@ -332,21 +344,29 @@ xcolor.sty."
 (defun TeX-arg-xcolor-fcolorbox (optional)
   "Insert arguments of \\fcolorbox from xcolor.sty."
   ;;\fcolorbox[<frame model>]{<frame spec>}[<background model>]{<background 
spec>}{<text>}
-  (let* ((xfrmodel (completing-read
-                   (TeX-argument-prompt t nil "(Frame) Color model")
-                   LaTeX-xcolor-color-models))
-        (xfrspec  (if (or (string= xfrmodel "")
+  (let* ((last-optional-rejected nil)
+        (xfrmodel (LaTeX-check-insert-macro-default-style
+                   (completing-read
+                    (TeX-argument-prompt t nil "(Frame) Color model")
+                    LaTeX-xcolor-color-models)))
+        ;; Set `last-optional-rejected' acc. to `xfrmodel'
+        (last-optional-rejected (and xfrmodel (string= xfrmodel "")))
+        (xfrspec  (if (or (null xfrmodel)
+                          (string= xfrmodel "")
                           (string= xfrmodel "named"))
                       (completing-read
                        (TeX-argument-prompt optional nil "Frame color spec")
                        (LaTeX-xcolor-definecolor-list))
                     (TeX-read-string
                      (TeX-argument-prompt optional nil "Frame color spec"))))
-        (xbgmodel (completing-read
-                   (TeX-argument-prompt t nil "Background Color model")
-                   LaTeX-xcolor-color-models))
-        (xbgspec  (if (or (string= xfrmodel "")
+        (xbgmodel (LaTeX-check-insert-macro-default-style
+                   (completing-read
+                    (TeX-argument-prompt t nil "Background Color model")
+                    LaTeX-xcolor-color-models)))
+        (xbgspec  (if (or (null xfrmodel)
+                          (string= xfrmodel "")
                           (string= xfrmodel "named")
+                          (null xbgmodel)
                           (string= xbgmodel "")
                           (string= xbgmodel "named"))
                       (completing-read
@@ -361,7 +381,6 @@ xcolor.sty."
       (insert (format "[%s]" xbgmodel)))
     (TeX-argument-insert xbgspec optional)))
 
-
 (TeX-add-style-hook
  "xcolor"
  (lambda ()
diff --git a/style/xparse.el b/style/xparse.el
index d75f81c..a65f2d1 100644
--- a/style/xparse.el
+++ b/style/xparse.el
@@ -1,6 +1,6 @@
 ;;; xparse.el --- AUCTeX style for `xparse.sty' version 4467.
 
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (defvar LaTeX-xparse-macro-regexp
   (concat "\\\\\\(?:Declare\\|New\\|Renew\\|Provide\\|DeclareExpandable\\)"
          "DocumentCommand[ \t\n\r]*{?[ \t\n\r]*\\\\\\([A-Za-z]+\\)[ \t\n\r]*}?"
diff --git a/style/xspace.el b/style/xspace.el
index dda6238..86c1e46 100644
--- a/style/xspace.el
+++ b/style/xspace.el
@@ -1,6 +1,6 @@
 ;;; xspace.el --- AUCTeX style for `xspace.sty'
 
-;; Copyright (C) 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2018 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "xspace"
  (lambda ()
diff --git a/style/zlmtt.el b/style/zlmtt.el
index 7d6d019..2b075cf 100644
--- a/style/zlmtt.el
+++ b/style/zlmtt.el
@@ -1,6 +1,6 @@
 ;;; zlmtt.el --- AUCTeX style for `zlmtt.sty' (v1.01)
 
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -31,6 +31,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
 (TeX-add-style-hook
  "zlmtt"
  (lambda ()
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index b3a22c5..b198eae 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -1,6 +1,6 @@
 ;;; latex-test.el --- tests for LaTeX mode
 
-;; Copyright (C) 2014--2017 Free Software Foundation, Inc.
+;; Copyright (C) 2014--2018 Free Software Foundation, Inc.
 
 ;; This file is part of AUCTeX.
 
@@ -257,4 +257,67 @@ backend=biber % here is a comment
        (equal (sort (LaTeX-includegraphics-extensions-list) #'string<)
              (sort '("eps" "jpe?g" "pdf" "png") #'string<))))))
 
+(ert-deftest LaTeX-style-hook-with-class-option ()
+  "Check style hooks associated with class option are processed."
+  (with-temp-buffer
+    (let ((TeX-parse-self t))
+      ;; test for dvips option
+      ;; This depends on the following code in latex.el:
+      ;; (TeX-add-style-hook "dvips"
+      ;;                     (lambda ()
+      ;;                       (setq TeX-PDF-from-DVI "Dvips"))
+      ;;                     :classopt)
+      (insert "\\documentclass[dvips]{article}\n")
+      (latex-mode)
+      (TeX-update-style)
+      (should (equal (TeX-PDF-from-DVI) "Dvips"))
+      (should (not (member "dvips" TeX-active-styles)))
+
+      ;; test for dvipdfmx option
+      (erase-buffer)
+      ;; This depends on the following code in latex.el:
+      ;; (TeX-add-style-hook "dvipdfmx"
+      ;;                     (lambda ()
+      ;;                       (TeX-PDF-mode-on)
+      ;;                       ;; XeLaTeX normally don't use dvipdfmx
+      ;;                       ;; explicitly.
+      ;;                       (unless (eq TeX-engine 'xetex)
+      ;;                         (setq TeX-PDF-from-DVI "Dvipdfmx")))
+      ;;                     :classopt)
+      (insert "\\documentclass[dvipdfmx]{article}\n")
+      (latex-mode)
+      (TeX-update-style)
+      (should TeX-PDF-mode)
+      (should (equal (TeX-PDF-from-DVI) "Dvipdfmx"))
+      (should (not (member "dvipdfmx" TeX-active-styles)))
+
+      ;; dvipdfmx option should not trigger `TeX-PDF-from-DVI' for
+      ;; XeLaTeX document
+      (latex-mode)
+      (let ((TeX-engine 'xetex))
+       (TeX-update-style))
+      (should TeX-PDF-mode)
+      (should (not (TeX-PDF-from-DVI)))
+      (should (not (member "dvipdfmx" TeX-active-styles)))
+
+      ;; test for pdftricks option
+      (erase-buffer)
+      ;; This depends on the following code in latex.el:
+      ;; (TeX-add-style-hook "pdftricks" #'TeX-PDF-mode-on :classopt)
+      (insert "\\documentclass[pdftricks]{article}\n")
+      (latex-mode)
+      (TeX-update-style)
+      (should TeX-PDF-mode)
+      (should (not (member "pdftricks" TeX-active-styles)))
+
+      ;; test for psfrag option
+      (erase-buffer)
+      ;; This depends on the following code in latex.el:
+      ;; (TeX-add-style-hook "psfrag" #'TeX-PDF-mode-off :classopt)
+      (insert "\\documentclass[psfrag]{article}\n")
+      (latex-mode)
+      (TeX-update-style)
+      (should (not TeX-PDF-mode))
+      (should (not (member "psfrag" TeX-active-styles))))))
+
 ;;; latex-test.el ends here
diff --git a/tests/latex/preview-latex-test.el 
b/tests/latex/preview-latex-test.el
new file mode 100644
index 0000000..0249683
--- /dev/null
+++ b/tests/latex/preview-latex-test.el
@@ -0,0 +1,49 @@
+;;; preview-latex.el --- tests for preview-latex compatibility
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; 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.
+
+;;; Code:
+
+(require 'ert)
+(require 'preview)
+
+(ert-deftest preview-error-quote-utf-8 ()
+  "`preview-error-quote' is robust against partial ^^-quoting or not.
+If a utf-8 byte sequence is partially ^^-quoted in latex output, we have
+to decode ^^ab as raw 8-bit character first and decode in the sense of
+emacs' coding system later."
+  (let (case-fold-search
+       (buffer-file-coding-system 'utf-8))
+    (dolist (str '("primĂ¡rias"
+                  ;; Unicode character Ă¡ is encoded in utf-8 as
+                  ;; a byte sequence \xC3 \xA1.
+                  "prim\xC3\xA1rias" "prim^^c3\xA1rias" "prim^^c3^^a1rias"))
+      (should (string-match (preview-error-quote str) "primĂ¡rias")))))
+
+(ert-deftest preview-decode-^^ab-utf-8 ()
+  "Test mixture of raw 8-bit byte and byte with ^^-quoting."
+  (dolist (str '("prim\xC3\xA1rias" "prim^^c3\xA1rias" "prim^^c3^^a1rias"))
+    (should (string= (preview--decode-^^ab str 'utf-8) "primĂ¡rias"))))
+
+;;; preview-latex.el ends here
+
+;; Local Variables:
+;; coding: utf-8
+;; End:
diff --git a/tests/tex/command-expansion.el b/tests/tex/command-expansion.el
index dd1f09b..0de5831 100644
--- a/tests/tex/command-expansion.el
+++ b/tests/tex/command-expansion.el
@@ -88,7 +88,7 @@
   "Check whether \"\\input\" and \"\\detokenize\" are supplied when necessary."
   ;; Skip on w32 because the quoting style of `shell-quote-argument'
   ;; is different.
-  (skip-unless (not (eq system-type 'w32)))
+  (skip-unless (not (eq system-type 'windows-nt)))
   (should (string=
            (let ((major-mode 'latex-mode)
                 (TeX-engine 'default)
@@ -102,6 +102,9 @@
 File names obtained as expansion of \"%t\", \"%s\" and so on should be
 skipped for the following expansion to avoid possible endless loop.
 See <https://lists.gnu.org/r/bug-auctex/2014-08/msg00012.html>."
+  ;; Skip on w32 because the quoting style of `shell-quote-argument'
+  ;; is different.
+  (skip-unless (not (eq system-type 'windows-nt)))
   (let ((TeX-master "abc-def")
        (TeX-expand-list '(("-" (lambda () ":")))))
     (should (string=
@@ -128,6 +131,9 @@ See 
<https://lists.gnu.org/r/bug-auctex/2014-08/msg00012.html>."
 
 (ert-deftest TeX-command-expand-active-master ()
   "Test whether `TeX-active-master' is valid argument for 
`TeX-command-expand'."
+  ;; Skip on w32 because the quoting style of `shell-quote-argument'
+  ;; is different.
+  (skip-unless (not (eq system-type 'windows-nt)))
   (let ((TeX-master "abc")
        TeX-current-process-region-p)
     (setq TeX-current-process-region-p nil)
diff --git a/tex-bar.el b/tex-bar.el
index 0124f55..3098b4d 100644
--- a/tex-bar.el
+++ b/tex-bar.el
@@ -1,6 +1,7 @@
-;;; tex-bar.el --- toolbar icons on AUCTeX in GNU emacs and XEmacs
+;;; tex-bar.el --- toolbar icons on AUCTeX in GNU emacs
 
-;; Copyright (C) 2004-2008, 2012-2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2008, 2012-2014, 2016, 2018
+;;                                  Free Software Foundation, Inc.
 
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
@@ -88,7 +89,7 @@ If there is no help, the empty string is returned."
   "List of buttons available in `tex-mode'.
 It should be a list in the same format of the BUTTONS parameter
 in function `toolbarx-install-toolbar', often a symbol that
-labels a button or Emacs/XEmacs choice of buttons.
+labels a button.
 
 Type `\\[TeX-bar-TeX-buttons]' for a list of available buttons.
 
@@ -118,9 +119,6 @@ alists, see variable `TeX-bar-TeX-all-button-alists'."
                    (const spell))
                    ;; (const latex-symbols-experimental)
               (repeat (choice (symbol :tag "Label")
-                              (vector :args ((symbol :tag "Label in Emacs ")
-                                             (symbol :tag "Label in XEmacs"))
-                                      :tag "Emacs/XEmacs choice")
                               (sexp :tag "General element"))))
   :group 'TeX-tool-bar)
 
@@ -232,7 +230,7 @@ format of the argument MEANING-ALIST in the mentioned 
function."
   "List of buttons available in `latex-mode'.
 It should be a list in the same format of the BUTTONS parameter
 in function `toolbarx-install-toolbar', often a symbol that
-labels a button or Emacs/XEmacs choice of buttons.
+labels a button.
 
 Type `\\[TeX-bar-LaTeX-buttons]' for a list of available buttons.
 
@@ -262,9 +260,6 @@ alists, see variable `TeX-bar-LaTeX-all-button-alists'."
                    (const spell)
                    (const latex-symbols-experimental))
               (repeat (choice (symbol :tag "Label")
-                              (vector :args ((symbol :tag "Label in Emacs ")
-                                             (symbol :tag "Label in XEmacs"))
-                                      :tag "Emacs/XEmacs choice")
                               (sexp :tag "General element"))))
   :group 'TeX-tool-bar)
 
diff --git a/tex-buf.el b/tex-buf.el
index cc35938..e89df51 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1,6 +1,6 @@
 ;;; tex-buf.el --- External commands for AUCTeX.
 
-;; Copyright (C) 1991-1999, 2001-2017 Free Software Foundation, Inc.
+;; Copyright (C) 1991-1999, 2001-2018 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: tex, wp
@@ -480,6 +480,11 @@ Run function `TeX-check-engine' to check the correct 
engine has
 been set."
   (TeX-check-engine name)
 
+  ;; Make sure that `TeX-command-buffer' is set always.
+  ;; It isn't safe to remove similar lines in `TeX-run-command' etc.
+  ;; because preview-latex calls `TeX-run-command' directly.
+  (setq-default TeX-command-buffer (current-buffer))
+
   (cond ((eq file #'TeX-region-file)
         (setq TeX-current-process-region-p t))
        ((eq file #'TeX-master-file)
@@ -3352,46 +3357,40 @@ error."
   :group 'TeX-output)
 
 (defface TeX-error-description-error
-  (if (< emacs-major-version 22)
-      nil
-    ;; This is the same as `error' face in latest GNU Emacs versions.
-    '((((class color) (min-colors 88) (background light))
-       :foreground "Red1" :weight bold)
-      (((class color) (min-colors 88) (background dark))
-       :foreground "Pink" :weight bold)
-      (((class color) (min-colors 16) (background light))
-       :foreground "Red1" :weight bold)
-      (((class color) (min-colors 16) (background dark))
-       :foreground "Pink" :weight bold)
-      (((class color) (min-colors 8))
-       :foreground "red" :weight bold)
-      (t (:inverse-video t :weight bold))))
+  ;; This is the same as `error' face in latest GNU Emacs versions.
+  '((((class color) (min-colors 88) (background light))
+     :foreground "Red1" :weight bold)
+    (((class color) (min-colors 88) (background dark))
+     :foreground "Pink" :weight bold)
+    (((class color) (min-colors 16) (background light))
+     :foreground "Red1" :weight bold)
+    (((class color) (min-colors 16) (background dark))
+     :foreground "Pink" :weight bold)
+    (((class color) (min-colors 8))
+     :foreground "red" :weight bold)
+    (t (:inverse-video t :weight bold)))
   "Face for \"Error\" string in error descriptions.")
 
 (defface TeX-error-description-warning
-  (if (< emacs-major-version 22)
-      nil
-    ;; This is the same as `warning' face in latest GNU Emacs versions.
-    '((((class color) (min-colors 16)) :foreground "DarkOrange" :weight bold)
-      (((class color)) :foreground "yellow" :weight bold)))
+  ;; This is the same as `warning' face in latest GNU Emacs versions.
+  '((((class color) (min-colors 16)) :foreground "DarkOrange" :weight bold)
+    (((class color)) :foreground "yellow" :weight bold))
   "Face for \"Warning\" string in error descriptions.")
 
 (defface TeX-error-description-tex-said
-  (if (< emacs-major-version 22)
-      nil
-    ;; This is the same as `font-lock-function-name-face' face in latest GNU
-    ;; Emacs versions.
-    '((((class color) (min-colors 88) (background light))
-       :foreground "Blue1")
-      (((class color) (min-colors 88) (background dark))
-       :foreground "LightSkyBlue")
-      (((class color) (min-colors 16) (background light))
-       :foreground "Blue")
-      (((class color) (min-colors 16) (background dark))
-       :foreground "LightSkyBlue")
-      (((class color) (min-colors 8))
-       :foreground "blue" :weight bold)
-      (t (:inverse-video t :weight bold))))
+  ;; This is the same as `font-lock-function-name-face' face in latest GNU
+  ;; Emacs versions.
+  '((((class color) (min-colors 88) (background light))
+     :foreground "Blue1")
+    (((class color) (min-colors 88) (background dark))
+     :foreground "LightSkyBlue")
+    (((class color) (min-colors 16) (background light))
+     :foreground "Blue")
+    (((class color) (min-colors 16) (background dark))
+     :foreground "LightSkyBlue")
+    (((class color) (min-colors 8))
+     :foreground "blue" :weight bold)
+    (t (:inverse-video t :weight bold)))
   "Face for \"TeX said\" string in error descriptions.")
 
 (defface TeX-error-description-help
@@ -3695,32 +3694,31 @@ forward, if negative)."
 (easy-menu-define TeX-error-overview-menu
   TeX-error-overview-mode-map
   "Menu used in TeX error overview mode."
-  (TeX-menu-with-help
-   '("TeX errors"
-     ["Next error" TeX-error-overview-next-error
-      :help "Jump to the next error"]
-     ["Previous error" TeX-error-overview-previous-error
-      :help "Jump to the previous error"]
-     ["Go to source" TeX-error-overview-goto-source
-      :help "Show the error in the source"]
-     ["Jump to source" TeX-error-overview-jump-to-source
-      :help "Move point to the error in the source"]
-     ["Go to log" TeX-error-overview-goto-log
-      :help "Show the error in the log buffer"]
-     "-"
-     ["Debug Bad Boxes" TeX-error-overview-toggle-debug-bad-boxes
-      :style toggle :selected TeX-debug-bad-boxes
-      :help "Show overfull and underfull boxes"]
-     ["Debug Warnings" TeX-error-overview-toggle-debug-warnings
-      :style toggle :selected TeX-debug-warnings
-      :help "Show warnings"]
-     ["Ignore Unimportant Warnings"
-      TeX-error-overview-toggle-suppress-ignored-warnings
-      :style toggle :selected TeX-suppress-ignored-warnings
-      :help "Hide specified warnings"]
-     "-"
-     ["Quit" TeX-error-overview-quit
-      :help "Quit"])))
+  '("TeX errors"
+    ["Next error" TeX-error-overview-next-error
+     :help "Jump to the next error"]
+    ["Previous error" TeX-error-overview-previous-error
+     :help "Jump to the previous error"]
+    ["Go to source" TeX-error-overview-goto-source
+     :help "Show the error in the source"]
+    ["Jump to source" TeX-error-overview-jump-to-source
+     :help "Move point to the error in the source"]
+    ["Go to log" TeX-error-overview-goto-log
+     :help "Show the error in the log buffer"]
+    "-"
+    ["Debug Bad Boxes" TeX-error-overview-toggle-debug-bad-boxes
+     :style toggle :selected TeX-debug-bad-boxes
+     :help "Show overfull and underfull boxes"]
+    ["Debug Warnings" TeX-error-overview-toggle-debug-warnings
+     :style toggle :selected TeX-debug-warnings
+     :help "Show warnings"]
+    ["Ignore Unimportant Warnings"
+     TeX-error-overview-toggle-suppress-ignored-warnings
+     :style toggle :selected TeX-suppress-ignored-warnings
+     :help "Hide specified warnings"]
+    "-"
+    ["Quit" TeX-error-overview-quit
+     :help "Quit"]))
 
 (defvar TeX-error-overview-list-entries nil
   "List of errors to be used in the error overview.")
@@ -3831,35 +3829,7 @@ warnings and bad boxes"
 
 ;;; Output mode
 
-(defalias 'TeX-special-mode
-  (if (fboundp 'special-mode)
-      (progn
-        (defvaralias 'TeX-special-mode-map 'special-mode-map)
-        #'special-mode)
-    (defvar TeX-special-mode-map
-      (let ((map (make-sparse-keymap)))
-        (suppress-keymap map)
-        (define-key map "q" (if (fboundp 'quit-window)
-                                'quit-window
-                              'bury-buffer))
-        (define-key map " " (if (fboundp 'scroll-up-command)
-                                'scroll-up-command
-                              'scroll-up))
-        (define-key map [backspace] (if (fboundp 'scroll-down-command)
-                                        'scroll-down-command
-                                      'scroll-down))
-        (define-key map "\C-?" (if (fboundp 'scroll-down-command)
-                                   'scroll-down-command
-                                 'scroll-down))
-        (define-key map "?" 'describe-mode)
-        (define-key map "h" 'describe-mode)
-        (define-key map ">" 'end-of-buffer)
-        (define-key map "<" 'beginning-of-buffer)
-        (define-key map "g" 'revert-buffer)
-        map)
-      "Keymap for `TeX-special-mode-map'.")
-    (lambda ()
-      "Placeholder mode for Emacsen which don't have `special-mode'.")))
+(define-derived-mode TeX-special-mode special-mode "TeX")
 
 (defvar TeX-output-mode-map
   (let ((map (make-sparse-keymap)))
diff --git a/tex-fold.el b/tex-fold.el
index 82b6ca8..f66776d 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -1,6 +1,6 @@
 ;;; tex-fold.el --- Fold TeX macros.
 
-;; Copyright (C) 2004-2008, 2011-2012, 2014, 2017
+;; Copyright (C) 2004-2008, 2011-2012, 2014, 2017, 2018
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
@@ -595,11 +595,8 @@ opening and closing syntax as defined in
 `TeX-search-syntax-table'.
 
 The first item in the returned list is the string specified in
-the argument, the second item may be a face if the argument
-string was fontified.  In Emacs the string holds text properties
-as well, so the second item is always nil.  In XEmacs the string
-does not enclose any faces, so these are given in the second item
-of the resulting list."
+the argument, with text properties.  The second item is for
+backward compatibility and always nil."
   (save-excursion
     (let* ((macro-end (or macro-end
                          (save-excursion (goto-char macro-start)
@@ -911,12 +908,7 @@ the other elements.  The ordering among elements is 
maintained."
 
 ;;; The mode
 
-;; This autoload cookie had to be changed because of XEmacs.  This is
-;; very dissatisfactory, because we now don't have the full doc string
-;; available to tell people what to expect when using this mode before
-;; loading it.
-
-;;;###autoload (autoload 'TeX-fold-mode "tex-fold" "Minor mode for hiding and 
revealing macros and environments." t)
+;;;###autoload
 (define-minor-mode TeX-fold-mode
   "Minor mode for hiding and revealing macros and environments.
 
diff --git a/tex-info.el b/tex-info.el
index f990f0f..b1fd236 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -1,7 +1,7 @@
 ;;; tex-info.el --- Support for editing Texinfo source.
 
 ;; Copyright (C) 1993, 1994, 1997, 2000, 2001, 2004, 2005, 2006,
-;;               2011-2015, 2017  Free Software Foundation, Inc.
+;;               2011-2015, 2017, 2018  Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: tex
@@ -31,11 +31,6 @@
 (require 'tex)
 
 (require 'texinfo)
-;; Make sure the Texinfo mode of AUCTeX is still used after loading
-;; texinfo.el.  (This is only an issue on Emacs 21.)
-(when (and (boundp 'TeX-modes)
-          (memq 'texinfo-mode TeX-modes))
-  (defalias 'texinfo-mode 'TeX-texinfo-mode))
 
 ;;; Environments:
 (defvar Texinfo-environment-list
@@ -443,12 +438,10 @@ is assumed by default."
 (defvar reftex-label-menu-flags)
 (defvar reftex-tables-dirty)
 
-(eval-when-compile
-  (when (fboundp 'declare-function)
-    (declare-function reftex-match-string "reftex" (n))
-    (declare-function reftex-section-number "reftex-parse" (&optional level 
star))
-    (declare-function reftex-nicify-text "reftex" (text))
-    (declare-function reftex-ensure-compiled-variables "reftex" ())))
+(declare-function reftex-match-string "reftex" (n))
+(declare-function reftex-section-number "reftex-parse" (&optional level star))
+(declare-function reftex-nicify-text "reftex" (text))
+(declare-function reftex-ensure-compiled-variables "reftex" ())
 
 (defun Texinfo-reftex-section-info (file)
   ;; Return a section entry for the current match.
@@ -531,6 +524,18 @@ is assumed by default."
        (define-key map "\e\r" 'address@hidden)) ;*** Alias
     (define-key map "\C-c\C-s" 'Texinfo-insert-node)
     (define-key map "\C-c]" 'address@hidden)
+
+    ;; Override some bindings in `TeX-mode-map'
+    ;; FIXME: Inside @math{}, you can use all plain TeX math commands
+    ;; even in Texinfo documents.  Thus it might be nice to develop
+    ;; context sensitive command so that the following four keys
+    ;; inherit the command in `TeX-mode-map' inside @math{}.
+    (define-key map "$"  #'self-insert-command)
+    (define-key map "^"  #'self-insert-command)
+    (define-key map "_"  #'self-insert-command)
+    (define-key map "\\" #'self-insert-command)
+    ;; Users benefit from `TeX-electric-macro' even in Texinfo mode
+    (define-key map "@" #'TeX-insert-backslash)
     map)
   "Keymap for Texinfo mode.")
 
@@ -542,58 +547,57 @@ is assumed by default."
 (easy-menu-define Texinfo-mode-menu
   Texinfo-mode-map
   "Menu used in Texinfo mode."
-  (TeX-menu-with-help
-   `("Texinfo"
-     ["Node ..." address@hidden
-      :help "Insert a node"]
-     ["Macro ..." TeX-insert-macro
-      :help "Insert a macro and possibly arguments"]
-     ["Complete Macro" TeX-complete-symbol
-      :help "Complete the current macro"]
-     ["Environment ..." Texinfo-insert-environment
-      :help "Insert an environment"]
-     ["Item" address@hidden
-      :help "Insert an @item"]
-     "-"
-     ("Insert Font"
-      ["Emphasize"  (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
-      ["Bold"       (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
-      ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
-      ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
-      ["Italic"     (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
-      ["Sample"    (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
-      ["Roman"      (TeX-font nil ?\C-r) :keys "C-c C-f C-r"])
-     ("Replace Font"
-      ["Emphasize"  (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
-      ["Bold"       (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
-      ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
-      ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
-      ["Italic"     (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
-      ["Sample"    (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
-      ["Roman"      (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"])
-     ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
-     "-"
-     ["Create Master Menu" texinfo-master-menu
-      :help "Make a master menu for the whole Texinfo file"]
-     ["Create Menu" texinfo-make-menu
-      :help "Make or update the menu for the current section"]
-     ["Update Node" texinfo-update-node
-      :help "Update the current node"]
-     ["Update Every Node" texinfo-every-node-update
-      :help "Update every node in the current file"]
-     ["Update All Menus" texinfo-all-menus-update
-      :help "Update every menu in the current file"]
-     "-"
-     ("Commenting"
-      ["Comment or Uncomment Region"
-       comment-or-uncomment-region
-       :help "Comment or uncomment the currently selected region"]
-      ["Comment or Uncomment Paragraph"
-       TeX-comment-or-uncomment-paragraph
-       :help "Comment or uncomment the current paragraph"])
-     ,TeX-fold-menu
-     "-"
-     . ,TeX-common-menu-entries)))
+  `("Texinfo"
+    ["Node ..." address@hidden
+     :help "Insert a node"]
+    ["Macro ..." TeX-insert-macro
+     :help "Insert a macro and possibly arguments"]
+    ["Complete Macro" TeX-complete-symbol
+     :help "Complete the current macro"]
+    ["Environment ..." Texinfo-insert-environment
+     :help "Insert an environment"]
+    ["Item" address@hidden
+     :help "Insert an @item"]
+    "-"
+    ("Insert Font"
+     ["Emphasize"  (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
+     ["Bold"       (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
+     ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
+     ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
+     ["Italic"     (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
+     ["Sample"    (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
+     ["Roman"      (TeX-font nil ?\C-r) :keys "C-c C-f C-r"])
+    ("Replace Font"
+     ["Emphasize"  (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
+     ["Bold"       (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
+     ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
+     ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
+     ["Italic"     (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
+     ["Sample"    (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
+     ["Roman"      (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"])
+    ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
+    "-"
+    ["Create Master Menu" texinfo-master-menu
+     :help "Make a master menu for the whole Texinfo file"]
+    ["Create Menu" texinfo-make-menu
+     :help "Make or update the menu for the current section"]
+    ["Update Node" texinfo-update-node
+     :help "Update the current node"]
+    ["Update Every Node" texinfo-every-node-update
+     :help "Update every node in the current file"]
+    ["Update All Menus" texinfo-all-menus-update
+     :help "Update every menu in the current file"]
+    "-"
+    ("Commenting"
+     ["Comment or Uncomment Region"
+      comment-or-uncomment-region
+      :help "Comment or uncomment the currently selected region"]
+     ["Comment or Uncomment Paragraph"
+      TeX-comment-or-uncomment-paragraph
+      :help "Comment or uncomment the current paragraph"])
+    ,TeX-fold-menu
+    "-"
+    . ,TeX-common-menu-entries))
 
 (defvar Texinfo-font-list
   '((?\C-b "@b{" "}")
@@ -659,15 +663,7 @@ value of `Texinfo-mode-hook'."
        texinfo-imenu-generic-expression)
 
   (set (make-local-variable 'font-lock-defaults)
-       ;; COMPATIBILITY for Emacs 20
-       (if (boundp 'texinfo-font-lock-syntactic-keywords)
-           '(texinfo-font-lock-keywords
-             nil nil nil backward-paragraph
-             (font-lock-syntactic-keywords
-              . texinfo-font-lock-syntactic-keywords))
-         ;; This is for Emacs >= 23.3, when
-         ;; `texinfo-font-lock-syntactic-keywords' was removed.
-         '(texinfo-font-lock-keywords nil nil nil backward-paragraph)))
+       '(texinfo-font-lock-keywords nil nil nil backward-paragraph))
 
   ;; Outline settings.
   (set (make-local-variable 'outline-regexp)
@@ -857,7 +853,7 @@ value of `Texinfo-mode-hook'."
   (if (and (boundp 'reftex-mode) reftex-mode)
       (Texinfo-reftex-hook))
 
-  (TeX-run-mode-hooks 'text-mode-hook 'Texinfo-mode-hook)
+  (run-mode-hooks 'text-mode-hook 'Texinfo-mode-hook)
   (TeX-set-mode-name))
 
 (defcustom Texinfo-clean-intermediate-suffixes nil
diff --git a/tex-ispell.el b/tex-ispell.el
index 995221c..daf5094 100644
--- a/tex-ispell.el
+++ b/tex-ispell.el
@@ -1,6 +1,6 @@
 ;;; tex-ispell.el --- AUCTeX skip additions for Ispell
 
-;; Copyright (C) 2016-2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2018 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -59,6 +59,7 @@
 ;; mdframed.sty
 ;; minted.sty
 ;; nameref.sty
+;; pythontex.sty
 ;; siunitx.sty
 ;; splitidx.sty
 ;; tabularx.sty
@@ -190,6 +191,14 @@
       ;; nameref.sty
       ("nameref" . 1)
       ("Nameref" . 1)
+      ;; pythontex.sty: Only add the macros which will be used in the
+      ;; document; others should be in the preamble
+      ("setpythontexfv" . 1)
+      ("useprintpythontex" . 1)
+      ("usestdoutpythontex" . 1)
+      ("inputpygments" . 1)
+      ("setpygmentsfv" . 1)
+      ("setpygmentspygopt" . 1)
       ;; siunitx.sty
       ("num" . 1)
       ("si" . 1)
@@ -280,6 +289,29 @@ argument and spell check the mandatory one."))
       "lstlisting"
       ;; minted.sty
       "minted"
+      ;; pythontex.sty
+      "pycode"
+      "pysub"
+      "pyverbatim"
+      "pyblock"
+      "pyconsole"
+      "pyconcode"
+      "pyconverbatim"
+      "pylabcode"
+      "pylabsub"
+      "pylabverbatim"
+      "pylabblock"
+      "pylabconsole"
+      "pylabconcode"
+      "pylabconverbatim"
+      "sympycode"
+      "sympysub"
+      "sympyverbatim"
+      "sympyblock"
+      "sympyconsole"
+      "sympyconcode"
+      "sympyconverbatim"
+      "pygments"
       ;; tikz.sty
       "tikzpicture")
     "List of LaTeX environments which will be skipped entirely.
@@ -307,14 +339,22 @@ not be quoted.  An opening brace `{', asterisk `*' and 
at-sign
   :group 'TeX-misc
   :type 'string)
 
-;; listings.sty & fancyvrb.sty: With opt. argument only before verb content:
+;; listings.sty, fancyvrb.sty, pythontex.sty: With opt. argument only
+;; before verb content:
 (TeX-ispell-skip-setcar
- `((,(concat "\\\\" (regexp-opt '("Verb" "lstinline")))
+ `((,(concat "\\\\" (regexp-opt '("Verb"     "lstinline"
+                                 "py"       "pyc"       "pys"    "pyv" "pyb"
+                                 "pycon"    "pyconc"    "pyconv"
+                                 "pylab"    "pylabc"    "pylabs" "pylabv" 
"pylabb"
+                                 "pylabcon" "pylabconc" "pylabconv"
+                                 "sympy"    "sympyc"    "sympys" "sympyv" 
"sympyb"
+                                 "sympycon" "sympyconc" "sympyconv")))
     TeX-ispell-tex-arg-verb-end)))
 
-;; minted.sty: With opt. and mandatory argument before verb content:
+;; minted.sty: With opt. and mandatory argument before verb content.
+;; pythontex.sty: With one mandatory argument before verb content:
 (TeX-ispell-skip-setcar
- `((,(concat "\\\\" (regexp-opt '("mint" "mintinline")))
+ `((,(concat "\\\\" (regexp-opt '("mint" "mintinline" "pygment")))
     TeX-ispell-tex-arg-verb-end 1)))
 
 
diff --git a/tex-style.el b/tex-style.el
index b523d8c..b1c32a4 100644
--- a/tex-style.el
+++ b/tex-style.el
@@ -234,7 +234,7 @@ It can be a list of themes or a function.  If it is the 
symbol
 This variable is intended to be used as a file local variable to
 override the autodetection of the biblatex backend.")
 (make-variable-buffer-local 'LaTeX-biblatex-use-Biber)
-(put 'LaTeX-biblatex-use-Biber 'safe-local-variable 'TeX-booleanp)
+(put 'LaTeX-biblatex-use-Biber 'safe-local-variable #'booleanp)
 
 ;; style/comment.el
 
@@ -347,8 +347,7 @@ found in the TeX search path.
 
 `LaTeX-includegraphics-read-file-relative' lists all graphic files
 in the master directory and its subdirectories and inserts the
-relative file name.  This option does not work with Emacs 21 or
-XEmacs.
+relative file name.
 
 The custom option `simple' works as
 `LaTeX-includegraphics-read-file-relative' but it lists all kind of
diff --git a/tex.el b/tex.el
index 9995af3..3c3f176 100644
--- a/tex.el
+++ b/tex.el
@@ -649,32 +649,6 @@ emacs 24.1 and is then later run by emacs 24.5."
 
 (require 'easymenu)
 
-(eval-and-compile
-  (if (featurep 'xemacs)
-      (defun TeX-maybe-remove-help (menu)
-      "Removes :help entries from menus, since XEmacs does not like them.
-Also does other stuff."
-      (cond ((consp menu)
-            (cond ((eq (car menu) :help)
-                   (TeX-maybe-remove-help (cddr menu)))
-                  ((eq (car menu) :visible)
-                   (cons :included
-                         (cons (cadr menu)
-                               (TeX-maybe-remove-help (cddr menu)))))
-                  (t (cons (TeX-maybe-remove-help (car menu))
-                           (TeX-maybe-remove-help (cdr menu))))))
-           ((vectorp menu)
-            (vconcat (TeX-maybe-remove-help (append menu nil))))
-           (t menu)))
-    (defun TeX-maybe-remove-help (menu)
-      "Compatibility function that would remove :help entries if on XEmacs,
-but does nothing in Emacs."
-      menu))
-  (defmacro TeX-menu-with-help (menu)
-    "Compatibility macro that removes :help entries if on XEmacs.
-Also does other stuff."
-    (TeX-maybe-remove-help menu)))
-
 ;;; Documentation for Info-goto-emacs-command-node and similar
 
 (eval-after-load 'info '(dolist (elt '("TeX" "LaTeX" "ConTeXt" "Texinfo"
@@ -699,77 +673,6 @@ Also does other stuff."
 The step should be big enough to allow setting a priority for new
 overlays between two existing ones.")
 
-
-;;; Special support for XEmacs
-
-(when (featurep 'xemacs)
-
-  (defun TeX-read-string
-      (prompt &optional initial-input history default-value)
-    (condition-case nil
-       (read-string prompt initial-input history default-value t)
-      (wrong-number-of-arguments
-       (read-string prompt initial-input history default-value))))
-
-  (defun TeX-mark-active ()
-    ;; In Lucid (mark) returns nil when not active.
-    (if zmacs-regions
-       (mark)
-      (mark t)))
-
-  (defun TeX-active-mark ()
-    (and zmacs-regions (mark)))
-
-  (fset 'TeX-activate-region (symbol-function 'zmacs-activate-region))
-
-  ;; I am aware that this counteracts coding conventions but I am sick
-  ;; of it.
-  (unless (fboundp 'line-beginning-position)
-    (defalias 'line-beginning-position 'point-at-bol))
-  (unless (fboundp 'line-end-position)
-    (defalias 'line-end-position 'point-at-eol))
-
-  (defun TeX-overlay-prioritize (start end)
-    "Calculate a priority for an overlay extending from START to END.
-The calculated priority is lower than the minimum of priorities
-of surrounding overlays and higher than the maximum of enclosed
-overlays."
-    (let (inner-priority outer-priority
-                        (prios (cons nil nil)))
-      (map-extents
-       #'(lambda (ov prios)
-          (and
-           (or (eq (extent-property ov 'category) 'TeX-fold)
-               (extent-property ov 'preview-state))
-           (setcar prios
-                   (max (or (car prios) 0)
-                        (extent-property ov 'priority))))
-          nil)
-       nil start end prios 'start-and-end-in-region 'priority)
-      (map-extents
-       #'(lambda (ov prios)
-          (and
-           (or (eq (extent-property ov 'category) 'TeX-fold)
-               (extent-property ov 'preview-state))
-           (setcdr prios
-                   (min (or (cdr prios) most-positive-fixnum)
-                        (extent-property ov 'priority))))
-          nil)
-       nil start end prios
-       '(start-and-end-in-region negate-in-region) 'priority)
-      (setq inner-priority (car prios) outer-priority (cdr prios))
-      (cond ((and inner-priority (not outer-priority))
-            (+ inner-priority TeX-overlay-priority-step))
-           ((and (not inner-priority) outer-priority)
-            (/ outer-priority 2))
-           ((and inner-priority outer-priority)
-            (+ (/ (- outer-priority inner-priority) 2) inner-priority))
-           (t TeX-overlay-priority-step))))
-
-  (defun TeX-replace-regexp-in-string (regexp rep string)
-    "Compatibility function mimicking `replace-regexp-in-string' for XEmacs."
-    (replace-in-string string regexp rep)) )
-
 ;; require crm here, because we often do
 ;;
 ;; (let ((crm-separator ","))
@@ -826,60 +729,38 @@ Ensures that empty input results in nil across different 
emacs versions."
                                            hist def inherit-input-method)))
       (if (equal result '("")) nil result))))
 
-;;; Special support for GNU Emacs
-
-(unless (featurep 'xemacs)
-
-  (defun TeX-read-string (prompt &optional initial-input history default-value)
-    (read-string prompt initial-input history default-value t))
-
-  (defun TeX-mark-active ()
-    ;; In FSF 19 mark-active indicates if mark is active.
-    mark-active)
-
-  (defun TeX-active-mark ()
-    (and transient-mark-mode mark-active))
-
-  (defun TeX-activate-region ()
-    (setq deactivate-mark nil)
-    (if (fboundp 'activate-mark)
-       (activate-mark)
-      ;; COMPATIBILITY for Emacs <= 22
-      ;; This part is adopted from `activate-mark' of Emacs 24.5.
-      (when (mark t)
-       (unless (and transient-mark-mode mark-active
-                (mark))
-         (force-mode-line-update) ;Refresh toolbar (bug#16382).
-         (setq mark-active t)
-         (unless transient-mark-mode
-           (setq transient-mark-mode 'lambda))
-         (if (boundp 'activate-mark-hook)
-             (run-hooks 'activate-mark-hook))))))
-
-  (defun TeX-overlay-prioritize (start end)
-    "Calculate a priority for an overlay extending from START to END.
+(defun TeX-read-string (prompt &optional initial-input history default-value)
+  (read-string prompt initial-input history default-value t))
+
+(defun TeX-active-mark ()
+  (and transient-mark-mode mark-active))
+
+(defun TeX-activate-region ()
+  (setq deactivate-mark nil)
+  (activate-mark))
+
+(defun TeX-overlay-prioritize (start end)
+  "Calculate a priority for an overlay extending from START to END.
 The calculated priority is lower than the minimum of priorities
 of surrounding overlays and higher than the maximum of enclosed
 overlays."
-    (let (outer-priority inner-priority ov-priority)
-      (dolist (ov (overlays-in start end))
-       (when (or (eq (overlay-get ov 'category) 'TeX-fold)
-                 (overlay-get ov 'preview-state))
-         (setq ov-priority (overlay-get ov 'priority))
-         (if (>= (overlay-start ov) start)
-             (setq inner-priority (max ov-priority (or inner-priority
-                                                       ov-priority)))
-           (setq outer-priority (min ov-priority (or outer-priority
-                                                     ov-priority))))))
-      (cond ((and inner-priority (not outer-priority))
-            (+ inner-priority TeX-overlay-priority-step))
-           ((and (not inner-priority) outer-priority)
-            (/ outer-priority 2))
-           ((and inner-priority outer-priority)
-            (+ (/ (- outer-priority inner-priority) 2) inner-priority))
-           (t TeX-overlay-priority-step))))
-
-  (defalias #'TeX-replace-regexp-in-string #'replace-regexp-in-string) )
+  (let (outer-priority inner-priority ov-priority)
+    (dolist (ov (overlays-in start end))
+      (when (or (eq (overlay-get ov 'category) 'TeX-fold)
+               (overlay-get ov 'preview-state))
+       (setq ov-priority (overlay-get ov 'priority))
+       (if (>= (overlay-start ov) start)
+           (setq inner-priority (max ov-priority (or inner-priority
+                                                     ov-priority)))
+         (setq outer-priority (min ov-priority (or outer-priority
+                                                   ov-priority))))))
+    (cond ((and inner-priority (not outer-priority))
+          (+ inner-priority TeX-overlay-priority-step))
+         ((and (not inner-priority) outer-priority)
+          (/ outer-priority 2))
+         ((and inner-priority outer-priority)
+          (+ (/ (- outer-priority inner-priority) 2) inner-priority))
+         (t TeX-overlay-priority-step))))
 
 (defun TeX-delete-dups-by-car (alist &optional keep-list)
   "Return a list of all elements in ALIST, but each car only once.
@@ -1969,10 +1850,7 @@ SyncTeX are recognized."
 (defalias 'TeX-source-specials-mode 'TeX-source-correlate-mode)
 (make-obsolete 'TeX-source-specials-mode 'TeX-source-correlate-mode "11.86")
 (defalias 'tex-source-correlate-mode 'TeX-source-correlate-mode)
-(put 'TeX-source-correlate-mode 'safe-local-variable 'TeX-booleanp)
-;; We do not want the custom variable to require tex.el.  This is only
-;; necessary if AUCTeX was compiled with Emacs 21.
-(put 'TeX-source-correlate-mode 'custom-requests nil)
+(put 'TeX-source-correlate-mode 'safe-local-variable #'booleanp)
 (setq minor-mode-map-alist
       (delq (assq 'TeX-source-correlate-mode minor-mode-map-alist)
            minor-mode-map-alist))
@@ -2114,7 +1992,7 @@ enabled and the `synctex' binary is available."
   :group 'TeX-command
   :set 'TeX-mode-set
   :type 'boolean)
-(put 'TeX-PDF-mode 'safe-local-variable 'TeX-booleanp)
+(put 'TeX-PDF-mode 'safe-local-variable #'booleanp)
 
 (define-minor-mode TeX-PDF-mode
   "Minor mode for using PDFTeX.
@@ -2212,7 +2090,7 @@ Programs should not use this variable directly but the 
function
   :group 'TeX-command
   :type 'boolean)
 (make-variable-buffer-local 'TeX-PDF-via-dvips-ps2pdf)
-(put 'TeX-PDF-via-dvips-ps2pdf 'safe-local-variable 'TeX-booleanp)
+(put 'TeX-PDF-via-dvips-ps2pdf 'safe-local-variable #'booleanp)
 (make-obsolete-variable 'TeX-PDF-via-dvips-ps2pdf 'TeX-PDF-from-DVI "11.90")
 
 (defun TeX-PDF-from-DVI ()
@@ -2334,14 +2212,11 @@ output files."
                  (directory-files (or master-dir ".") nil regexp))))
     (if files
        (when (or (not TeX-clean-confirm)
-                 (condition-case nil
-                     (dired-mark-pop-up " *Deletions*" 'delete
-                                        (if (> (length files) 1)
-                                            files
-                                          (cons t files))
-                                        'y-or-n-p "Delete files? ")
-                   (wrong-type-argument ; e.g. with Emacs 21
-                    (y-or-n-p (format "Delete %S? " (car files))))))
+                 (dired-mark-pop-up " *Deletions*" 'delete
+                                    (if (> (length files) 1)
+                                        files
+                                      (cons t files))
+                                    'y-or-n-p "Delete files? "))
          (dolist (file files)
            (delete-file (concat master-dir file))))
       (message "No files to be deleted"))))
@@ -2841,6 +2716,8 @@ Supported values are described below:
             thereof.
 * `:plain-tex' for files in plain-TeX mode.
 * `:texinfo' for Texinfo files.
+* `:classopt' for class options of LaTeX document.  Just
+             considered as a pseudo-dialect.
 
 Purpose is notably to prevent non-Texinfo hooks to be run in
 Texinfo files, due to ambiguous style name, as this may cause bad
@@ -2902,7 +2779,8 @@ side effect e.g. on variable `TeX-font-list'.")
           (load-file el)))))
 
 (defconst TeX-style-hook-dialect-weight-alist
-  '((:latex . 1) (:texinfo . 2) (:bibtex . 4) (:plain-tex . 8) (:context . 16))
+  '((:latex . 1) (:texinfo . 2) (:bibtex . 4) (:plain-tex . 8) (:context . 16)
+    (:classopt . 32))
   "Association list to map dialects to binary weight, in order to
   implement dialect sets as bitmaps."  )
 
@@ -3495,6 +3373,9 @@ See `TeX-parse-macro' for details."
       (if (vectorp (car args))
          ;; Maybe get rid of all optional arguments.  See `TeX-insert-macro'
          ;; for more comments.  See `TeX-insert-macro-default-style'.
+         ;; The macro `LaTeX-check-insert-macro-default-style' in
+         ;; `latex.el' uses the code inside (unless ...)  This macro
+         ;; should be adapted if the code here changs.
          (unless (if (eq TeX-insert-macro-default-style 
'show-all-optional-args)
                      (equal current-prefix-arg '(4))
                    (or
@@ -3793,10 +3674,8 @@ The algorithm is as follows:
   (funcall TeX-install-font-lock)
 
   ;; We want this to be early in the list, so we do not add it before
-  ;; we enter TeX mode  the first time.
-  (if (boundp 'local-write-file-hooks)
-      (add-hook 'local-write-file-hooks 'TeX-safe-auto-write)
-    (add-hook 'write-file-hooks 'TeX-safe-auto-write))
+  ;; we enter TeX mode the first time.
+  (add-hook 'write-file-functions #'TeX-safe-auto-write nil t)
   (set (make-local-variable 'TeX-auto-update) t)
 
   (define-key TeX-mode-map "\C-xng" 'TeX-narrow-to-group)
@@ -4749,10 +4628,6 @@ See `match-data' for details."
       (buffer-substring-no-properties (match-beginning n) (match-end n))
     ""))
 
-(defun TeX-booleanp (arg)
-  "Return non-nil if ARG is t or nil."
-  (memq arg '(t nil)))
-
 (defun TeX-looking-at-backward (regexp &optional limit)
   "Return non-nil if the text before point matches REGEXP.
 Optional second argument LIMIT gives a max number of characters
@@ -4780,9 +4655,6 @@ to look backward for."
     (skip-chars-backward " \t\n")
     (bobp)))
 
-(defalias 'TeX-run-mode-hooks
-  (if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks))
-
 (defun TeX-add-to-alist (alist-var new-alist)
   "Add NEW-ALIST to the ALIST-VAR.
 If an element with the same key as the key of an element of
@@ -4913,7 +4785,9 @@ element to ALIST-VAR."
 ;;; Keymap
 
 (defcustom TeX-electric-escape nil
-  "If non-nil, ``\\'' will be bound to `TeX-electric-macro'."
+  "If non-nil, ``\\'' will offer on-the-fly completion.
+In Texinfo-mode, ``@'' will do that job instead and ``\\'' is not
+affected.  See `TeX-electric-macro' for detail."
   :group 'TeX-macro
   :type 'boolean)
 
@@ -5017,7 +4891,6 @@ Brace insertion is only done if point is in a math 
construct and
 
 (defun TeX-mode-specific-command-menu (mode)
   "Return a Command menu specific to the major MODE."
-  ;; COMPATIBILITY for Emacs < 21
   (list TeX-command-menu-name
         :filter `(lambda (&rest ignored)
                    (TeX-mode-specific-command-menu-entries ',mode))
@@ -5026,93 +4899,91 @@ Brace insertion is only done if point is in a math 
construct and
 (defun TeX-mode-specific-command-menu-entries (mode)
   "Return the entries for a Command menu specific to the major MODE."
   (append
-   (TeX-menu-with-help
-    `("Command on"
-      [ "Master File" TeX-command-select-master
-       :keys "C-c C-c" :style radio
-       :selected (eq TeX-command-current 'TeX-command-master)
-       :help "Commands in this menu work on the Master File"]
-      [ "Buffer" TeX-command-select-buffer
-       :keys "C-c C-b" :style radio
-       :selected (eq TeX-command-current 'TeX-command-buffer)
-       :help "Commands in this menu work on the current buffer"]
-      [ "Region" TeX-command-select-region
-       :keys "C-c C-r" :style radio
-       :selected (eq TeX-command-current 'TeX-command-region)
-       :help "Commands in this menu work on the region"]
-      [ "Fix the Region" TeX-pin-region
-       :active (or (if prefix-arg
-                       (<= (prefix-numeric-value prefix-arg) 0)
-                     (and (boundp 'TeX-command-region-begin)
-                          (markerp TeX-command-region-begin)))
-                   (TeX-mark-active))
-       ;;:visible (eq TeX-command-current 'TeX-command-region)
-       :style toggle
-       :selected (and (boundp 'TeX-command-region-begin)
-                      (markerp TeX-command-region-begin))
-       :help "Fix the region for \"Command on Region\""]
-      "-"
-      ["Recenter Output Buffer" TeX-recenter-output-buffer
-       :help "Show the output of current TeX process"]
-      ["Kill Job" TeX-kill-job
-       :help "Kill the current TeX process"]
-      ["Next Error" TeX-next-error
-       :help "Jump to the next error of the last TeX run"]
-      ["Previous Error" TeX-previous-error
-       :help "Jump to the previous error of the last TeX run"
-       :visible TeX-parse-all-errors]
-      ["Error Overview" TeX-error-overview
-       :help "Open an overview of errors occured in the last TeX run"
-       :visible (and TeX-parse-all-errors (fboundp 'tabulated-list-mode))]
-      ["Quick View" TeX-view
-       :help "Start a viewer without prompting"]
+   `("Command on"
+     [ "Master File" TeX-command-select-master
+       :keys "C-c C-c" :style radio
+       :selected (eq TeX-command-current 'TeX-command-master)
+       :help "Commands in this menu work on the Master File"]
+     [ "Buffer" TeX-command-select-buffer
+       :keys "C-c C-b" :style radio
+       :selected (eq TeX-command-current 'TeX-command-buffer)
+       :help "Commands in this menu work on the current buffer"]
+     [ "Region" TeX-command-select-region
+       :keys "C-c C-r" :style radio
+       :selected (eq TeX-command-current 'TeX-command-region)
+       :help "Commands in this menu work on the region"]
+     [ "Fix the Region" TeX-pin-region
+       :active (or (if prefix-arg
+                      (<= (prefix-numeric-value prefix-arg) 0)
+                    (and (boundp 'TeX-command-region-begin)
+                         (markerp TeX-command-region-begin)))
+                  mark-active)
+       ;;:visible (eq TeX-command-current 'TeX-command-region)
+       :style toggle
+       :selected (and (boundp 'TeX-command-region-begin)
+                     (markerp TeX-command-region-begin))
+       :help "Fix the region for \"Command on Region\""]
+     "-"
+     ["Recenter Output Buffer" TeX-recenter-output-buffer
+      :help "Show the output of current TeX process"]
+     ["Kill Job" TeX-kill-job
+      :help "Kill the current TeX process"]
+     ["Next Error" TeX-next-error
+      :help "Jump to the next error of the last TeX run"]
+     ["Previous Error" TeX-previous-error
+      :help "Jump to the previous error of the last TeX run"
+      :visible TeX-parse-all-errors]
+     ["Error Overview" TeX-error-overview
+      :help "Open an overview of errors occured in the last TeX run"
+      :visible (and TeX-parse-all-errors (fboundp 'tabulated-list-mode))]
+     ["Quick View" TeX-view
+      :help "Start a viewer without prompting"]
+     "-"
+     ("TeXing Options"
+      ,@(mapcar (lambda (x)
+                 (let ((symbol (car x)) (name (nth 1 x)))
+                   `[ ,(format "Use %s engine" name) (TeX-engine-set ',symbol)
+                      :style radio :selected (eq TeX-engine ',symbol)
+                      :help ,(format "Use %s engine for compiling" name) ]))
+               (TeX-engine-alist))
       "-"
-      ("TeXing Options"
-       ,@(mapcar (lambda (x)
-                  (let ((symbol (car x)) (name (nth 1 x)))
-                    `[ ,(format "Use %s engine" name) (TeX-engine-set ',symbol)
-                       :style radio :selected (eq TeX-engine ',symbol)
-                       :help ,(format "Use %s engine for compiling" name) ]))
-                (TeX-engine-alist))
-       "-"
-       [ "Generate PDF" TeX-PDF-mode
-        :style toggle :selected TeX-PDF-mode
-        :active (not (eq TeX-engine 'omega))
-        :help "Use PDFTeX to generate PDF instead of DVI"]
-       ( "PDF from DVI"
-        :visible TeX-PDF-mode
-        :help "Compile to DVI with (La)TeX and convert to PDF"
-        [ "Compile directly to PDF"
-          (lambda () (interactive) (setq TeX-PDF-from-DVI nil))
-          :style radio :selected (null (TeX-PDF-from-DVI))
-          :help "Compile directly to PDF without intermediate conversions"]
-        [ "dvips + ps2pdf"
-          (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvips"))
-          :style radio :selected (equal (TeX-PDF-from-DVI) "Dvips")
-          :help "Convert DVI to PDF with dvips + ps2pdf sequence"]
-        [ "dvipdfmx"
-          (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvipdfmx"))
-          :style radio :selected (equal (TeX-PDF-from-DVI) "Dvipdfmx")
-          :help "Convert DVI to PDF with dvipdfmx"])
-       [ "Run Interactively" TeX-interactive-mode
-        :style toggle :selected TeX-interactive-mode :keys "C-c C-t C-i"
-        :help "Stop on errors in a TeX run"]
-       [ "Correlate I/O" TeX-source-correlate-mode
-        :style toggle :selected TeX-source-correlate-mode
-        :help "Enable forward and inverse search in the previewer"]
-       ["Debug Bad Boxes" TeX-toggle-debug-bad-boxes
-       :style toggle :selected TeX-debug-bad-boxes :keys "C-c C-t C-b"
-       :help "Make \"Next Error\" show overfull and underfull boxes"]
-       ["Debug Warnings" TeX-toggle-debug-warnings
-       :style toggle :selected TeX-debug-warnings
-       :help "Make \"Next Error\" show warnings"])
-      ["Compile and view" TeX-command-run-all
-       :help "Compile the document until it is ready and open the viewer"]))
+      [ "Generate PDF" TeX-PDF-mode
+       :style toggle :selected TeX-PDF-mode
+       :active (not (eq TeX-engine 'omega))
+       :help "Use PDFTeX to generate PDF instead of DVI"]
+      ( "PDF from DVI"
+       :visible TeX-PDF-mode
+       :help "Compile to DVI with (La)TeX and convert to PDF"
+       [ "Compile directly to PDF"
+         (lambda () (interactive) (setq TeX-PDF-from-DVI nil))
+         :style radio :selected (null (TeX-PDF-from-DVI))
+         :help "Compile directly to PDF without intermediate conversions"]
+       [ "dvips + ps2pdf"
+         (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvips"))
+         :style radio :selected (equal (TeX-PDF-from-DVI) "Dvips")
+         :help "Convert DVI to PDF with dvips + ps2pdf sequence"]
+       [ "dvipdfmx"
+         (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvipdfmx"))
+         :style radio :selected (equal (TeX-PDF-from-DVI) "Dvipdfmx")
+         :help "Convert DVI to PDF with dvipdfmx"])
+      [ "Run Interactively" TeX-interactive-mode
+       :style toggle :selected TeX-interactive-mode :keys "C-c C-t C-i"
+       :help "Stop on errors in a TeX run"]
+      [ "Correlate I/O" TeX-source-correlate-mode
+       :style toggle :selected TeX-source-correlate-mode
+       :help "Enable forward and inverse search in the previewer"]
+      ["Debug Bad Boxes" TeX-toggle-debug-bad-boxes
+       :style toggle :selected TeX-debug-bad-boxes :keys "C-c C-t C-b"
+       :help "Make \"Next Error\" show overfull and underfull boxes"]
+      ["Debug Warnings" TeX-toggle-debug-warnings
+       :style toggle :selected TeX-debug-warnings
+       :help "Make \"Next Error\" show warnings"])
+     ["Compile and view" TeX-command-run-all
+      :help "Compile the document until it is ready and open the viewer"])
    (let ((file 'TeX-command-on-current)) ;; is this actually needed?
-     (TeX-maybe-remove-help
-      (delq nil
-           (mapcar 'TeX-command-menu-entry
-                   (TeX-mode-specific-command-list mode)))))))
+     (delq nil
+          (mapcar #'TeX-command-menu-entry
+                  (TeX-mode-specific-command-list mode))))))
 
 (defun TeX-mode-specific-command-list (mode)
   "Return the list of commands available in the given MODE."
@@ -5128,88 +4999,86 @@ Brace insertion is only done if point is in a math 
construct and
     (nreverse out-list)))
 
 (defvar TeX-fold-menu
-  (TeX-menu-with-help
-   '("Show/Hide"
-     ["Fold Mode" TeX-fold-mode
-      :style toggle
-      :selected (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Toggle folding mode"]
-     "-"
-     ["Hide All in Current Buffer" TeX-fold-buffer
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Hide all configured TeX constructs in the current buffer"]
-     ["Hide All in Current Region" TeX-fold-region
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Hide all configured TeX constructs in the marked region"]
-     ["Hide All in Current Paragraph" TeX-fold-paragraph
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Hide all configured TeX constructs in the paragraph containing 
point"]
-     ["Hide Current Macro" TeX-fold-macro
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Hide the macro containing point"]
-     ["Hide Current Environment" TeX-fold-env
-      :visible (not (eq major-mode 'plain-tex-mode))
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Hide the environment containing point"]
-     ["Hide Current Comment" TeX-fold-comment
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Hide the comment containing point"]
-     "-"
-     ["Show All in Current Buffer" TeX-fold-clearout-buffer
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Permanently show all folded content again"]
-     ["Show All in Current Region" TeX-fold-clearout-region
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Permanently show all folded content in marked region"]
-     ["Show All in Current Paragraph" TeX-fold-clearout-paragraph
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Permanently show all folded content in paragraph containing 
point"]
-     ["Show Current Item" TeX-fold-clearout-item
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Permanently show the item containing point"]
-     "-"
-     ["Hide or Show Current Item" TeX-fold-dwim
-      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
-      :help "Hide or show the item containing point"]))
-   "Menu definition for commands from tex-fold.el.")
+  '("Show/Hide"
+    ["Fold Mode" TeX-fold-mode
+     :style toggle
+     :selected (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Toggle folding mode"]
+    "-"
+    ["Hide All in Current Buffer" TeX-fold-buffer
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Hide all configured TeX constructs in the current buffer"]
+    ["Hide All in Current Region" TeX-fold-region
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Hide all configured TeX constructs in the marked region"]
+    ["Hide All in Current Paragraph" TeX-fold-paragraph
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Hide all configured TeX constructs in the paragraph containing 
point"]
+    ["Hide Current Macro" TeX-fold-macro
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Hide the macro containing point"]
+    ["Hide Current Environment" TeX-fold-env
+     :visible (not (eq major-mode 'plain-tex-mode))
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Hide the environment containing point"]
+    ["Hide Current Comment" TeX-fold-comment
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Hide the comment containing point"]
+    "-"
+    ["Show All in Current Buffer" TeX-fold-clearout-buffer
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Permanently show all folded content again"]
+    ["Show All in Current Region" TeX-fold-clearout-region
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Permanently show all folded content in marked region"]
+    ["Show All in Current Paragraph" TeX-fold-clearout-paragraph
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Permanently show all folded content in paragraph containing point"]
+    ["Show Current Item" TeX-fold-clearout-item
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Permanently show the item containing point"]
+    "-"
+    ["Hide or Show Current Item" TeX-fold-dwim
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Hide or show the item containing point"])
+  "Menu definition for commands from tex-fold.el.")
 
 (defvar TeX-customization-menu nil)
 
 (defvar TeX-common-menu-entries
-  (TeX-menu-with-help
-   `(("Multifile/Parsing"
-      ["Switch to Master File" TeX-home-buffer
-       :help "Switch to buffer of Master File, or buffer of last TeX command"]
-      ["Save Document" TeX-save-document
-       :help "Save all buffers associated with the current Master File"]
-      ["Set Master File" TeX-master-file-ask
-       :active (not (TeX-local-master-p))
-       :help "Set the main file to run TeX commands on"]
-      ["Reset Buffer" TeX-normal-mode
-       :help "Save and reparse the current buffer for style information"]
-      ["Reset AUCTeX" (TeX-normal-mode t) :keys "C-u C-c C-n"
-       :help "Reset buffer and reload AUCTeX style files"])
-     ["Find Documentation..." TeX-documentation-texdoc
-      :help "Get help on commands, packages, or TeX-related topics in general"]
-     ["Read the AUCTeX Manual" TeX-goto-info-page
-      :help "Everything worth reading"]
-     ("Customize AUCTeX"
-      ["Browse Options"
-       (customize-group 'AUCTeX)
-       :help "Open the customization buffer for AUCTeX"]
-      ["Extend this Menu"
-       (progn
-        (easy-menu-add-item
-         nil
-         ;; Ugly hack because docTeX mode uses the LaTeX menu.
-         (list (if (eq major-mode 'doctex-mode) "LaTeX" TeX-base-mode-name))
-         (or TeX-customization-menu
-             (setq TeX-customization-menu
-                   (customize-menu-create 'AUCTeX "Customize AUCTeX")))))
-       :help "Make this menu a full-blown customization menu"])
-     ["Report AUCTeX Bug" TeX-submit-bug-report
-      :help ,(format "Problems with AUCTeX %s? Mail us!"
-                    AUCTeX-version)])))
+  `(("Multifile/Parsing"
+     ["Switch to Master File" TeX-home-buffer
+      :help "Switch to buffer of Master File, or buffer of last TeX command"]
+     ["Save Document" TeX-save-document
+      :help "Save all buffers associated with the current Master File"]
+     ["Set Master File" TeX-master-file-ask
+      :active (not (TeX-local-master-p))
+      :help "Set the main file to run TeX commands on"]
+     ["Reset Buffer" TeX-normal-mode
+      :help "Save and reparse the current buffer for style information"]
+     ["Reset AUCTeX" (TeX-normal-mode t) :keys "C-u C-c C-n"
+      :help "Reset buffer and reload AUCTeX style files"])
+    ["Find Documentation..." TeX-documentation-texdoc
+     :help "Get help on commands, packages, or TeX-related topics in general"]
+    ["Read the AUCTeX Manual" TeX-goto-info-page
+     :help "Everything worth reading"]
+    ("Customize AUCTeX"
+     ["Browse Options"
+      (customize-group 'AUCTeX)
+      :help "Open the customization buffer for AUCTeX"]
+     ["Extend this Menu"
+      (progn
+       (easy-menu-add-item
+        nil
+        ;; Ugly hack because docTeX mode uses the LaTeX menu.
+        (list (if (eq major-mode 'doctex-mode) "LaTeX" TeX-base-mode-name))
+        (or TeX-customization-menu
+            (setq TeX-customization-menu
+                  (customize-menu-create 'AUCTeX "Customize AUCTeX")))))
+      :help "Make this menu a full-blown customization menu"])
+    ["Report AUCTeX Bug" TeX-submit-bug-report
+     :help ,(format "Problems with AUCTeX %s? Mail us!"
+                   AUCTeX-version)]))
 
 
 ;;; Verbatim constructs
@@ -5863,7 +5732,8 @@ See also `TeX-font-replace' and 
`TeX-font-replace-function'."
          (regexp-quote TeX-dollar-string)))
 
 (defcustom TeX-math-toggle-off-input-method t
-  "*If non-nil, auto toggle off CJK input methods when entering math mode."
+  "If non-nil, auto turn off some input methods when entering math mode.
+See `TeX-math-input-method-off-regexp'."
   :group 'TeX-macro
   :type 'boolean)
 
@@ -6341,16 +6211,36 @@ the number of the file to view, anything else to skip: 
") list)))
                    ;; Exit gently if a `quit' signal is thrown.
                    (quit nil)))
                 (t (message "No documentation found for %s" pkg)))
-             ;; In any case quit-and-kill the window.  XXX: XEmacs doesn't have
-             ;; `quit-window', just kill the buffer in that case.
+             ;; In any case quit-and-kill the window.
              (when (get-buffer-window buffer)
-               (if (fboundp 'quit-window)
-                   (quit-window t (get-buffer-window buffer))
-                 (kill-buffer buffer)))))
+               (quit-window t (get-buffer-window buffer)))))
        ;; Called without prefix argument: just run "texdoc --view <pkg>" and
        ;; show the output, so that the user is warned in case it doesn't find
        ;; the documentation or "texdoc" is not available.
-       (message (shell-command-to-string (concat "texdoc --view " pkg)))))))
+       (message "%s"
+                ;; The folowing code to the end of `defun' used to be
+                ;; just
+                ;; (shell-command-to-string (concat "texdoc --view " pkg))
+                ;; , but in some cases it blocks emacs until the user
+                ;; quits the viewer (bug#28905).
+                (with-output-to-string
+                  (let* (;; Use pipe rather than pty because the
+                         ;; latter causes atril (evince variant
+                         ;; viewer) to exit before showing anything.
+                         (process-connection-type nil)
+                         (process (start-process-shell-command
+                                   "Doc view" standard-output
+                                   (concat "texdoc --view " pkg))))
+                    ;; Suppress the message "Process Doc view
+                    ;; finished".
+                    (set-process-sentinel process #'ignore)
+                    ;; Kill temp buffer without query.  This is
+                    ;; necessary, at least for some environment, if
+                    ;; the underlying shell can't find the texdoc
+                    ;; executable.
+                    (set-process-query-on-exit-flag process nil)
+                    ;; Don't discard shell output.
+                    (accept-process-output process))))))))
 
 (defun TeX-goto-info-page ()
   "Read documentation for AUCTeX in the info system."



reply via email to

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