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

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

[elpa] externals/auctex ba66331 56/57: Merge branch 'master' into extern


From: Tassilo Horn
Subject: [elpa] externals/auctex ba66331 56/57: Merge branch 'master' into externals/auctex
Date: Tue, 25 Jul 2017 14:02:36 -0400 (EDT)

branch: externals/auctex
commit ba66331012405fc3d4646bca2da594b19f008d35
Merge: 50798f3 fa24654
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Merge branch 'master' into externals/auctex
---
 ChangeLog-preview                         |    4 +
 ChangeLog.1                               | 1182 ++++++++++++++++++++++++++++-
 Makefile.in                               |    4 +-
 RELEASE                                   |  178 ++---
 configure.ac                              |    2 +-
 context.el                                |    5 +-
 doc/auctex.texi                           |    3 +
 doc/changes.texi                          |   55 +-
 doc/tex-ref.tex                           |    6 +-
 font-latex.el                             |   76 +-
 latex.el                                  |   43 +-
 latex/preview.dtx                         |   19 +-
 preview.el                                |  141 +++-
 prv-xemacs.el                             |   22 +-
 style/{expl3.el => australian.el}         |   28 +-
 style/beamer.el                           |    2 +-
 style/bicaption.el                        |    7 +-
 style/breqn.el                            |    2 +-
 style/{expl3.el => canadian.el}           |   28 +-
 style/caption.el                          |    5 +-
 style/comment.el                          |    8 +-
 style/empheq.el                           |    6 +-
 style/english.el                          |    2 +
 style/exam.el                             |    8 +-
 style/expl3.el                            |   12 +-
 style/floatrow.el                         |  726 ++++++++++++++++++
 style/fontspec.el                         |  396 +++++++---
 style/fvextra.el                          |    2 +-
 style/graphicx.el                         |   17 +-
 style/mdframed.el                         |    8 +-
 style/minted.el                           |   22 +-
 style/moodle.el                           |  213 ++++++
 style/{expl3.el => newzealand.el}         |   28 +-
 style/subcaption.el                       |    6 +-
 style/tcolorbox.el                        |    2 +-
 style/textcomp.el                         |   11 +-
 tests/context/context-indentation-in.tex  |   24 +
 tests/context/context-indentation-out.tex |   24 +
 tests/context/context-test.el             |   56 ++
 tests/japanese/error-parsing.el           |   64 ++
 tests/japanese/preview-error-test.tex     |   42 +
 tests/japanese/preview-error-test2.tex    |   20 +
 tests/japanese/preview-latex.el           |  302 ++++++++
 tests/japanese/prv-dif-code.tex           |   42 +
 tests/latex/fontification-general.tex     |  358 +++++++++
 tests/tex/compilation-log.txt             |    4 +
 tests/tex/error-parsing.el                |   27 +-
 tex-buf.el                                |  117 ++-
 tex-ispell.el                             |    6 +
 tex-jp.el                                 |   12 +-
 tex-site.el.in                            |    9 +-
 tex.el                                    |   76 +-
 52 files changed, 3986 insertions(+), 476 deletions(-)

diff --git a/ChangeLog-preview b/ChangeLog-preview
index 908ed2e..2ac1df2 100644
--- a/ChangeLog-preview
+++ b/ChangeLog-preview
@@ -1,3 +1,7 @@
+2017-07-24  Mosè Giordano  <address@hidden>
+
+       * Version 11.91 released.
+
 2017-01-10  Mosè Giordano  <address@hidden>
 
        * Version 11.90 released.
diff --git a/ChangeLog.1 b/ChangeLog.1
index 18afc81..bb74bd6 100644
--- a/ChangeLog.1
+++ b/ChangeLog.1
@@ -1,3 +1,1183 @@
+2017-07-24  Mosè Giordano  <address@hidden>
+
+       * Version 11.91 released.
+
+2017-07-24  Mosè Giordano  <address@hidden>
+
+       Prepare for upcoming release
+
+2017-07-22  Arash Esbati  <address@hidden>
+
+       Update key=val options to minted package v2.5
+
+       * style/minted.el (LaTeX-minted-key-val-options): Update options
+       to package version v2.5 from 2017/07/19.
+
+2017-07-21  Ikumi Keita  <address@hidden>
+
+       Conform to elisp coding conventions.
+
+       * latex.el (LaTeX-section-heading, LaTeX-environment)
+       (TeX-arg-document, LaTeX-arg-usepackage-read-packages-with-options)
+       (TeX-arg-bibstyle, TeX-arg-bibliography, TeX-arg-verb)
+       (LaTeX-fill-region): Taylor minibuffer prompt string. Add or taylor
+       "done" messages.
+       * tex-buf.el (TeX-command-query, TeX-printer-query): Ditto.
+       * tex.el (TeX-master-file-ask, TeX-master-file, TeX-update-style)
+       (TeX-auto-list-information, TeX-auto-generate): Ditto.
+
+2017-07-21  Ikumi Keita  <address@hidden>
+
+       * doc/changes.texi: Mention changes related to Japanese TeX.
+
+2017-07-03  Arash Esbati  <address@hidden>
+
+       * doc/auctex.texi (European): Add babel languages which load english.el.
+
+2017-07-03  Arash Esbati  <address@hidden>
+
+       Check and set `TeX-quote-language' if necessary
+
+       * style/english.el ("english"): Reset `TeX-quote-language' to nil
+       if changed by other babel language options.
+
+2017-07-03  Arash Esbati  <address@hidden>
+
+       Add new style/australian.el and style/newzealand.el
+
+       * Makefile.in (STYLESRC): Add new styles.
+
+       * style/australian.el:
+       * style/newzealand.el: New files.
+
+2017-07-02  Arash Esbati  <address@hidden>
+
+       Add new style/canadian.el
+
+       * Makefile.in (STYLESRC): Add new style.
+
+       * style/canadian.el: New file.
+
+2017-07-01  Arash Esbati  <address@hidden>
+
+       Add new style/moodle.el
+
+       * Makefile.in (STYLESRC): Add new style.
+
+       * style/moodle.el: New file.
+
+2017-07-01  Arash Esbati  <address@hidden>
+
+       * latex.el (LaTeX-babel-hyphen-language-alist): Fix typo in docstring.
+
+2017-06-17  Antoine Levitt  <address@hidden>
+
+       Add support for xreader viewer
+
+       * tex.el (TeX-evince-dbus-p):
+       (TeX-evince-sync-view-1):
+       (TeX-view-program-select-evince):
+       (TeX-raise-frame-function):
+       (TeX-source-correlate-mode): Adapt functions and docstrings to xreader.
+       (TeX-xreader-sync-view): New function.
+       (TeX-view-program-list-builtin): Add xreader.
+
+2017-06-14  Arash Esbati  <address@hidden>
+
+       Update key=value options to graphicx package version 1.1a
+
+       * style/graphicx.el (LaTeX-graphicx-key-val-options): Add new
+       key=value options.
+       (LaTeX-arg-graphicx-includegraphics-key-val): Support "pagebox"
+       key with pdfTeX or LuaTeX.
+
+2017-06-13  Arash Esbati  <address@hidden>
+
+       * style/beamer.el ("beamer"): Query for optional argument after \pause.
+
+2017-06-13  Mosè Giordano  <address@hidden>
+
+       Suggest to rerun LaTeX if xsim properties changed
+
+       * tex-buf.el (TeX-LaTeX-sentinel): Catch xsim warning suggesting to 
rerun LaTeX
+       and set LaTeX and next default command.
+
+2017-06-13  Mosè Giordano  <address@hidden>
+
+       Catch expl3 warnings
+
+       * tex-buf.el (LaTeX-warnings-regexp): Adapt regexp to the style of expl3
+       warnings.
+       * tests/tex/error-parsing.el (TeX-error-parsing-expl3-warnings): New 
test for
+       expl3 warnings.
+
+2017-06-02  Ikumi Keita  <address@hidden>
+
+       Correct actions on region file in included file not placed in master dir
+
+       * tex-buf.el (TeX-command-region): Call `TeX-region-file' with nil
+       `nondirectory' argument.
+       Fix a typo in doc string.
+       (TeX-command-default): Use `(TeX-region-file)' instead of `TeX-region'
+       for comparison with the given argument.
+
+2017-05-30  Ikumi Keita  <address@hidden>
+
+       Imporve fix for Bug#26694
+
+       * tex-buf.el (TeX-command): Update point in region file if the
+       command is "View".
+       (TeX-view):
+       (TeX-region-create): Pass the above job to `TeX-command'.
+       (TeX-region-update-point): Move point according to the column in
+       the original buffer.
+       Do nothing when `TeX-source-correlate-mode' is disabled.
+       Use `TeX-current-offset' instead of `TeX-line-number-at-pos' in
+       case narrowing is in effect in the original buffer.
+       * preview.el.in (preview-at-point): Revert previous commit in
+       accord with the changes above.
+       * tex.el (TeX-evince-sync-view-1): Use `TeX-current-offset'
+       instead of `TeX-line-number-at-pos' in case narrowing is in
+       effect in the original buffer.
+       Add FIXME comment about using `current-column'.
+       (TeX-synctex-output-page-1): Ditto.
+       Arrange regexp to pick up page number more correctly.
+       (TeX-view-program-list-builtin): Remove spurious quotation around
+       %b in SumatraPDF entry.
+
+2017-05-29  Mosè Giordano  <address@hidden>
+
+       * tests/tex/compilation-log.txt:
+       * tests/tex/error-parsing.el: Add test for error starting with 
exclamation mark.
+
+2017-05-26  Ikumi Keita  <address@hidden>
+
+       Resolve preview-latex incompatibility with Japanese TeX (Bug#25322)
+
+       * preview.el.in (preview-error-quote): Work consistently with
+       decoded text.  The idea of "encoding entire string beforehand and
+       decoding it at the last stage" was used previously, but that failed
+       with `japanese-shift-jis' coding system containing bytes which
+       happen to coincide with regexp meta characters.
+       (preview--decode-^^ab):
+       (preview--convert-^^ab): New functions.
+       (TeX-inline-preview-internal): Record the process coding system
+       for decode assigned already so that `preview-error-quote' can
+       decode the given text correctly afterward.  To achive that, change
+       the role of `preview-coding-system' together with the changes to
+       `preview-error-quote'.
+       Give back the command options provided in `(TeX-engine-alist)' to
+       latex command when preamble caching is enabled.
+       (preview-coding-system): Modify doc string according to the
+       changes above to `preview-error-quote' and
+       `TeX-inline-preview-internal'.
+       * tex-buf.el (TeX-adjust-process-coding-system): New function.
+       Adjust the process coding system for asynchronous process launched
+       within AUCTeX.
+       (TeX-after-start-process-function): Change default value to
+       `TeX-adjust-process-coding-system'.
+       * tex-jp.el (japanese-TeX-set-process-coding-system): Specify end
+       of line format on the coding systems assigned to process.
+       (): Don't set `japanese-TeX-set-process-coding-system' to
+       `TeX-after-start-process-function'.  It is now called within
+       `TeX-adjust-process-coding-system'.
+       * prv-xemacs.el (preview-buffer-recoding-alist): Fix docstring.
+       (coding-system-change-eol-conversion): Add advice because XEmacs
+       21.4 mule-ucs fails to define `utf-8' coding system to respond
+       properly to this function.
+       (preview-ps-quote-filename): Add advice so that this function is
+       not confused by backslashes as path separator in the return value
+       of XEmacs function.
+       * tests/japanese/preview-latex.el:
+       * tests/japanese/preview-error-test.tex:
+       * tests/japanese/preview-error-test2.tex:
+       * tests/japanese/prv-dif-code.tex: New files for regression test.
+
+2017-05-21  Mosè Giordano  <address@hidden>
+
+       Fix indentation in ConTeXt mode after indented optional argument
+
+       * context.el (ConTeXt-find-indent): Fix indentation.  Requested by 
Henri Menke.
+       * tests/context/context-test.el:
+       * tests/context/context-indentation-in.tex:
+       * tests/context/context-indentation-out.tex: New test files.
+
+2017-05-17  Ikumi Keita  <address@hidden>
+
+       Don't discard process output with `TeX-run-silent'
+
+       * tex-buf.el (TeX-run-silent): Associate the process to the buffer
+       "*TeX silent*".
+
+2017-05-15  Ikumi Keita  <address@hidden>
+
+       * tex.el (TeX-command-list): Fix typo in help string (mendex -> 
upmendex)
+
+2017-05-12  Arash Esbati  <address@hidden>
+
+       * latex.el (LaTeX-env-label-as-keyval): Use 
`buffer-substring-no-properties'.
+
+2017-05-11  Arash Esbati  <address@hidden>
+
+       * doc/changes.texi: Document recent changes.
+
+2017-05-10  Arash Esbati  <address@hidden>
+
+       * tests/latex/fontification-general.tex: New file.
+
+2017-05-10  Arash Esbati  <address@hidden>
+
+       Exclude arguments to math environments from fontification
+
+       * font-latex.el (font-latex-match-math-envII)
+       (font-latex-extend-region-backwards-math-envII): Match and exclude
+       optional and mandatory argument(s) to math environments from
+       fontification.
+
+2017-05-08  Arash Esbati  <address@hidden>
+
+       Improve further the exclusion of reserved characters
+
+       * font-latex.el (font-latex-match-simple-exclude-list): New
+       variable.
+       (font-latex-match-simple-command): Use
+       `font-latex-match-simple-exclude-list'.  Add check for docTeX mode
+       in order to remove "_" from the list.
+
+2017-05-06  Mosè Giordano  <address@hidden>
+
+       Work around bug#26694
+
+       * preview.el.in (preview-at-point): Let-bind 
`TeX-source-correlate-mode' to nil.
+       * tex-buf.el (TeX-region-create): Move point only when
+       `TeX-source-correlate-mode' is non-nil.
+
+2017-05-06  Arash Esbati  <address@hidden>
+
+       * latex/preview.dtx: Adjust contact email address.
+
+2017-05-04  Arash Esbati  <address@hidden>
+
+       * tex-ispell.el: Move entries from style/empheq.el to this file.
+
+       * latex/preview.dtx: Adjust modification date for CTAN.
+
+2017-05-03  Arash Esbati  <address@hidden>
+
+       Query for expl3 package options
+
+       * style/expl3.el (LaTeX-expl3-package-options): New function to
+       read package options from user.
+       Add missing file footer.
+
+2017-05-03  Arash Esbati  <address@hidden>
+
+       Add new style/floatrow.el
+
+       * Makefile.in (STYLESRC): Add new style.
+
+       * style/floatrow.el: New file.
+
+2017-05-02  Arash Esbati  <address@hidden>
+
+       Use `ispell-tex-arg-end' on parsed elements
+
+       * style/mdframed.el (LaTeX-mdframed-auto-cleanup, "mdframed"): Use
+       correct function `ispell-tex-arg-end'.
+
+2017-04-27  Arash Esbati  <address@hidden>
+
+       Improve exclusion of reserved characters from command matches
+
+       * font-latex.el (font-latex-match-simple-command): Skip matches
+       starting with reserved characters.
+
+2017-04-27  Arash Esbati  <address@hidden>
+
+       Add support for plus sign in macro syntax specification list
+
+       * font-latex.el (font-latex-match-command-with-arguments): Support
+       plus sign besides asterisk in specification of macro syntax.
+
+2017-04-27  Arash Esbati  <address@hidden>
+
+       Update style/fontspec.el to package version 2.6a
+
+       * style/fontspec.el (LaTeX-fontspec-font-features): Update
+       variable to package version 2.6a.
+       (LaTeX-fontspec-auto-cleanup): New function for parsing support
+       for \newfontfamily and \newfontface macros.
+       ("fontspec"): Add missing macros and environment.
+       (LaTeX-fontspec-package-options): Update with new options.
+
+2017-04-27  Arash Esbati  <address@hidden>
+
+       Consider the return value of `assq-delete-all'
+
+       * style/breqn.el (LaTeX-breqn-update-color-keys):
+       * style/fvextra.el (LaTeX-fvextra-update-key-val):
+       * style/mdframed.el (LaTeX-mdframed-update-style-key):
+       * style/minted.el (LaTeX-minted-update-key-vals):
+       * style/tcolorbox.el (LaTeX-tcolorbox-update-style-key): Use the
+       return value of `assq-delete-all' rather than looking at the saved
+       value of the temporary variable.
+
+2017-04-27  Arash Esbati  <address@hidden>
+
+       * latex.el (LaTeX-common-initialization): Add eminnershape macro.
+
+2017-04-26  Arash Esbati  <address@hidden>
+
+       * tex-ispell.el (TeX-ispell-skip-cmds-list): Add \addlinespace.
+
+2017-04-25  Tassilo Horn  <address@hidden>
+
+       Correctly exclude hypenation and thin spaces from command matches
+
+       * font-latex.el (font-latex-match-simple-command): Skip matches 
starting with
+       \- or \,.
+
+2017-04-25  Arash Esbati  <address@hidden>
+
+       Add LaTeX core command \oldstylenums
+
+       * font-latex.el (font-latex-built-in-keyword-classes): Add
+       \oldstylenums to "type-command" keyword class.
+
+       * latex.el (LaTeX-common-initialization): Add \oldstylenums to
+       LaTeX core commands.
+
+       * style/textcomp.el ("textcomp"): Remove \oldstylenums from
+       textcomp.el which is provided by LaTeX core.
+
+2017-04-24  Arash Esbati  <address@hidden>
+
+       Make preview.sty compatible with recent luatex
+
+       * latex/preview.dtx: Check if file luatex85.sty is loadable and
+       require the package (bug#25601).
+
+2017-04-24  Arash Esbati  <address@hidden>
+
+       Do not highlight control spaces with "\ "
+
+       * font-latex.el (font-latex-match-simple-command): Add space to
+       the list of characters to be ignored.
+
+2017-04-23  Arash Esbati  <address@hidden>
+
+       Adjust macros acc. to change in `LaTeX-paragraph-commands-regexp-make'
+
+       * style/bicaption.el ("bicaption"): Add \bicaption, \bicaptionbox,
+       \bisubcaption and \bisubcaptionbox to paragraph commands.
+
+       * style/caption.el ("caption"): Add \captionbox and \captionof to
+       paragraph commands.
+
+       * style/subcaption.el ("subcaption"): Add \subcaption and
+       \subcaptionbox to paragraph commands.
+
+2017-04-23  Arash Esbati  <address@hidden>
+
+       * style/exam.el ("exam"): Remove duplicate entries and backslash.
+
+2017-04-23  Uwe Brauer  <address@hidden>
+
+       Add the select environment and related macros to exam style.
+
+       * style/exam.el ("exam"): Add the select environment and related macros.
+
+2017-04-23  Tassilo Horn  <address@hidden>
+
+       Fix comment environment highlighting
+
+       * style/comment.el ("comment"): Don't set comment starter/ender but 
generic
+       comment delimiters.
+
+2017-04-21  Ikumi Keita  <address@hidden>
+
+       Add test for my last commit
+
+       * tests/japanese/error-parsing.el: New file.
+
+2017-04-21  Mosè Giordano  <address@hidden>
+
+       Do not highlight thin spaces with \,
+
+       * font-latex.el (font-latex-match-simple-command): Add comma to the 
list of
+       characters to be ignored.
+
+2017-04-19  Mosè Giordano  <address@hidden>
+
+       Fix parsing of LaTeX2e date formats
+
+       * tex-buf.el (TeX-LaTeX-sentinel): Support ISO date format, now used by
+       LaTeX2e.  Reported by Uwe Siart.
+       * tests/tex/error-parsing.el (TeX-LaTeX2e-date): Add a test for LaTeX2e 
date
+       formats.
+
+2017-04-19  Ikumi Keita  <address@hidden>
+
+       Improve error handling for Japanese users
+
+       * tex-buf.el (TeX-help-error): Use number based condition to
+       detect whether the search over `TeX-error-description-list'
+       comes to its last element.  Comparison with a literal string
+       breaks when tex-jp.el installs Japanese help messages into
+       `TeX-error-description-list'.
+
+2017-04-18  Ikumi Keita  <address@hidden>
+
+       Deal with strange file name
+
+       * tex-jp.el (): Increase `pos' in case the master file
+       name happens to contain special %-sequence.
+
+2017-04-17  Ikumi Keita  <address@hidden>
+
+       Support upmendex
+
+       * tex-jp.el (): Make "%(makeindex)" to expand to upmendex when
+       upmendex is available and `TeX-engine' is supported by it.
+       Add "%(dic)" expander for the dictionary option of (up)mendex.
+       * tex.el (TeX-command-list): Add "upMendex" entry.  Set 4th
+       element to t so that user will get a chance to supply
+       dictionary option to the command line string.
+
+2017-04-17  Tassilo Horn  <address@hidden>
+
+       Improve command highlighting to not be triggered by hyphenation
+
+       Reported by François Patte.
+
+2017-04-17  Tassilo Horn  <address@hidden>
+
+       Add proper copyright header to some styles
+
+       Add the required headers so that the ELPA build works again.
+
+2017-04-15  Arash Esbati  <address@hidden>
+
+       * doc/changes.texi: Update with recent changes.
+
+2017-04-10  Arash Esbati  <address@hidden>
+
+       * doc/auctex.texi (Selecting a Command): Document 
`TeX-ispell-verb-delimiters'.
+
+2017-04-04  Ikumi Keita  <address@hidden>
+
+       Fix `paragraph-start' and `paragraph-separate'
+
+       * plain-tex.el (plain-TeX-common-initialization): Remove "^" from
+       `paragraph-start' according to the doc string.
+       Remove LaTeX display math delimiters "\[" and "\]" from
+       `paragraph-start'.
+       Add "item" and "itemitem" to `paragraph-start'.
+       Change the regexp grouping to shy group in `paragraph-start' and
+       `paragraph-separate'.
+       * tex-info.el (TeX-texinfo-mode): Remove "^" from `paragraph-start'
+       and `paragraph-separate'.
+
+2017-04-03  Arash Esbati  <address@hidden>
+
+       Update package options in style/amsmath.el
+
+       * style/amsmath.el (LaTeX-amsmath-package-options): Update package
+       options to v2.16a.
+
+2017-04-01  Arash Esbati  <address@hidden>
+
+       Append \b to regexp built from TeX control words
+
+       * latex.el (LaTeX-paragraph-commands-regexp-make): Append \b to
+       regexp built from TeX control words.  Fix this report
+       http://lists.gnu.org/archive/html/auctex/2017-03/msg00009.html
+
+       * tests/latex/latex-filling-in.tex:
+       * tests/latex/latex-filling-out.tex:
+       * tests/latex/latex-test.el (LaTeX-filling): Extend test for addition
+       in `LaTeX-paragraph-commands-regexp-make' in latex.el.
+
+2017-03-31  Mosè Giordano  <address@hidden>
+
+       Fix detection of bibliography files with dots in path
+
+       * latex.el (LaTeX-auto-regexp-list): Remove dot from the list of 
excluded
+       characters in addbibresource's regexp.
+       * tests/latex/latex-test.el (LaTeX-addbibresource): New test for 
addbibresource.
+
+2017-03-29  Ikumi Keita  <address@hidden>
+
+       Don't alter standard value or saved value themselves of customize option
+
+       * tex-jp.el (): Stop using `setcar' on the elements of
+       `TeX-command-list'.  This used to alter the standard value
+       or saved value themselves of the customize option since
+       `setcar' operates descructively on lists as Lisp objects.
+       Instead create new list by `mapcar' and `append'.
+       (): Deal with the case that `TeX-view-program-list-builtin'
+       doesn't have an entry of "xdvi".
+       Change the expected executable name to "%(xdvi)" as well.
+
+2017-03-28  Arash Esbati  <address@hidden>
+
+       Fix last improvement for skipping of inline verbatim macros
+
+       * tex.el (TeX-ispell-tex-arg-verb-end): New function.
+
+       * tex-ispell.el (TeX-ispell-verb-delimiters): Replace
+       `TeX-ispell-verb-opening-delimiters' and
+       `TeX-ispell-verb-closing-delimiters' with new customizable option
+       `TeX-ispell-verb-delimiters'.
+       (TeX-ispell-skip-setcar): Use new function
+       `TeX-ispell-tex-arg-verb-end' with verbatim macros.
+
+2017-03-27  Arash Esbati  <address@hidden>
+
+       Improve skipping of inline verbatim macros
+
+       * tex-ispell.el (TeX-ispell-verb-opening-delimiters)
+       (TeX-ispell-verb-closing-delimiters): New customizable options.
+       (TeX-ispell-skip-setcar): Skip inline verbatim macros from
+       listings and fancyvrb package.  Use new variables for minted
+       package.
+
+2017-03-27  Arash Esbati  <address@hidden>
+
+       * tests/latex/fontification-verb-macros.tex: New file.
+
+2017-03-27  Arash Esbati  <address@hidden>
+
+       Improve fontification of verbatim macros in style/minted.el
+
+       * style/minted.el (LaTeX-minted-auto-cleanup): Add key=val query
+       and fontification support for parsed elements.
+       (LaTeX-minted-add-syntactic-keywords-extra): New function.
+       ("minted"): Use `LaTeX-minted-add-syntactic-keywords-extra' to add
+       fontification support for \mint and \mintinline macros.
+       Add \mint and \mintinline to textual keywords class and apply the
+       fontification only for optional and first mandatory argument.
+
+2017-03-27  Arash Esbati  <address@hidden>
+
+       Adapt fontification for \lstinline
+
+       * style/listings.el ("listings"): Fontify only the optional
+       argument of \lstinline.
+
+2017-03-27  Arash Esbati  <address@hidden>
+
+       Recognize optional argument in verb macros with delimiters/braces
+
+       * font-latex.el (font-latex-built-in-keyword-classes): Add \verb
+       to textual keyword class.
+       (font-latex-set-syntactic-keywords): Extend regexp to ignore an
+       optional argument for verbatim macros with delimiters and/or
+       braces.
+
+2017-03-26  Ikumi Keita  <address@hidden>
+
+       Add support for Japanese font command
+
+       * tex-jp.el (): Append entries for mincho and gothic font
+       commands to `LaTeX-font-list'.
+       (japanese-latex-mode-initialization): Add font lock support
+       to \textgt, \mathgt and \gtfamily commands for displaying
+       with bold font in Emacs buffer.
+       * doc/auctex.texi (Japanese): Mention new font commands and
+       add indexes for them.
+
+2017-03-23  Ikumi Keita  <address@hidden>
+
+       Enhance Japanese class files support
+
+       * style/tarticle.el:
+       * style/tbooks.el:
+       * style/treport.el:
+       * style/jsreport.el: Add new style files.
+       * Makefile.in (STYLESRC): Add them and tweak order not to break the
+       format of file name alignment.
+       * style/j-book.el ("j-book"): Correct the largest section level to
+       "part" following book.el.
+       * style/jarticle.el:
+       * style/jbook.el:
+       * style/jreport.el:
+       * style/jsarticle.el:
+       * style/jsbook.el: Add defvar for class options, counters and
+       pagestyles following {article,book,report}.el.
+       Correct the largest section level in jbook.el, too.
+       Deal with "report" option in jsbook.el.
+
+2017-03-24  Arash Esbati  <address@hidden>
+
+       * texmathp.el (texmathp-tex-commands-default): Add entries for 
empheq.sty.
+
+2017-03-23  Arash Esbati  <address@hidden>
+
+       * style/minted.el ("minted"): Add key=val query for \mint and 
\mintinline.
+
+2017-03-19  Ikumi Keita  <address@hidden>
+
+       Use `TeX-line-number-at-pos' further for older emacsen
+
+       * tex-buf.el (TeX-region-create):
+       (TeX-region-update-point):
+       * tex-info.el (Texinfo-make-node-list): Replace `line-number-at-pos'
+       with `TeX-line-number-at-pos'.
+
+2017-03-19  Ikumi Keita  <address@hidden>
+
+       Use compatibility function `TeX-line-number-at-pos' for older emacsen
+
+       * tex.el (TeX-evince-sync-view-1):
+       (TeX-synctex-output-page-1): Replace `line-number-at-pos' with
+       `TeX-line-number-at-pos'.
+
+2017-03-18  Arash Esbati  <address@hidden>
+
+       Use the variable `LaTeX-listing-label'
+
+       * style/minted.el ("minted"):
+       * style/newfloat.el (LaTeX-newfloat-auto-cleanup): Use
+       `LaTeX-listing-label' instead of hard-coded "lst:" string.
+
+2017-03-18  Arash Esbati  <address@hidden>
+
+       Use compat function `TeX-replace-regexp-in-string' in core files
+
+       * tex.el (TeX-source-correlate-sync-source):
+       * latex.el (LaTeX-split-bibs): Use compat function
+       `TeX-replace-regexp-in-string'.
+
+2017-03-18  Arash Esbati  <address@hidden>
+
+       Use `TeX-replace-regexp-in-string' in style files
+
+       * style/empheq.el (LaTeX-empheq-item-equation):
+       * style/tcolorbox.el (LaTeX-tcolorbox-load-used-libraries):
+       * style/xcolor.el (LaTeX-xcolor-auto-cleanup): Use compat function
+       `TeX-replace-regexp-in-string'.
+
+2017-03-18  Arash Esbati  <address@hidden>
+
+       Add new compat function `TeX-replace-regexp-in-string'
+
+       * tex.el (TeX-replace-regexp-in-string): New compat function.
+       With XEmacs, pass arguments to `replace-in-string', with Emacs to
+       `replace-regexp-in-string'.  This function supports only mandatory
+       arguments of the original functions just mentioned.
+
+2017-03-17  Ikumi Keita  <address@hidden>
+
+       Avoid altering user option as much as possible
+
+       * tex-jp.el (): Alter `TeX-view-predicate-list-builtin' and
+       `TeX-view-program-list-builtin' instead of their customize option
+       cousins.
+       Append to `TeX-view-program-selection' only on w32 system.
+
+2017-03-16  Arash Esbati  <address@hidden>
+
+       Add LaTeX inline math delimiters to Ispell skip list
+
+       * tex-ispell.el: Add LaTeX inline math delimiters \( \) to Ispell
+       skip list.  (bug#26125)
+       Remove unnecessary part from regexp for \cmidrule.
+
+2017-03-15  Arash Esbati  <address@hidden>
+
+       Fix addition of key=val's
+
+       * style/fvextra.el (LaTeX-fvextra-update-key-val): Fix addition of
+       key=val's to `LaTeX-fancyvrb-key-val-options-local'.
+
+2017-03-15  Ikumi Keita  <address@hidden>
+
+       Modify `TeX-expand-list-builtin' instead of `TeX-expand-list'
+
+       * tex-jp.el (): `TeX-expand-list' is user option since 2015.  Add
+       extra entries for Japanese TeX engines to `TeX-expand-list-builtin'
+       instead.
+
+2017-03-13  Arash Esbati  <address@hidden>
+
+       Add new style/fvextra.el
+
+       * Makefile.in (STYLESRC): Add new style.
+
+       * style/fvextra.el: New file.
+
+2017-03-13  Arash Esbati  <address@hidden>
+
+       Improve parsing capabilities of style/fancyvrb.el
+
+       * style/fancyvrb.el (LaTeX-fancyvrb-key-val-options): Add
+       undocumented keys, update some values.
+       (LaTeX-fancyvrb-key-val-options-local)
+       (LaTeX-fancyvrb-base-macros, LaTeX-fancyvrb-base-environments)
+       (LaTeX-fancyvrb-key-val-skip-regexp): New variables.
+       (LaTeX-fancyvrb-macro-regexp, LaTeX-fancyvrb-environment-regexp):
+       Update for new parsing mechanism.
+       (LaTeX-fancyvrb-arg-define-macro)
+       (LaTeX-fancyvrb-arg-define-environment)
+       (LaTeX-fancyvrb-arg-file-relative): New functions.
+       ("fancyvrb"): Use new variables and functions in the hook.  Update
+       fontification.
+
+2017-03-10  Arash Esbati  <address@hidden>
+
+       Improve fallback for indentation when & is omitted
+
+       * latex.el (LaTeX-hanging-ampersand-position): Improve handling of
+       fallback which now respects also intended tabular environments.
+       Thanks to Ikumi Keita for testing and providing code.  (bug#26032)
+
+       * tests/latex/tabular-in.tex:
+       * tests/latex/tabular-out.tex: Add additional test for indented
+       tabular.
+
+2017-03-09  Ikumi Keita  <address@hidden>
+
+       Remove spurious entries of view settings.
+
+       * tex-jp.el (TeX-view-program-list):
+       (TeX-view-program-selection): Remove spurious entries, most of which
+       are related with other TeX IDEs.
+       cf. http://lists.gnu.org/archive/html/auctex-devel/2016-04/msg00036.html
+
+2017-03-09  Arash Esbati  <address@hidden>
+
+       Add fallback for indentation when & is omitted
+
+       * latex.el (LaTeX-hanging-ampersand-position): Add fallback for
+       indentation if the row searched does not contain a column
+       separator &.
+
+       * tests/latex/tabular-in.tex:
+       * tests/latex/tabular-out.tex: Add filling test for missing & in
+       row.
+
+2017-02-06  Ikumi Keita  <address@hidden>
+
+       Fix auto selection of japanese TeX engine
+
+       * tex-jp.el (japanese-latex-mode-initialization): Use
+       `LaTeX-match-class-option' to detect uplatex option given to
+       jsarticle, jsreport and jsbook class.  (The root of this problem is
+       the same as Bug#25563)
+       (): Quit appending to `LaTeX-command-style' because this made the
+       user's intentional selection of `TeX-engine' ineffective with regard
+       to the selection of the executable names.
+       Fix copyright year.
+       * doc/auctex.texi (Japanese): Add description of Japanese TeX engine:
+       How to use, change and set the value of the engine.
+       Add description of the customize options related to the encoding of
+       Japanese TeX documents.
+
+2017-03-08  Arash Esbati  <address@hidden>
+
+       Detect \& in tabular cells when filling
+
+       * latex.el (LaTeX-indent-tabular): Search backward for any
+       ampersands not escaped with a backslash, i.e. control symbol \&,
+       and return the adjusted value.  Thanks to Ikumi Keita for his
+       perceptive comments on the implementation.  (bug#26010)
+
+       * tests/latex/tabular-in.tex:
+       * tests/latex/tabular-out.tex: Add test for table filling with \&
+       in cells.
+
+2017-03-06  Arash Esbati  <address@hidden>
+
+       * tex-ispell.el (TeX-ispell-skip-cmds-list): Add hyperref macros.
+
+2017-03-05  Arash Esbati  <address@hidden>
+
+       * tex-ispell.el (TeX-ispell-skip-setcdr): Add entry for filecontents 
package.
+
+2017-03-04  Ikumi Keita  <address@hidden>
+
+       Fix documents and add trivial improvements.
+
+       * font-latex.el (font-latex-deactivated-keyword-classes): Add keyword
+       class biblatexnoarg, biblatex and slide-title to doc string.
+       Use `buffer-string'.
+       (font-latex-keyword-matcher): Mention that face attributes is accepted
+       as FACE argument in doc string.
+       (font-latex-make-built-in-keywords): Arrange doc string for generated
+       defvar of `font-latex-match-*-keywords-local' depending on the keyword
+       type.
+       Remove spurious type declaration from generated defcustom of
+       `font-latex-match-*-keywords'.
+       Replace meaningless argument with nil and add doc string for generated
+       defvar of `font-latex-match-*'.
+       Replace redundant call to intern with literal quote of symbol.
+       (font-latex-user-keyword-classes): Fix doc string.  The accepted face
+       argument is face attribute rather than font specification.
+       Add doc string for generated defvar of `font-latex-match-*'.
+       (font-latex-make-user-keywords): Replace backquote with quote where
+       backquote is not necessary.
+       (font-latex-add-keywords): Add keyword class biblatexnoarg to doc
+       string.
+       * doc/auctex.texi (): Update copyright year.
+       (Deactivating defaults of built-in keyword classes): Add keyword
+       class biblatexnoarg, biblatex and slide-title.
+       Fix sample lisp code.
+       (User-defined keyword classes): The accepted face argument is face
+       attribute rather than font specification.
+
+2017-03-04  Ikumi Keita  <address@hidden>
+
+       Make customization to face specification to appear in
+       customization buffer.
+
+       * font-latex.el (font-latex-user-keyword-classes): Exchange the order
+       of `face' and `custom-face-edit'.  Tweak doc string.
+
+2017-03-04  Ikumi Keita  <address@hidden>
+
+       Unify treatment of face argument over the relevant functions.
+
+       * font-latex.el (font-latex-keyword-matcher): Conform the face
+       argument correctly to the format `font-lock-keywords' requires.
+       (font-latex-make-user-keywords) : Call `font-latex-make-match-defun'
+       directly without `eval'.
+       (font-latex-deactivated-keyword-classes) : Accept a face symbol, as
+       well as a form returning a face symbol, for the third element for each
+       item of `font-latex-built-in-keyword-classes'.
+       (font-latex-built-in-keyword-classes) : Remove quoting from the face
+       names.  Contrary to the sentence of the doc string
+       "The third element is the symbol of a face to be used or a Lisp
+       form returning a face symbol.", symbol of a face was invalid due to
+       the above bugs.
+
+2017-03-04  Ikumi Keita  <address@hidden>
+
+       Fix font-latex-make-match-defun to generate intended code.
+
+       * font-latex.el (font-latex-make-match-defun): Arrange the order of
+       evaluation not to generate meaningless clause.  Byte compile warning
+       on xemacs went away.
+
+2017-03-04  Mosè Giordano  <address@hidden>
+
+       Partially revert previous commit, will look better later
+
+       * tex-buf.el (TeX-command-expand): Do not error if `string' is nil.  
This made
+       "View" command unusable.
+
+2017-03-04  Mosè Giordano  <address@hidden>
+
+       Prevent infinite loop in TeX-command-expand
+
+       * tex-buf.el (TeX-command-expand): Throw an error if `string' is not a 
string.
+       This prevents an infinite loop.
+       * tex.el (TeX-engine-in-engine-alist): New function to pick up an 
engine from
+       `TeX-engine-alist' and throw an error if the engine is not there.
+       (TeX-expand-list-builtin): Use `TeX-engine-in-engine-alist'.
+       * context.el (ConTeXt-expand-options): Use `TeX-engine-in-engine-alist'.
+       * tests/tex/command-expansion.el (TeX-command-expansion-errors): Add 
tests for
+       error handling of `TeX-command-expand'.
+
+2017-02-24  Ikumi Keita  <address@hidden>
+
+       Tweak locale treatment on xemacs.
+
+       * tex-jp.el (japanese-TeX-set-process-coding-system): Use the locale
+       related environment variables for fallback value.
+
+2017-02-21  Arash Esbati  <address@hidden>
+
+       Add new style/sourcecodepro.el
+
+       * Makefile.in (STYLESRC): Add new style.
+
+       * style/sourcecodepro.el: New file.
+
+2017-02-21  Arash Esbati  <address@hidden>
+
+       * style/subfiles.el (LaTeX-subfiles-class-options): New function.
+
+2017-02-04  Ikumi Keita  <address@hidden>
+
+       Make papersize predicate in tex-jp.el to work again.
+       Problem parallel to bug#25563.
+
+       * tex-jp.el (): Use `LaTeX-match-class-option' to examine paper size
+       option of document class.
+
+2017-02-14  Ikumi Keita  <address@hidden>
+
+       Fix setting of coding system for Japanese TeX
+
+       * tex-jp.el (japanese-TeX-set-process-coding-system): Cater for the
+       case that kanji option is requested by user but cannot be determined.
+       XEmacs doesn't have `locale-coding-system'.  Use
+       `get-coding-system-from-locale' and `current-locale' instead.
+       Cleanup indentation.
+       (japanese-TeX-coding-ejsu): Add entry for xemacs coding system of cp932.
+
+2017-02-20  Mosè Giordano  <address@hidden>
+
+       Improve regexp for looking for documentclass macro
+
+       * latex.el (LaTeX-env-document): Allow any non line-breaking character 
in regexp
+         used to look for `documentclass' macro.  Previous regexp did not 
catch class
+         options containing dots or slash, that may occur when using 
`subfiles' class.
+
+2017-02-20  Mosè Giordano  <address@hidden>
+
+       Improve determination of master file with subfiles class
+
+       * style/subfiles.el ("subfiles"): Do not strip dirname from master file.
+
+2017-02-19  Arash Esbati  <address@hidden>
+
+       Add new keys for package version 4.00
+
+       * style/tcolorbox.el (LaTeX-tcolorbox-keyval-options): Add new
+       keys for v4.00 of the package.
+
+2017-02-16  Arash Esbati  <address@hidden>
+
+       * latex.el (LaTeX-label): Eliminate premature returning of label.
+
+2017-02-16  Arash Esbati  <address@hidden>
+
+       Append "lstlisting" to `LaTeX-label-alist'
+
+       * style/listings.el ("listings"): Append "lstlisting" to
+       `LaTeX-label-alist'.
+       (LaTeX-listings-auto-cleanup): Use `LaTeX-listing-label' as a
+       symbol during clean up.
+
+2017-02-10  Arash Esbati  <address@hidden>
+
+       Add new style/preview.el
+
+       * Makefile.in (STYLESRC): Add new style.
+
+       * style/preview.el: New file.
+
+2017-02-10  Arash Esbati  <address@hidden>
+
+       * .gitignore: Ignore only preview.el in top directory.
+
+2017-02-10  Arash Esbati  <address@hidden>
+
+       Improve parsing process in style/xcolor.el
+
+       * style/xcolor.el (LaTeX-xcolor-definecolor-regexp): Use
+       `regexp-opt' to build a regexp to match all color defining macros.
+       (LaTeX-xcolor-colorlet-regexp): Remove variable.
+       (LaTeX-xcolor-auto-cleanup): Romove unnecessary *.
+
+2017-02-09  Arash Esbati  <address@hidden>
+
+       Improve parsing process in style/color.el
+
+       * style/color.el (LaTeX-color-definecolor-regexp): Remove
+       unnecessary 2nd and 3rd arguments from regexp.
+       (LaTeX-color-auto-cleanup): Delete unnecessary function and remove
+       it from `TeX-auto-cleanup-hook'.
+
+2017-02-09  Arash Esbati  <address@hidden>
+
+       Fix parsing bug in style/xcolor.el
+
+       * style/xcolor.el (LaTeX-xcolor-definecolor-regexp): Move parsing
+       of \colorlet macro into `LaTeX-xcolor-colorlet-regexp'.
+       (LaTeX-xcolor-colorlet-regexp): New variable.
+       ("xcolor"): Activate `LaTeX-xcolor-colorlet-regexp' in style hook.
+
+2017-02-06  Arash Esbati  <address@hidden>
+
+       * latex/preview.dtx: Fix example for \PreviewMacro* macro.
+       Add missing backslash.
+
+2017-02-04  Ikumi Keita  <address@hidden>
+
+       Fix minor problems
+       * tex.el (TeX-view-predicate-list-builtin): Enclose whole alternatives
+       in regexp with shy group in order that the effect of "\`" and "\'"
+       covers all the alternatives.
+       * latex.el (LaTeX-auto-cleanup): Regard "Class", in addition to
+       "class", as an indicator of LaTeX2e document.
+
+2017-02-02  Arash Esbati  <address@hidden>
+
+       Simplify addition of entirely skipped environments
+
+       * tex-ispell.el (TeX-ispell-skip-envs-list): New variable for
+       environments which should be skipped entirely.
+       (TeX-ispell-skip-envs-regexp): New variable keeping the regexp
+       generated from `TeX-ispell-skip-envs-list'.
+
+2017-02-02  Tassilo Horn  <address@hidden>
+
+       Fix TeX-view-predicate-list-builtin predicates wrt class opts
+
+       * latex.el (LaTeX-match-class-option): New function.
+       * tex.el (TeX-view-predicate-list-builtin): Use above function to check
+       paper sizes orientation from documentclass options (bug#25563).
+
+2017-02-01  Mosè Giordano  <address@hidden>
+
+       Fix number of arguments of local-variable-p in XEmacs
+
+       * font-latex.el (font-latex-after-hacking-local-variables): Second 
argument of
+       `local-variable-p' is mandatory in XEmacs.
+
+2017-02-01  Tassilo Horn  <address@hidden>
+
+       Fix font-latex-after-hacking-local-variables on XEmacs
+
+       * font-latex.el (font-latex-after-hacking-local-variables): Cater for 
the
+       fact that file-local-variables-alist isn't there in XEmacs and older
+       Emacs versions (bug#25564).
+
+2017-02-01  Arash Esbati  <address@hidden>
+
+       * tex-ispell.el: Add support for enviroments from breqn.sty.
+
+2017-02-01  Tassilo Horn  <address@hidden>
+
+       Fix plain-TeX-auto-regexp-list docstring
+
+       * tex.el: Fix docstring of plain-TeX-auto-regexp-list (bug#25574).
+
+2017-01-29  Arash Esbati  <address@hidden>
+
+       Add new style/breqn.el
+
+       * Makefile.in (STYLESRC): Add new style.
+
+       * style/breqn.el: New file.
+
+2017-01-29  Arash Esbati  <address@hidden>
+
+       Update style/listings.el to use `LaTeX-env-label-as-keyval'
+
+       * style/listings.el (LaTeX-listings-key-val-options): Comment the
+       "label" key.
+       (LaTeX-listings-key-val-label-extract):
+       (LaTeX-listings-key-val-label-regexp): New variable.
+       (LaTeX-listings-auto-cleanup): Use `LaTeX-add-environments'
+       instead of adding new enviroments to `LaTeX-auto-environment'.
+       Use the function `LaTeX-env-label-as-keyval' to insert labels.
+       Add parsed enviroments to AUCTeX parser with `TeX-auto-add-regexp'.
+       ("listings"): Add `LaTeX-listings-key-val-label-regexp' to the
+       parser.
+       Use `LaTeX-env-label-as-keyval' for "lstlisting".
+
+2017-01-29  Arash Esbati  <address@hidden>
+
+       Add function to put labels in opt. argument of environments
+
+       * doc/changes.texi: Document new feature.
+
+       * latex.el (LaTeX-listing-label): New custom prefix for labels in
+       code typesetting environments.
+       (LaTeX-env-label-as-keyval): New function.
+       (LaTeX-narrow-to-environment): Fix typo in docstring.
+
+2017-01-27  Arash Esbati  <address@hidden>
+
+       Add `NO-INSERT' argument to `LaTeX-label'
+
+       * doc/changes.texi: Document changes to `LaTeX-label' and
+       `LaTeX-label-function'.
+
+       * latex.el (LaTeX-label): Add second optional argument NO-INSERT.
+       This argument is passed to function bound to
+       `LaTeX-label-function' (usually `reftex-label' with RefTeX
+       enabled).  If `LaTeX-label-function' is nil and NO-INSERT is
+       non-nil, label is read and returned as a string.  Remove some
+       unnecessary checks.
+       (LaTeX-label-function): Mention in docstring that the function is
+       expected to take an optional argument NO-INSERT.  This is an
+       incompatible change.
+
+2017-01-27  Arash Esbati  <address@hidden>
+
+       Check if label is defined before adding it to known labels
+
+       * latex.el (TeX-read-label): Check if label is already defined and
+       ask for user confirmation before adding it list of known labels.
+       Do not add label if empty string or the value of
+       `TeX-read-label-prefix'.
+
+2017-01-26  Arash Esbati  <address@hidden>
+
+       Add \citetitle to `reftex-cite-format' in style/biblatex
+
+       * style/biblatex.el ("biblatex"): Add \citetitle[*] to
+       `reftex-cite-format' and bind them to keys i/I per user request
+       http://lists.gnu.org/archive/html/auctex/2017-01/msg00049.html.
+
+2017-01-25  Mosè Giordano  <address@hidden>
+
+       Guard setcar with appropriate test
+
+       * tex-jp.el (assoc): Replace second element of "BibTeX" and "Index" 
entries of
+       `TeX-command-list' only if they are already there.  This variable is
+       customizable and users may have removed them.  Reported by jfbu.
+
+2017-01-20  Mosè Giordano  <address@hidden>
+
+       * latex.el (LaTeX-newline): Make interactive.  See bug#24412.
+
+2017-01-20  Mosè Giordano  <address@hidden>
+
+       Add makeglossaries to the list of commands
+
+       * tex.el (TeX-command-list): Add makeglossaries.  Fixes bug#24952.
+       * latex.el (LaTeX-clean-intermediate-suffixes): Add extensions of files 
created
+         by makeglossaries.
+
+2017-01-15  Mosè Giordano  <address@hidden>
+
+       Show summary of tests at the end of make check
+
+       * tests/Makefile (check): Depend on `check-doit' and `mostlyclean' phony
+         targets.
+       (check-doit): New rule for showing summary of tests.
+       (mostlyclean): Delete log files.
+
+2017-01-13  Davide G. M. Salvetti  <address@hidden>
+
+       Fix ConTeXt-outline-regexp
+
+       Add a separator between different elements; see Debian bug #850444.
+
+2017-01-13  Mosè Giordano  <address@hidden>
+
+       Remove also a gitignore
+
+       * Makefile.in (EXCLUDEDFILES): Add latex/.gitignore to excluded files.
+
+2017-01-13  Mosè Giordano  <address@hidden>
+
+       Remove file from distributed tar ball
+
+       * Makefile.in (EXCLUDEDFILES): Add doc/tex-ref.log.
+
+2017-01-12  Mosè Giordano  <address@hidden>
+
+       Add AUCTeX Logo
+
+       * etc/auctex-logo.tex: Logo of AUCTeX.  It was realized with comments 
from
+       Vincent Belaïche, Marcin Borkowski, Marta Dell’Atti, Tamas Papp and 
others.
+
+       * .gitignore: Ignore some files automatically created during 
compilation.
+
+2017-01-11  Mosè Giordano  <address@hidden>
+
+       Make gitlog-to-changelog ignore release-commit
+
+       * Makefile.in (release-commit): Prefix the commit message with "; ", so 
that
+       the commit will be ignored when automatically updating the ChangeLog.
+
 2017-01-10  Mosè Giordano  <address@hidden>
 
        * Version 11.90 released.
@@ -20825,7 +22005,7 @@
 
 This file records repository revisions from
 commit c865982cacab289f4480f9145b3438ec06824232 (exclusive) to
-commit 826f17aeaf158b81653c2d9a03641c49d15d50fa (inclusive).
+commit 17118fb3aabba5a158c8ff8b4f5ec4f215547d2b (inclusive).
 
 ;; Local Variables:
 ;; coding: utf-8
diff --git a/Makefile.in b/Makefile.in
index a454950..4114d0e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -165,7 +165,9 @@ STYLESRC = style/prosper.el \
           style/titleps.el   style/titlesec.el  style/titletoc.el \
           style/exam.el      style/breqn.el     style/sourcecodepro.el \
           style/preview.el   style/fvextra.el   style/jurabib.el \
-          style/csquotes.el  style/babel.el     style/dk-bib.el
+          style/csquotes.el  style/babel.el     style/dk-bib.el \
+          style/floatrow.el  style/moodle.el    style/canadian.el \
+          style/australian.el style/newzealand.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/RELEASE b/RELEASE
index d3253e2..015ff39 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1,4 +1,4 @@
-Release notes for AUCTeX 11.90 with preview-latex
+Release notes for AUCTeX 11.91 with preview-latex
 =================================================
 
 AUCTeX provides by far the most wide-spread and sophisticated
@@ -24,104 +24,82 @@ sleuth work, testing.
 New features and fixed bugs in this release
 -------------------------------------------
 
-In addition to the completion performed by 'TeX-complete-symbol',
-AUCTeX now also supports the new Emacs standard completion-at-point
-facility (see the Emacs command 'completion-at-point').  This also
-means that modern completion UIs like company-mode work out of the
-box in TeX and LaTeX buffers.
-
-Completion is now aware of being inside a math environment and then
-completes math macros.
-
-AUCTeX is able to display several levels of super- and subscripts,
-each one raised above and a bit smaller than its basis.  For this
-feature, have a look at the customize options
-'font-latex-fontify-script' (especially the new values 'multi-level'
-and 'invisible') and 'font-latex-fontify-script-max-level'.  Also, the
-script characters '^' and '_' are also fontified with a special face
-named 'font-latex-script-char-face'.
-
-Parsing of format specification in various tabular environments has
-been improved.  The function 'LaTeX-insert-item' ('C-c <LFD>') inserts
-suitable number of ampersands for '*{num}{cols}' constructs.  Style
-files for LaTeX packages 'tabularx', 'tabulary', 'longtable',
-'dcolumn' and 'siunitx' are adapted to take advantage of this
-improvement.
-
-AUCTeX has a new Ispell dictionary 'tex-ispell.el' for macros and
-environments which will be skipped during spell checking.  The
-activiation of this feature is controlled by a new customize option
-'TeX-ispell-extend-skip-list', which is set to 't' and activated by
-default.
-
-AUCTeX has a new customize option 'TeX-raise-frame-function' that is
-currently only used by Evince and Atril inverse search to raise the
-Emacs frame.
-
-When inserting a new float, AUCTeX will now prompt for a short-caption
-if the length of the caption provided is greater than a certain size.
-This size is controlled via a new user option
-'LaTeX-short-caption-prompt-length'.
-
-Parsing of the compilation log has been reworked.  You should
-encounter fewer mistaken files while navigating through errors and
-warnings.
-
-Two new user options, 'TeX-ignore-warnings' and
-'TeX-suppress-ignored-warnings', allow ignoring certain warnings
-after compilation of the document.
-
-A new option, 'TeX-PDF-from-DVI', controls if and how to produce a PDF
-file by converting a DVI file.  This supersedes
-'TeX-PDF-via-dvips-ps2pdf' which is still recognized but marked as
-obsolete and may be removed in future releases.
-
-Support for a number of external viewers has been added:
-   * Atril viewer.  Forward and inverse search requires version
-     1.9.1 or later to work.
-
-   * dviout viewer on Windows.  Note that this setup works when
-     'TeX-source-correlate-method' is set to use 'source-specials'
-     for DVI, e.g.:
-          (setq TeX-source-correlate-method
-                '((dvi . source-specials)
-                  (pdf . synctex)))
-     which is the default.
-
-   * SumatraPDF viewer on Windows.
-
-   * Zathura viewer.  Forward and inverse search requires a recent
-     version of the program to work (3.4 or later).
-
-A new function, 'TeX-documentation-texdoc', for reading
-documentation with 'texdoc' has been added.  'TeX-doc' is still
-available but now 'C-c ?' runs 'TeX-documentation-texdoc'.
-
-AUCTeX has a new custom option
-'LaTeX-reftex-cite-format-auto-activate' which controls the automatic
-activation of citation formats provided by RefTeX when a style file is
-loaded and RefTeX is enabled.  Currently, 'biblatex.el', 'harvard.el',
-'jurabib.el' and 'natbib.el' use this feature.  If you have customized
-'reftex-cite-format' and want to use your settings, you should set
-this variable to 'nil'.
-
-AUCTeX now has limited support for the TikZ package.  For the moment,
-this includes some basic support for prompting the user of arguments
-to the '\draw' macro.
-
-The style 'graphicx.el' went through a bigger overhaul.  The optional
-argument of command '\includegraphics' now supports key-val query;
-keys can independently be chosen anytime by pressing the <,> key.  As
-a side effect, the variable 'LaTeX-includegraphics-options-alist' is
-now no-op and is removed from 'tex-style.el'.  You can safely remove
-any customization of it from your init file.  The mandatory argument
-of '\includegraphics' knows about image file extensions supported by
-the used engine and offers them for inclusion.
-
-Support for other LaTeX packages was improved, and style files for
-several new packages were added.
-
-Many bugs were crushed along the way.
+Now AUCTeX has a logo.  The LaTeX code to create it is available in
+the 'etc/' directory of the package.
+
+Add support for 'upmendex', an extension of 'makeindex' capable of
+sorting indexes by unicode based ICU.
+
+Fix preview-latex to interact correctly with Japanese LaTeX.  The
+parsing routine was made robust not to be confused by the 7-bit
+encoding of Japanese text and the necessary option to LaTeX command
+is kept even when preamble caching is enabled.
+
+The new "Glossaries" entry in 'TeX-command-list' runs the command
+'makeglossaries'.
+
+Fontification of control symbols has been improved.  Characters
+defined in 'font-latex-match-simple-exclude-list' do not receive
+any fontification.  In DocTeX mode, the character '_' is removed
+from 'font-latex-match-simple-exclude-list' in order to fontify
+macros like '\__module_foo:nnn' correctly.
+
+Fontification of math environments has been improved.  Optional
+and/or mandatory argument(s) to environments are not fontified.
+
+'preview.sty' loads 'luatex85.sty' if possible and should be
+compatible with newer luaTeX versions.
+
+AUCTeX has a new customize option 'TeX-ispell-verb-delimiters'.
+This string contains usual characters used as delimiters for
+in-line verbatim macros like '\verb'.  Text between delimiters
+after an in-line verbatim macro will be skipped during spell
+checking.
+
+Fontification of in-line verbatim macros has been improved.
+'font-latex.el' recognizes an optional or a mandatory argument for
+macros like '\Verb' from 'fancyvrb.sty', '\mint' and '\mintinline'
+from 'minted.sty' and fontifies verbatim content correctly.
+
+AUCTeX can put and parse labels in optional argument of
+environments.  Inserting labels is done by new function
+'LaTeX-env-label-as-keyval'.  A new customize option
+'LaTeX-listing-label' is available as prefix to labels in code
+typesetting environments, e.g.  'lstlisting' environment provided
+by 'listings' package.  'LaTeX-listing-label' defaults to 'lst:'.
+Parsing of labels for later referencing relies on two requirements:
+  1. Label should come as last key-value argument, and
+  2. label must be enclosed in braces, e.g.
+          \begin{lstlisting}[caption=Some Caption,label={lst:foo}]
+          ...
+          \end{lstlisting}
+
+The function 'LaTeX-label' now takes a second optional argument
+'NO-INSERT'.  When non-'nil', 'LaTeX-label' reads a label and
+returns it as a string.  This argument is also passed to any
+function bound to 'LaTeX-label-function' (see next item).
+
+*Incompatible change:* The signature for the function passed with
+the customize option 'LaTeX-label-function' has changed.  The
+function bound to this variable is now expected to take an optional
+second argument 'NO-INSERT'.  When this argument is non-'nil', the
+function should read and only return a label as a string; insertion
+is done by another function.
+
+Directory local variables were ineffective for
+'japanese-latex-mode' and 'japanese-plain-tex-mode'.  This bug was
+fixed.  (This was actually done in AUCTeX 11.90, but not
+advertised)
+
+The output of Japanese text from Japanese TeX engines is decoded
+correctly for most cases, according to the encoding of the TeX
+documents and the locale.  The difference between MS Windows, macOS
+and unix-like OS is taken into account.  (This was actually done in
+AUCTeX 11.90, but not advertised)
+
+Quite a few new LaTeX packages are supported.
+
+As usual, many bugs were fixed.
 
 Requirements
 ------------
@@ -202,7 +180,7 @@ Sonderfeld, Holger Sparr, Mike Sperber, Reiner Steib, 
Christian
 Schlauer, Shiro Takeda, Mark Trettin (Please accept our apologies if
 we forgot somebody.)
 
-Footnotes: 
+Footnotes:
 
 [1]  <URL:ftp://ftp.dante.de/tex-archive/macros/latex/contrib/preview/>
 
diff --git a/configure.ac b/configure.ac
index 29b80da..3c7b546 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl along with AUCTeX; see the file COPYING.  If not, write 
to the Free
 dnl Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 dnl MA 02110-1301, USA.
 
-AC_INIT(auctex,11.90,address@hidden)
+AC_INIT(auctex,11.91,address@hidden)
 
 AC_CHECK_PROGS_REQUIRED(MAKECMD, make, [make not found, aborting!])
 AC_PROG_MAKE_SET
diff --git a/context.el b/context.el
index 2f302b3..d322afc 100644
--- a/context.el
+++ b/context.el
@@ -1220,7 +1220,10 @@ else.  There might be text before point."
        (condition-case err
           (progn
             (backward-sexp 1)
-            (while (> (current-column) (current-indentation))
+            (while (or (> (current-column) (current-indentation))
+                       ;; Continue going back if we are
+                       ;; at a hanging optional group.
+                       (looking-at (regexp-quote ConTeXt-optop)))
               (backward-sexp 1)))
         (scan-error
          (setq up-list-pos (nth 2 err))))
diff --git a/doc/auctex.texi b/doc/auctex.texi
index d8c02a6..0335b6c 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -4450,6 +4450,9 @@ in the composing words.
 Runs style hook @code{TeX-language-nl-hook}.
 
 @item english
address@hidden australian
address@hidden canadian
address@hidden newzealand
 Runs style hook @code{TeX-language-en-hook}.
 
 @item frenchb
diff --git a/doc/changes.texi b/doc/changes.texi
index db02a37..ab38cdf 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -8,10 +8,43 @@
 
 @end ifset
 
address@hidden News since 11.90
address@hidden News in 11.91
 
 @itemize @bullet
 @item
+Now @AUCTeX{} has a logo.  The @LaTeX{} code to create it is available
+in the @file{etc/} directory of the package.
+
address@hidden
+Add support for @command{upmendex}, an extension of @command{makeindex}
+capable of sorting indexes by unicode based ICU.
+
address@hidden
+Fix preview-latex to interact correctly with Japanese @LaTeX{}.  The
+parsing routine was made robust not to be confused by the 7-bit encoding
+of Japanese text and the necessary option to @LaTeX{} command is kept
+even when preamble caching is enabled.
+
address@hidden
+The new ``Glossaries'' entry in @code{TeX-command-list} runs the command
address@hidden
+
address@hidden
+Fontification of control symbols has been improved.  Characters defined
+in @code{font-latex-match-simple-exclude-list} do not receive any
+fontification.  In address@hidden mode, the character @samp{_} is removed
+from @code{font-latex-match-simple-exclude-list} in order to fontify
+macros like @samp{\__module_foo:nnn} correctly.
+
address@hidden
+Fontification of math environments has been improved.  Optional and/or
+mandatory argument(s) to environments are not fontified.
+
address@hidden
address@hidden loads @file{luatex85.sty} if possible and should be
+compatible with newer address@hidden versions.
+
address@hidden
 @AUCTeX{} has a new customize option @code{TeX-ispell-verb-delimiters}.
 This string contains usual characters used as delimiters for in-line
 verbatim macros like @samp{\verb}.  Text between delimiters after an
@@ -58,6 +91,26 @@ function bound to this variable is now expected to take an 
optional
 second argument @code{NO-INSERT}.  When this argument is address@hidden,
 the function should read and only return a label as a string; insertion
 is done by another function.
+
address@hidden
+Directory local variables were ineffective for
address@hidden and @code{japanese-plain-tex-mode}.  This bug
+was fixed.  (This was actually done in @AUCTeX{} 11.90, but not
+advertised)
+
address@hidden
+The output of Japanese text from Japanese @TeX{} engines is decoded
+correctly for most cases, according to the encoding of the @TeX{}
+documents and the locale.  The difference between MS Windows, macOS and
+unix-like OS is taken into account.  (This was actually done in
address@hidden 11.90, but not advertised)
+
address@hidden
+Quite a few new @LaTeX{} packages are supported.
+
address@hidden
+As usual, many bugs were fixed.
+
 @end itemize
 
 @heading News in 11.90
diff --git a/doc/tex-ref.tex b/doc/tex-ref.tex
index 0750cb6..80c8203 100644
--- a/doc/tex-ref.tex
+++ b/doc/tex-ref.tex
@@ -1,4 +1,4 @@
-% Reference Card for AUCTeX version 11.90
+% Reference Card for AUCTeX version 11.91
 %**start of header
 \newcount\columnsperpage
 
@@ -42,9 +42,9 @@
 % Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
 % for creating the GNU Emacs Reference Card from which this was mutated
 
-\def\versionnumber{11.90}
+\def\versionnumber{11.91}
 \def\year{2017}
-\def\version{January \year\ v\versionnumber}
+\def\version{July \year\ v\versionnumber}
 
 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
   \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
diff --git a/font-latex.el b/font-latex.el
index 98c0afb..9296a1c 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -400,7 +400,7 @@ variable `font-latex-fontify-sectioning'." ',num)
      (("ensuremath" "|{\\"))
      font-latex-math-face 1 command)
     ("type-command"
-     (("texttt" "{") ("textsf" "{") ("textrm" "{") ("textmd" "{"))
+     (("texttt" "{") ("textsf" "{") ("textrm" "{") ("textmd" "{") 
("oldstylenums" "{"))
      font-lock-type-face 1 command)
     ("bold-declaration"
      ("bf" "bfseries" "sc" "scshape" "upshape")
@@ -1613,10 +1613,13 @@ Returns nil if none of KEYWORDS is found."
                               font-latex-command-with-args-default-spec)))
               (parse-sexp-ignore-comments t)) ; scan-sexps ignores comments
          (goto-char (match-end 0))
-         ;; Check for starred macro if first spec is an asterisk.
-         (when (eq (car spec-list) ?*)
+         ;; Check for starred macro if first spec is an asterisk or a
+         ;; plus sign in case of \defaultfontfeatures+ provided by
+         ;; fontspec.sty
+         (when (or (eq (car spec-list) ?*)
+                   (eq (car spec-list) ?+))
            (setq spec-list (cdr spec-list))
-           (skip-chars-forward "*" (1+ (point))))
+           (skip-chars-forward "*+" (1+ (point))))
          ;; Add current point to match data and use keyword face for
          ;; region from start to point.
          (nconc match-data (list (point)))
@@ -1643,7 +1646,7 @@ Returns nil if none of KEYWORDS is found."
                                     (forward-char)
                                     (if (zerop (skip-syntax-forward "_w"))
                                         (forward-char) ; Single-char macro.
-                                      (skip-chars-forward "*"))
+                                      (skip-chars-forward "*+"))
                                     (point))))
                      (nconc font-latex-matched-faces (list face))
                      (setq end (max end (point)))
@@ -1779,12 +1782,32 @@ marks boundaries for searching for group ends."
              (throw 'extend group-start)))))
       nil)))
 
+(defvar font-latex-match-simple-exclude-list
+  '("-" "," "/" "&" "#" "_" "`" "'" "^" "~" "=" "." "\"")
+  "List of characters directly after \"\\\" excluded from fontification.
+Each character is a string.")
+
 (defun font-latex-match-simple-command (limit)
   "Search for command like \\foo before LIMIT."
-  ;; The \\\\[^,-] makes sure we don't highlight hyphenation as commands
-  ;; (foo\-bar) nor thin spaces (foo\,bar).  \s_ matches chars with symbol
-  ;; syntax, \sw chars with word syntax.
-  (TeX-re-search-forward-unescaped "\\\\[^,-]\\(?:\\s_\\|\\sw\\)+" limit t))
+  ;; \s_ matches chars with symbol syntax, \sw chars with word syntax,
+  ;; \s. chars with punctuation syntax.  We must exclude matches where
+  ;; the first character after the \ is a reserved character and
+  ;; should not be fontified (e.g. \, in foo\,bar or \- in foo\-bar).
+  ;; These characters are stored in
+  ;; `font-latex-match-simple-exclude-list'.  In docTeX mode, we
+  ;; remove "_" from this list to get correct fontification for macros
+  ;; like `\__module_foo:nnn'
+  (let* ((search (lambda ()
+                  (TeX-re-search-forward-unescaped
+                   "\\\\\\(\\s_\\|\\sw\\|\\s.\\)\\(?:\\s_\\|\\sw\\)*" limit 
t)))
+        (pos (funcall search)))
+    (while (and pos
+               (member (match-string 1)
+                       (if (eq major-mode 'doctex-mode)
+                           (remove "_" font-latex-match-simple-exclude-list)
+                         font-latex-match-simple-exclude-list)))
+      (setq pos (funcall search)))
+    pos))
 
 (defun font-latex-match-math-env (limit)
   "Match math pattern up to LIMIT.
@@ -1848,18 +1871,30 @@ END marks boundaries for searching for environment 
ends."
 Used for patterns like:
 \\begin{equation}
  fontified stuff
-\\end{equation}
-The \\begin{equation} and \\end{equation} are not fontified here."
+\\end{equation} or
+\\begin{empheq}[X=Y\\Rightarrow]{alignat=3}
+ fontified stuff
+\\end{empheq}
+The \\begin{equation} incl. arguments in the same line and
+\\end{equation} are not fontified here."
   (when (re-search-forward (concat "\\\\begin[ \t]*{"
                                   (regexp-opt font-latex-math-environments t)
-                                  "\\*?}")
+                                  ;; Subexpression 2 is used to build
+                                  ;; the \end{<env>} construct below
+                                  "\\(\\*?}\\)"
+                                  ;; Match an optional and possible
+                                  ;; mandatory argument(s) as long as
+                                  ;; they are on the same line with
+                                  ;; no spaces in-between
+                                  
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
+                                  "\\(?:{[^}]*}\\)*")
                           limit t)
     (let ((beg (match-end 0)) end)
       (if (re-search-forward (concat "\\\\end[ \t]*{"
                                     (regexp-quote
                                      (buffer-substring-no-properties
                                       (match-beginning 1)
-                                      (match-end 0))))
+                                      (match-end 2))))
                             ;; XXX: Should this rather be done by
                             ;; extending the region to be fontified?
                             (+ limit font-latex-multiline-boundary) 'move)
@@ -1882,11 +1917,16 @@ END marks boundaries for searching for environment 
ends."
              (concat "\\\\end[ \t]*{"
                      (regexp-opt font-latex-math-environments t)
                      "\\*?}") beg t)
-       (when (and (re-search-backward (concat  "\\\\begin[ \t]*{"
-                                               (buffer-substring-no-properties
-                                                (match-beginning 1)
-                                                (match-end 0)))
-                                      (- beg font-latex-multiline-boundary) t)
+       (when (and (re-search-backward
+                   (concat  "\\\\begin[ \t]*{"
+                            (buffer-substring-no-properties
+                             (match-beginning 1)
+                             (match-end 0))
+                            ;; Match an optional and possible
+                            ;; mandatory argument(s)
+                            "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
+                            "\\(?:{[^}]*}\\)*")
+                   (- beg font-latex-multiline-boundary) t)
                   (< (point) beg))
          (throw 'extend (point))))
       nil)))
diff --git a/latex.el b/latex.el
index fa87c98..8dc9fa3 100644
--- a/latex.el
+++ b/latex.el
@@ -440,7 +440,7 @@ no label is inserted."
 Insert this hook into `LaTeX-section-hook' to allow the user to change
 the name of the sectioning command inserted with `\\[LaTeX-section]'."
   (let ((string (completing-read
-                (concat "Level: (default " name ") ")
+                (concat "Level (default " name "): ")
                 LaTeX-section-list
                 nil nil nil nil name)))
     ;; Update name
@@ -563,8 +563,8 @@ It may be customized with the following variables:
                         (string-equal (LaTeX-current-environment) "document"))
                    LaTeX-default-document-environment)
                   (t LaTeX-default-environment)))
-        (environment (completing-read (concat "Environment type: (default "
-                                              default ") ")
+        (environment (completing-read (concat "Environment type (default "
+                                              default "): ")
                                       (LaTeX-environment-list-filtered) nil nil
                                       nil 'LaTeX-environment-history default)))
     ;; Use `environment' as default for the next time only if it is different
@@ -1275,14 +1275,12 @@ out."
       (forward-sexp)
       (set-marker opt-end (1- (point))))
     ;; If keyword argument is given and keyvals argument is not given,
-    ;; parse the optional argument and put it into keyvals; the regexp
-    ;; takes care of multi-line arguments
+    ;; parse the optional argument and put it into keyvals
     (when (and keyword
               (marker-position opt-start)
               (not keyvals))
-      (goto-char (1+ opt-start))
-      (re-search-forward "\\(.*\\([\n\r].*\\)*\\)" opt-end t)
-      (setq keyvals (match-string-no-properties 0)))
+      (setq keyvals (buffer-substring-no-properties
+                    (1+ opt-start) opt-end)))
     ;; If keyword is given, only insert a label when keyword is found
     ;; inside the keyvals.  If keyword is nil, then insert a label
     ;; anyways
@@ -2244,12 +2242,13 @@ OPTIONAL and IGNORE are ignored."
            (if (if (eq TeX-arg-input-file-search 'ask)
                    (not (y-or-n-p "Find class yourself? "))
                  TeX-arg-input-file-search)
-               (progn
+               (prog2
                  (message "Searching for LaTeX classes...")
-                 (TeX-search-files-by-type 'texinputs 'global t t))
+                 (TeX-search-files-by-type 'texinputs 'global t t)
+                 (message "Searching for LaTeX classes...done"))
              LaTeX-style-list)))
     (setq style (completing-read
-                (concat "Document class: (default " LaTeX-default-style ") ")
+                (concat "Document class (default " LaTeX-default-style "): ")
                 LaTeX-global-class-files nil nil nil nil LaTeX-default-style))
     ;; Clean up hook before use.
     (setq TeX-after-document-hook nil)
@@ -2306,7 +2305,8 @@ of the options, nil otherwise."
            (message "Searching for LaTeX packages...")
            (setq TeX-global-input-files
                  (mapcar 'list (TeX-search-files-by-type
-                                'texinputs 'global t t))))))
+                                'texinputs 'global t t)))
+           (message "Searching for LaTeX packages...done"))))
     (setq packages (TeX-completing-read-multiple
                    "Packages: " TeX-global-input-files))
     ;; Clean up hook before use in `LaTeX-arg-usepackage-insert'.
@@ -2438,7 +2438,8 @@ files."
            (message "Searching for files...")
            (setq TeX-global-input-files
                  (mapcar 'list (TeX-search-files-by-type
-                                'texinputs 'global t t))))
+                                'texinputs 'global t t)))
+           (message "Searching for files...done"))
          (setq file (completing-read
                      (TeX-argument-prompt optional prompt "File")
                      (TeX-delete-dups-by-car
@@ -2477,6 +2478,7 @@ string."
   (or BibTeX-global-style-files
       (setq BibTeX-global-style-files
            (mapcar 'list (TeX-search-files-by-type 'bstinputs 'global t t))))
+  (message "Searching for BibTeX styles...done")
   (TeX-argument-insert
    (completing-read (TeX-argument-prompt optional prompt "BibTeX style")
                    (append (mapcar 'list (TeX-search-files-by-type
@@ -2505,6 +2507,7 @@ string."
   (or BibTeX-global-files
       (setq BibTeX-global-files
            (mapcar 'list (TeX-search-files-by-type 'bibinputs 'global t t))))
+  (message "Searching for BibTeX files...done")
   (let ((styles (multi-prompt
                 "," t
                 (TeX-argument-prompt optional prompt "BibTeX files")
@@ -2600,8 +2603,8 @@ the list of defined pagestyles."
 If OPTIONAL is non-nil, insert the resulting value as an optional
 argument, otherwise as a mandatory one.  IGNORE is ignored."
   (let ((del (read-quoted-char
-             (concat "Delimiter: (default "
-                     (char-to-string LaTeX-default-verb-delimiter) ") "))))
+             (concat "Delimiter (default "
+                     (char-to-string LaTeX-default-verb-delimiter) "): "))))
     (when (<= del ?\ ) (setq del LaTeX-default-verb-delimiter))
     (if (TeX-active-mark)
        (progn
@@ -4369,7 +4372,7 @@ formatting."
       (setq from (point))
       (catch 'end-of-buffer
        (while (and (< (point) to))
-         (message "Formatting%s ... %d%%"
+         (message "Formatting%s...%d%%"
                   (or what "")
                   (/ (* 100 (- (point) from)) (- to from)))
          (save-excursion (LaTeX-fill-paragraph justify))
@@ -4386,7 +4389,7 @@ formatting."
                               TeX-comment-start-regexp "+[ \t]*$\\)")))
            (forward-line 1))))
       (set-marker to nil)))
-  (message "Finished"))
+  (message "Formatting%s...done" (or what "")))
 
 (defun LaTeX-find-matching-end ()
   "Move point to the \\end of the current environment.
@@ -5852,7 +5855,7 @@ and `LaTeX-babel-hyphen-after-hyphen' respectively.  The 
first item
 in each element is a string specifying the language as set by the
 language-specific style file.  The second item is the string to be
 used instead of `LaTeX-babel-hyphen'.  The third element is the
-value overriding `LaTeX-bybel-hyphen-after-hyphen'."
+value overriding `LaTeX-babel-hyphen-after-hyphen'."
   :group 'LaTeX-macro
   :type '(alist :key-type (string :tag "Language")
                :value-type (group (string :tag "Hyphen string")
@@ -6429,6 +6432,7 @@ function would return non-nil and `(match-string 1)' 
would return
    '("tiny" -1) '("scriptsize" -1) '("footnotesize" -1) '("small" -1)
    '("normalsize" -1) '("large" -1) '("Large" -1) '("LARGE" -1) '("huge" -1)
    '("Huge" -1)
+   '("oldstylenums" "Numbers")
    "pounds" "copyright"
    "hfil" "hfill" "vfil" "vfill" "hrulefill" "dotfill"
    "indent" "noindent" "today"
@@ -6462,7 +6466,8 @@ function would return non-nil and `(match-string 1)' 
would return
      "textasciicircum" "textasciitilde"
      "textregistered" "texttrademark"
      "rmfamily" "sffamily" "ttfamily" "mdseries" "bfseries"
-     "itshape" "slshape" "upshape" "scshape"))
+     "itshape" "slshape" "upshape" "scshape"
+     "eminnershape"))
 
   (TeX-run-style-hooks "LATEX")
 
diff --git a/latex/preview.dtx b/latex/preview.dtx
index c98a451..b180b28 100644
--- a/latex/preview.dtx
+++ b/latex/preview.dtx
@@ -3,7 +3,7 @@
 %%    Developed as part of AUCTeX <URL:http://www.gnu.org/software/auctex>.
 %
 %     Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006,
-%                   2010 Free Software Foundation
+%                   2010, 2017 Free Software Foundation
 %
 %     This program is free software; you can redistribute it and/or modify
 %     it under the terms of the GNU General Public License as published by
@@ -20,10 +20,10 @@
 %     Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 %     Boston, MA 02110-1301  USA
 % \fi
-% \CheckSum{1758}
+% \CheckSum{1760}
 % \GetFileInfo{preview.sty}
 % \date{\filedate}
-% \author{David address@hidden
+% \author{David address@hidden
 % \title{The \texttt{preview} Package for \LaTeX\\Version \fileversion}
 % \maketitle
 % \section{Introduction}
@@ -37,7 +37,7 @@
 % Current uses of the package include the \previewlatex\ package for
 % WYSIWYG functionality in the AUC\TeX\ editing environment,
 % generation of previews in LyX, as part of the operation of the
-% ps4pdf package, the tbook XML system and some other tools.
+% pst-pdf package, the tbook XML system and some other tools.
 % 
 % Producing EPS files with Dvips and its derivatives using the
 % \texttt{-E} option is not a good alternative: People make do by
@@ -439,12 +439,12 @@
 \NeedsTeXFormat{LaTeX2e} address@hidden #1#2$#3:
 address@hidden #2#4 $}} address@hidden #1 #2${#1}
 \begingroup \catcode`\_=12
address@hidden@version $Name: release_11_90 $ address@hidden@empty
address@hidden@version $Name: release_11_91 $ address@hidden@empty
 address@hidden@version CVS-$Revision: 1.126 $ \endgroup \else
   \def\next release_{} \lccode`\_=`.
   \edef\next{\lowercase{\endgroup
     address@hidden@version}}} \next \fi
address@hidden $Date: 2010/02/14 16:19:00 $
address@hidden $Date: 2017/04/24 13:20:00 $
 \edef\next{\noexpand\ProvidesPackage{preview}%
   [\next\space address@hidden (AUCTeX/preview-latex)]}
 \next
@@ -494,13 +494,18 @@
 %  got executed.
 address@hidden
 %  The macro address@hidden is used for loading in configuration
-%  files, unless disabled by the |noconfig| option.
+%  files, unless disabled by the |noconfig| option.  After discussion
+%  with maintainer of pst-pdf package Rolf Niepraschk (Thanks!), we
+%  add here a check for existence of |luatex85.sty| and load it if
+%  available.  With this, |preview| will also work with newer |luatex|
+%  versions.
 %    \begin{macrocode}
 %<*!active>
 address@hidden@gobble
 address@hidden@gobbletwo
 address@hidden@ship#1#2#3{}
 address@hidden
+\IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{}
 address@hidden@gobble}
 %    \end{macrocode}
 address@hidden@front}
diff --git a/preview.el b/preview.el
index b10f91a..abeaebb 100644
--- a/preview.el
+++ b/preview.el
@@ -295,7 +295,7 @@ If `preview-fast-conversion' is set, this option is not
   :type 'number)
 
 (defvar preview-coding-system nil
-  "Coding system used for LaTeX process.")
+  "Proper coding system to decode output from LaTeX process.")
 (make-variable-buffer-local 'preview-coding-system)
 (defvar preview-parsed-font-size nil
   "Font size as parsed from the log of LaTeX run.")
@@ -2611,37 +2611,98 @@ later while in use."
   "Turn STRING with potential ^^ sequences into a regexp.
 To preserve sanity, additional ^ prefixes are matched literally,
 so the character represented by ^^^ preceding extended characters
-will not get matched, usually."
+will not get matched, usually.
+
+If decoding the process output was suppressed during receiving,
+decode first with RUN-CODING-SYSTEM."
   (let (output case-fold-search)
-    (when (featurep 'mule)
-      (setq string (encode-coding-string string run-coding-system)))
-    (while (string-match 
"\\^\\{2,\\}\\(\\(address@hidden)\\|[8-9a-f][0-9a-f]\\)"
-                        string)
+    ;; Some coding systems (e.g. japanese-shift-jis) use regexp meta
+    ;; characters on encoding.  Such meta characters would be
+    ;; interfered with `regexp-quote' below.  Thus the idea of
+    ;; "encoding entire string beforehand and decoding it at the last
+    ;; stage" does not work for such coding systems.
+    ;; Rather, we work consistently with decoded text.
+    (if (and (featurep 'mule)
+            (not (eq run-coding-system
+                     (preview-buffer-recode-system run-coding-system))))
+       (setq string
+             (decode-coding-string string run-coding-system)))
+
+    ;; Next, bytes with value from 0x80 to 0xFF represented with ^^
+    ;; form are converted to byte sequence, and decoded by the file
+    ;; coding system.
+    (setq string
+         (preview--decode-^^ab string
+                               (if (featurep 'mule)
+                                   buffer-file-coding-system nil)))
+
+    ;; Then, control characters are taken into account.
+    (while (string-match "\\^\\{2,\\}\\(address@hidden)" string)
       (setq output
            (concat output
                    (regexp-quote (substring string
                                             0
                                             (- (match-beginning 1) 2)))
-                   (if (match-beginning 2)
-                       (concat
-                        "\\(?:" (regexp-quote
-                                 (substring string
-                                            (- (match-beginning 1) 2)
-                                            (match-end 0)))
-                        "\\|"
-                        (char-to-string
-                         (logxor (aref string (match-beginning 2)) 64))
-                        "\\)")
-                     (char-to-string
-                      (string-to-number (match-string 1 string) 16))))
+                   (concat
+                    "\\(?:" (regexp-quote
+                             (substring string
+                                        (- (match-beginning 1) 2)
+                                        (match-end 0)))
+                    "\\|"
+                    (char-to-string
+                     (logxor (aref string (match-beginning 1)) 64))
+                    "\\)"))
            string (substring string (match-end 0))))
     (setq output (concat output (regexp-quote string)))
-    (if (featurep 'mule)
-       (decode-coding-string output
-                             (or (and (boundp 
'TeX-japanese-process-output-coding-system)
-                                      
TeX-japanese-process-output-coding-system)
-                                 buffer-file-coding-system))
-      output)))
+    output))
+
+(defun preview--decode-^^ab (string coding-system)
+  "Decode ^^ sequences in STRING with CODING-SYSTEM.
+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.
+  (let ((result ""))
+    (while (string-match "[\x00-\x7F]+" string)
+      (setq result
+           (concat result
+                   (substring string 0 (match-beginning 0))
+                   (let ((text
+                          (save-match-data
+                            (preview--convert-^^ab
+                             (match-string 0 string)))))
+                     (if (featurep 'mule)
+                         (decode-coding-string text coding-system)
+                       text)))
+           string (substring string (match-end 0))))
+    (setq result (concat result string))
+    result))
+
+(defun preview--convert-^^ab (string)
+  "Convert ^^ sequences in STRING to raw 8bit.
+Sequences of control characters such as ^^I are left untouched.
+
+Return a new string."
+  (let ((result ""))
+    (while (string-match "\\^\\^[8-9a-f][0-9a-f]" string)
+      (setq result
+           (concat result
+                   (substring string 0 (match-beginning 0))
+                   (let ((byte (string-to-number
+                                (substring string
+                                           (+ (match-beginning 0) 2)
+                                           (match-end 0)) 16)))
+                     ;; `char-to-string' is not appropriate in
+                     ;; Emacs >= 23 because it converts #xAB into
+                     ;; "\u00AB" (multibyte string), not "\xAB"
+                     ;; (raw 8bit unibyte string).
+                     (if (fboundp 'byte-to-string)
+                         (byte-to-string byte) (char-to-string byte))))
+           string (substring string (match-end 0))))
+    (setq result (concat result string))
+    result))
 
 (defun preview-parse-messages (open-closure)
   "Turn all preview snippets into overlays.
@@ -3481,7 +3542,13 @@ internal parameters, STR may be a log to insert into the 
current log."
         "Preview-LaTeX"
         (if (consp (cdr dumped-cons))
             (preview-do-replacements
-             command preview-undump-replacements)
+             command
+             (append preview-undump-replacements
+                     ;; Since the command options provided in
+                     ;; (TeX-engine-alist) are dropped, give them
+                     ;; back.
+                     (list (list "\\`\\([^ ]+\\)"
+                           (TeX-command-expand "%(latex)" nil)))))
           command) file)))
     (condition-case err
        (progn
@@ -3494,18 +3561,20 @@ internal parameters, STR may be a log to insert into 
the current log."
          (preview-set-geometry geometry)
          (setq preview-gs-file pr-file)
          (setq TeX-sentinel-function 'preview-TeX-inline-sentinel)
+         ;; Postpone decoding of process output for xemacs 21.4,
+         ;; which is rather bad at preserving incomplete multibyte
+         ;; characters.
          (when (featurep 'mule)
-           (setq preview-coding-system
-                 (or (and (boundp 'TeX-japanese-process-output-coding-system)
-                          TeX-japanese-process-output-coding-system)
-                     (with-current-buffer commandbuff
-                       buffer-file-coding-system)))
-           (when preview-coding-system
-             (setq preview-coding-system
-                   (preview-buffer-recode-system
-                    (coding-system-base preview-coding-system))))
-           (set-process-coding-system
-            process preview-coding-system))
+           ;; Get process coding system set in `TeX-run-command'.
+           (setq preview-coding-system (process-coding-system process))
+           ;; Substitute coding system for decode with `raw-text' if
+           ;; necessary and save the original coding system for
+           ;; decode for later use in `preview-error-quote'.
+           (set-process-coding-system process
+                                      (preview-buffer-recode-system
+                                       (car preview-coding-system))
+                                      (cdr preview-coding-system))
+           (setq preview-coding-system (car preview-coding-system)))
          (TeX-parse-reset)
          (setq TeX-parse-function 'TeX-parse-TeX)
          (if TeX-process-asynchronous
diff --git a/prv-xemacs.el b/prv-xemacs.el
index b4b22f7..32949d1 100644
--- a/prv-xemacs.el
+++ b/prv-xemacs.el
@@ -413,10 +413,9 @@ stream before the buffer characters can be identified.  
XEmacs
 21.4 is rather bad at preserving incomplete multibyte characters
 in that process.  This variable makes it possible to use a
 reconstructable coding system in the run buffer instead.  Specify
-an alist of base coding system names here, which you can get
-using
+an alist of coding system names here, which you can get using
 
-  \(coding-system-name (coding-system-base buffer-file-coding-system))
+  \(coding-system-name buffer-file-coding-system)
 
 in properly detected buffers."
   :group 'preview-latex
@@ -431,6 +430,17 @@ in properly detected buffers."
                 preview-buffer-recoding-alist))
       base))
 
+(if (and (featurep 'mule)
+        (= emacs-major-version 21)
+        (< emacs-minor-version 5))
+    (defadvice coding-system-change-eol-conversion
+       (after fallback activate)
+      "Return CODING-SYSTEM as-is if the result is nil.
+XEmacs 21.4 mule-ucs fails to define utf-8 to respond properly to
+this function."
+      (unless ad-return-value
+       (setq ad-return-value (ad-get-arg 0)))))
+
 (defun preview-mode-setup ()
   "Setup proper buffer hooks and behavior for previews."
   (set (make-local-variable 'desktop-save-buffer)
@@ -734,6 +744,12 @@ of an insertion."
                                (nth 1 image)
                                (nth 2 image)))))
 
+(if (eq system-type 'windows-nt)
+    (defadvice preview-ps-quote-filename (around path-sep-to-slash)
+      "Make path separator to slash so that the function will not be confused."
+      (let ((directory-sep-char ?/))
+       ad-do-it)))
+
 (provide 'prv-xemacs)
 
 ;;; Local variables:
diff --git a/style/expl3.el b/style/australian.el
similarity index 57%
copy from style/expl3.el
copy to style/australian.el
index b686b52..a11b2f1 100644
--- a/style/expl3.el
+++ b/style/australian.el
@@ -1,10 +1,10 @@
-;;; expl3.el --- AUCTeX style for `expl3.sty'
+;;; australian.el --- AUCTeX style for the `australian' babel option.
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2017 Free Software Foundation, Inc.
 
-;; Author: Tassilo Horn <address@hidden>
+;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
-;; Created: 2015-02-22
+;; Created: 2017-07-02
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -26,23 +26,15 @@
 
 ;;; Commentary:
 
-;; This file adds support for `expl3.sty'.
+;; Set up AUCTeX for editing Australian text in connection with the
+;; `australian' babel option.
 
 ;;; Code:
 
-(defvar LaTeX-expl3-syntax-table
-  (let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
-    ;; Make _ and : symbol chars
-    (modify-syntax-entry ?\_ "_" st)
-    (modify-syntax-entry ?\: "_" st)
-    st))
-
 (TeX-add-style-hook
- "expl3"
+ "australian"
  (lambda ()
-   (set-syntax-table LaTeX-expl3-syntax-table)
-   (when (and (fboundp 'font-latex-update-font-lock)
-             (eq TeX-install-font-lock 'font-latex-setup))
-     ;; Tell font-lock about the update.
-     (font-latex-update-font-lock t)))
+   (TeX-run-style-hooks "english"))
  LaTeX-dialect)
+
+;;; australian.el ends here
diff --git a/style/beamer.el b/style/beamer.el
index fe75e05..6cd8327 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -110,7 +110,7 @@
     '("only" TeX-arg-beamer-overlay-spec 1)
     '("onslide" TeX-arg-beamer-overlay-spec)
     '("partpage")
-    '("pause")
+    '("pause" ["Slide number"])
     '("structure" TeX-arg-beamer-overlay-spec 1)
     '("temporal" TeX-arg-beamer-overlay-spec 3)
     '("titlepage")
diff --git a/style/bicaption.el b/style/bicaption.el
index 5e40270..47b139b 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 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -151,8 +151,9 @@ square brackets."
     '("bisubcaptionbox"  (LaTeX-arg-bicaption-bicaption "sub-" nil  t   t) t)
     '("bisubcaptionbox*" (LaTeX-arg-bicaption-bicaption "sub-"  t   t   t) t))
 
-   ;; Everything starting with \bi(sub)?caption should get its own line
-   (LaTeX-paragraph-commands-add-locally '("bicaption" "bisubcaption"))
+   ;; \bi(sub)?caption(box)? macros should get their own lines
+   (LaTeX-paragraph-commands-add-locally '("bicaption"    "bicaptionbox"
+                                          "bisubcaption" "bisubcaptionbox"))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
diff --git a/style/breqn.el b/style/breqn.el
index 8006082..03fee3b 100644
--- a/style/breqn.el
+++ b/style/breqn.el
@@ -115,7 +115,7 @@ Keys offered for key=val query depend on ENV.  \"label\" and
           (keys '("color" "background"))
           (tmp (copy-alist LaTeX-breqn-key-val-options-local)))
       (dolist (x keys)
-       (assq-delete-all (car (assoc x tmp)) tmp)
+       (setq tmp (assq-delete-all (car (assoc x tmp)) tmp))
        (push (list x (mapcar #'car (funcall colorcmd))) tmp))
       (setq LaTeX-breqn-key-val-options-local
            (copy-alist tmp)))))
diff --git a/style/expl3.el b/style/canadian.el
similarity index 57%
copy from style/expl3.el
copy to style/canadian.el
index b686b52..f66e86f 100644
--- a/style/expl3.el
+++ b/style/canadian.el
@@ -1,10 +1,10 @@
-;;; expl3.el --- AUCTeX style for `expl3.sty'
+;;; canadian.el --- AUCTeX style for the `canadian' babel option.
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2017 Free Software Foundation, Inc.
 
-;; Author: Tassilo Horn <address@hidden>
+;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
-;; Created: 2015-02-22
+;; Created: 2017-07-02
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -26,23 +26,15 @@
 
 ;;; Commentary:
 
-;; This file adds support for `expl3.sty'.
+;; Set up AUCTeX for editing Canadian text in connection with the
+;; `canadian' babel option.
 
 ;;; Code:
 
-(defvar LaTeX-expl3-syntax-table
-  (let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
-    ;; Make _ and : symbol chars
-    (modify-syntax-entry ?\_ "_" st)
-    (modify-syntax-entry ?\: "_" st)
-    st))
-
 (TeX-add-style-hook
- "expl3"
+ "canadian"
  (lambda ()
-   (set-syntax-table LaTeX-expl3-syntax-table)
-   (when (and (fboundp 'font-latex-update-font-lock)
-             (eq TeX-install-font-lock 'font-latex-setup))
-     ;; Tell font-lock about the update.
-     (font-latex-update-font-lock t)))
+   (TeX-run-style-hooks "english"))
  LaTeX-dialect)
+
+;;; canadian.el ends here
diff --git a/style/caption.el b/style/caption.el
index 84809b9..1a0eb7e 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, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2017 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -427,6 +427,9 @@ STAR is non-nil, do not query for a short-caption and a 
label."
 
     '("bothIfSecond" 2))
 
+   ;; \caption(box|of) macros should get their own lines
+   (LaTeX-paragraph-commands-add-locally '("captionbox" "captionof"))
+
    ;; Fontification
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
diff --git a/style/comment.el b/style/comment.el
index d420e6b..46054ca 100644
--- a/style/comment.el
+++ b/style/comment.el
@@ -49,14 +49,14 @@
      ;; For syntactic fontification.
      (add-to-list 'font-latex-syntactic-keywords-extra
                  ;; \begin is supposed to start at the beginning of a line.
-                 `(,(format "^\\\\begin *{\\(?:%s\\)}.*\\(\n\\)"
+                 `(,(format "^\\\\begin *{%s}.*\\(\n\\)"
                             (regexp-opt LaTeX-comment-env-list))
-                   (1 "<" t)))
+                   (1 "!" t)))
      (add-to-list 'font-latex-syntactic-keywords-extra
                  ;; \end is supposed to start at the beginning of a line.
-                 `(,(format "^\\(\\\\\\)end *{\\(?:%s\\)}"
+                 `(,(format "^\\(\\\\\\)end *{%s}"
                             (regexp-opt LaTeX-comment-env-list))
-                   (1 ">" t)))
+                   (1 "!" t)))
      (font-latex-add-keywords '(("includecomment" "{")
                                ("excludecomment" "{")
                                ("specialcomment" "{{{")
diff --git a/style/empheq.el b/style/empheq.el
index 5618646..4365136 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 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -472,10 +472,6 @@ number of ampersands if possible."
     '("EmphEqMainEnv" 0)
     '("endEmphEqMainEnv" 0))
 
-   ;; Ispell skip lists
-   (TeX-ispell-skip-setcar '(("\\\\empheqset" ispell-tex-arg-end)))
-   (TeX-ispell-skip-setcdr '(("empheq" . "\\\\end{empheq}")))
-
    ;; Fontification
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
diff --git a/style/english.el b/style/english.el
index 90254c2..33e05e8 100644
--- a/style/english.el
+++ b/style/english.el
@@ -5,6 +5,8 @@
 (TeX-add-style-hook
  "english"
  (lambda ()
+   (unless (eq (car TeX-quote-language) 'override)
+     (setq TeX-quote-language nil))
    (run-hooks 'TeX-language-en-hook))
  LaTeX-dialect)
 
diff --git a/style/exam.el b/style/exam.el
index d6dbc09..b761128 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 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
 
 ;; Author: Uwe Brauer <address@hidden>
 ;; Created: 2016-03-06
@@ -32,7 +32,6 @@
 
 ;;; Code:
 
-
 (defvar LaTeX-exam-class-options
   '("answers" "noanswers" "cancelspace" "nocancelspace" "addpoints")
   "Class options for the exam class.")
@@ -85,6 +84,7 @@ Arguments NAME and TYPE are the same as for the function
 
    (LaTeX-add-environments
     '("solution" [ "Height" ])
+    '("select")
     '("solutionorbox" [ "Height" ])
     '("solutionorlines" [ "Height" ])
     '("solutionordottedlines" [ "Height" ])
@@ -258,8 +258,6 @@ Arguments NAME and TYPE are the same as for the function
     '("extraheadheight" 1)
     '("extrawidth" 1)
     '("fillwithdottedlines" 1)
-    '("fillwithdottedlines" 1)
-    '("fillwithlines" 1)
     '("fillwithlines" 1)
     '("firstpagefooter" 1)
     '("firstpagefootrule" 0)
@@ -320,6 +318,8 @@ Arguments NAME and TYPE are the same as for the function
     '("pointsofquestion" 1)
     '("pointsonpage" 1)
     '("printanswers" 0)
+    '("printselectedfalse" 0)
+    '("printselectedtrue" 0)
     '("qformat" 1)
     '("questionlabel" 0)
     '("questionshook" 0)
diff --git a/style/expl3.el b/style/expl3.el
index b686b52..78361d7 100644
--- a/style/expl3.el
+++ b/style/expl3.el
@@ -1,6 +1,6 @@
 ;;; expl3.el --- AUCTeX style for `expl3.sty'
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2017 Free Software Foundation, Inc.
 
 ;; Author: Tassilo Horn <address@hidden>
 ;; Maintainer: address@hidden
@@ -46,3 +46,13 @@
      ;; Tell font-lock about the update.
      (font-latex-update-font-lock t)))
  LaTeX-dialect)
+
+(defun LaTeX-expl3-package-options ()
+  "Read the expl3 package options from the user."
+  (TeX-read-key-val t '(("check-declarations" ("true" "false"))
+                       ("log-functions" ("true" "false"))
+                       ("driver" ("auto"    "latex2e"
+                                  "dvips"   "dvipdfmx"
+                                  "pdfmode" "xdvipdfmx")))))
+
+;;; expl3.el ends here
diff --git a/style/floatrow.el b/style/floatrow.el
new file mode 100644
index 0000000..422c87a
--- /dev/null
+++ b/style/floatrow.el
@@ -0,0 +1,726 @@
+;;; floatrow.el --- AUCTeX style for `floatrow.sty' (v0.3b)
+
+;; Copyright (C) 2017 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <address@hidden>
+;; Maintainer: address@hidden
+;; Created: 2016-11-11
+;; 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 `floatrow.sty' (v0.3b) from 2009/08/02.
+;; `floatrow.sty' is part of TeXLive.
+;;
+;; `floatrow.sty' is a powerful package and the documentation long.
+;; It is expected that this style is not feature complete.  One
+;; deliberate decision is that this style does not offer any package
+;; options: Please use the command `\floatsetup' to set the options
+;; you want.
+;;
+;; This style also alters the way AUCTeX inserts the environments
+;; "table" and "figure" (cf.  function `LaTeX-floatrow-env-init').  If
+;; you want the original behavior, try `C-c C-e rawfigure' or `C-c C-e
+;; rawtable' which include the environments incl.  the macro \RawFloats
+;; at the beginning of the environment (cf.  function
+;; `LaTeX-floatrow-env-figure-raw').
+;;
+;; Another deliberate decision is the implementation of commands like
+;; `\ffigbox' and `\ttabbox': When invoked with `C-c C-m ffigbox RET',
+;; the final result will look like this with cursor being at *:
+;;
+;;   \ffigbox{*}{%
+;;     \caption{query for a caption}%
+;;     \label{prefix:is-chosen-acc-to-current-environment}%
+;;   }
+;;
+;; This gives users the freedom to insert any command where point is.
+;; The mandatory arguments are not part of the fontification as
+;; commands like `\includegraphics' or `tabular' environments have their
+;; own fontification.
+
+;;; Code:
+
+;; Needed for compiling `pushnew':
+(eval-when-compile (require 'cl))
+
+;; Needed for auto-parsing.
+(require 'tex)
+
+(defvar LaTeX-floatrow-key-val-options
+  '(;; 3.1.1 Float Style
+    ("style" ("plain" "plaintop" "Plaintop"
+             "ruled" "Ruled"
+             "boxed" "Boxed" "BOXED"
+             "shadowbox" "Shadowbox" "SHADOWBOX"
+             "doublebox" "Doublebox" "DOUBLEBOX"
+             "wshadowbox" "Wshadowbox" "WSHADOWBOX"))
+    ;; 3.1.2 Font Settings
+    ("font" ("scriptsize" "footnotesize" "small" "normalsize" "large"
+            "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf"
+            "rm" "sf" "tt"))
+    ("footfont" ("scriptsize" "footnotesize" "small" "normalsize" "large"
+                "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf"
+                "rm" "sf" "tt"))
+    ;; 3.1.3 Position of Caption
+    ("capposition" ("top" "TOP" "bottom" "beside"))
+    ;; 3.1.4 Position of Beside Caption
+    ("capbesideposition" ("left" "right" "inside" "outside"
+                         "top" "bottom" "center"))
+    ;; 3.1.5 Defining The Width of Beside Caption
+    ("capbesidewidth" ("none" "sidefil"))
+    ;; 3.1.6 Defining Width of Object
+    ("floatwidth" ("\\hsize" "\\textwidth" "\\columnwidth" "\\linewidth"))
+    ;; 3.1.7 Other Settings for Beside Captions
+    ("capbesideframe" ("yes" "no"))
+    ;; 3.1.8 Defining Float Foot Position (Legends and Footnotes)
+    ("footposition" ("default" "caption" "bottom"))
+    ;; 3.1.9 Vertical Alignment of Float Elements
+    ("heightadjust" ("all" "caption" "object" "none" "nocaption" "noobject"))
+    ("valign" ("t" "c" "b" "s"))
+    ;; 3.1.10 Facing Layout
+    ("facing" ("yes" "no"))
+    ;; 3.1.11 Object Settings
+    ("objectset" ("justified" "centering" "raggedright" "RaggedRight" 
"raggedleft"))
+    ;; 3.1.12 Defining Float Margins
+    ("margins" ("centering" "raggedright" "raggedleft"
+               "hangright" "hanginside" "hangoutside"))
+    ;; 3.1.13 Defining Float Separators
+    ("floatrowsep" ("columnsep" "quad" "qquad" "hfil" "hfill" "none"))
+    ("capbesidesep" ("columnsep" "quad" "qquad" "hfil" "hfill" "none"))
+    ;; 3.1.14 Defining Float Rules/Skips
+    ("precode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
+    ("rowprecode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
+    ("midcode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
+    ("postcode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
+    ("rowpostcode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
+    ;; 3.1.15 Defining Float Frames
+    ("framestyle" ("fbox" "colorbox" "FRcolorbox" "corners"
+                  "doublebox" "shadowbox" "wshadowbox"))
+    ("frameset")
+    ("framearound" ("none" "object" "all" "row" "none"))
+    ("framefit" ("yes" "no"))
+    ("rowfill" ("yes" "no"))
+    ;; 3.1.16 Settings for Colored Frames
+    ("colorframeset")
+    ("colorframecorners")
+    ;; 3.1.17 Defining Float Skips
+    ("captionskip")
+    ("footskip")
+    ;; 3.1.18 Defining Float Footnote Rule's Style
+    ("footnoterule" ("normal" "limited" "fullsize" "none"))
+    ;; 3.1.19 Managing Floats with [H] Placement Option
+    ("doublefloataswide" ("yes" "no"))
+    ("floatHaslist" ("yes" "no"))
+    ;; 7.2.1 Additions in The floatrow Package to longtable package
+    ("LTcapwidth" ("table" "contents")))
+  "Key=value options for floatrow macros and environments.")
+
+(defvar LaTeX-floatrow-key-val-options-local nil
+  "Buffer-local key=value options for floatrow macros and environments.")
+(make-variable-buffer-local 'LaTeX-floatrow-key-val-options-local)
+
+(defvar LaTeX-floatrow-supported-float-types
+  '("figure" "table"                             ; Standard LaTeX
+    "widefigure" "widetable" "widefloat"         ; Standard figure* & table*
+    "wrapfigure" "wraptable" "wrapfloat"         ; wrapfig.sty
+    "rotfigure"  "rottable"  "rotfloat"           ; rotating.sty
+    "widerotfigure" "widerottable" "widerotfloat" ; for 2-col & wide
+    "figurerow"  "tablerow"  "floatrow"           ; inside floatrow env's
+    "capbesidefigure" "capbesidetable"            ; floats with beside captions
+    "capbesidefloat"
+    "longtable"                                          ; longtable.sty
+    "subfigure" "subtable" "sub")                 ; subcaption.sty
+  "List of float types supported by floatrow.sty.")
+
+;; Setup for \newfloatcommand
+(TeX-auto-add-type "floatrow-newfloatcommand" "LaTeX")
+
+(defvar LaTeX-floatrow-newfloatcommand-regexp
+  '("\\\\newfloatcommand{\\([^}]+\\)}" 1 LaTeX-auto-floatrow-newfloatcommand)
+  "Matches the arguments of \"\\newfloatcommand\" from floatrow.sty.")
+
+;; Setup for various \Declare* macros:
+(TeX-auto-add-type "floatrow-DeclareNewOption" "LaTeX")
+
+(defvar LaTeX-floatrow-DeclareNewOption-regexp
+  `(,(concat
+      "\\\\Declare"
+      "\\("
+      (mapconcat #'identity
+                '("FloatStyle"         ; 3.6.1 Float Style Option (style=)
+                  "FloatFont"          ; 3.6.2 Float Font Option (font=)
+                  "FloatVCode"         ; 3.6.3 Option for Float Rules/Skips 
(precode= etc.)
+                  "ColorBox"           ; 3.6.4 Settings for Colored Frame 
(colorframeset=)
+                  "CBoxCorners"        ;       colorframecorners=
+                  "ObjectSet"          ; 3.6.5 Object Justification Option 
(objectset=)
+                  "MarginSet"          ; 3.6.6 Option for Float Box 
Alignment/Settings (margins=)
+                  "FloatSeparators"    ; 3.6.7 Float Separators Options 
(floatrowsep=, capbesidesep=)
+                  "FloatFootnoterule") ; 3.6.8 Option for Footnote Rule's 
Style (footnoterule=)
+                "\\|")
+      "\\)"
+      "{\\([^}]+\\)}")
+    (0 1 2) LaTeX-auto-floatrow-DeclareNewOption)
+  "Matches the arguments of \"\\Declare*\" from floatrow.sty.")
+
+;; Setup for \newseparated(label|ref):
+(TeX-auto-add-type "floatrow-newseparatedlabel-ref" "LaTeX")
+
+(defvar LaTeX-floatrow-newseparatedlabel-ref-regexp
+  `(,(concat
+      "\\\\newseparated"
+      "\\(label\\|ref\\)"
+      "{?"
+      "\\\\"
+      "\\([a-zA-Z]+\\)"
+      "}?")
+    (2 1) LaTeX-auto-floatrow-newseparatedlabel-ref)
+  "Matches the arguments \"\\newseparated(label|ref)\" command from 
floatrow.sty.")
+
+;; Setup for \DeclareNewFloatType:
+(TeX-auto-add-type "floatrow-DeclareNewFloatType" "LaTeX")
+
+(defvar LaTeX-floatrow-DeclareNewFloatType-regexp
+  '("\\\\DeclareNewFloatType{\\([^}]+\\)}"
+    1 LaTeX-auto-floatrow-DeclareNewFloatType)
+  "Matches the argument of \"\\DeclareNewFloatType\" command from 
floatrow.sty.")
+
+;; Plug them into the machinery.
+(defun LaTeX-floatrow-auto-prepare ()
+  "Clear various \"LaTeX-floatrow\" variables before parsing."
+  (setq LaTeX-auto-floatrow-newfloatcommand       nil
+       LaTeX-auto-floatrow-DeclareNewOption      nil
+       LaTeX-auto-floatrow-newseparatedlabel-ref nil
+       LaTeX-auto-floatrow-DeclareNewFloatType   nil))
+
+(defun LaTeX-floatrow-auto-cleanup ()
+  "Process parsed results from floatrow package."
+  ;; Replace initially the way fig & tab env's are inserted:
+  (LaTeX-floatrow-env-init)
+  ;;
+  ;; Process new key=val options:
+  (when (LaTeX-floatrow-DeclareNewOption-list)
+    (LaTeX-floatrow-update-key-val-options))
+  ;;
+  ;; Process new float commands like \ffigbox:
+  (when (LaTeX-floatrow-newfloatcommand-list)
+    (dolist (cmd (mapcar #'car (LaTeX-floatrow-newfloatcommand-list)))
+      (TeX-add-symbols `(,cmd LaTeX-floatrow-arg-floatbox))
+      (when (and (featurep 'font-latex)
+                (eq TeX-install-font-lock 'font-latex-setup))
+       (font-latex-add-keywords `((,cmd "[[["))
+                                'textual))))
+  ;;
+  ;; Process new label/ref commands:
+  (when (LaTeX-floatrow-newseparatedlabel-ref-list)
+    (let (floatrow-run-reftex-compile-vars)
+      (dolist (elt (LaTeX-floatrow-newseparatedlabel-ref-list))
+       (let ((cmd (car elt))
+             (type (cadr elt)))
+         (if (string= type "ref")
+             ;; More fun w/ referencing macros:
+             (TeX-add-symbols `(,cmd TeX-arg-ref))
+           ;; Less fun w/ label defining macros.  Add cmd to
+           ;; TeX-symbol-list:
+           (TeX-add-symbols `(,cmd TeX-arg-define-label))
+           ;; For AUCTeX, parse the argument of the new macro and add
+           ;; it to `LaTeX-auto-label':
+           (TeX-auto-add-regexp
+            `(,(concat "\\\\" cmd "{\\([^\n\r%\\{}]+\\)}") 1 LaTeX-auto-label))
+           ;; For RefTeX, append cmd to `reftex-label-regexps and set
+           ;; floatrow-run-reftex-compile-vars to t:
+           (when (and (boundp 'reftex-label-regexps)
+                      (fboundp 'reftex-compile-variables)
+                      (not (string-match
+                            cmd
+                            (mapconcat #'identity reftex-label-regexps "|"))))
+             (add-to-list (make-local-variable 'reftex-label-regexps)
+                          (concat "\\\\" cmd "{\\(?1:[^}]*\\)}") t)
+             (setq floatrow-run-reftex-compile-vars t)))
+         ;; Fontify macros as reference:
+         (when (and (featurep 'font-latex)
+                    (eq TeX-install-font-lock 'font-latex-setup))
+           (font-latex-add-keywords `((,cmd "{"))
+                                    'reference))))
+      ;; Run `reftex-compile-variables' if needed only once:
+      (when floatrow-run-reftex-compile-vars
+       (reftex-compile-variables))))
+  ;;
+  ;; Process new floattypes:
+  (when (LaTeX-floatrow-DeclareNewFloatType-list)
+    (LaTeX-floatrow-arg-declare-new-floattype nil t))
+  ;;
+  ;; Add elements from `LaTeX-floatrow-supported-float-types' to
+  ;; `LaTeX-caption-supported-float-types':
+  (when (boundp 'LaTeX-caption-supported-float-types)
+    (make-local-variable 'LaTeX-caption-supported-float-types)
+    (dolist (float LaTeX-floatrow-supported-float-types)
+      (add-to-list 'LaTeX-caption-supported-float-types float t))) )
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-floatrow-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-floatrow-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun LaTeX-floatrow-update-key-val-options ()
+  "Update buffer-local key-val options before offering for completion."
+  (let ((vcode-keys '("precode" "rowprecode" "midcode" "postcode" 
"rowpostcode"))
+       (sep-keys '("floatrowsep" "capbesidesep")))
+    (dolist (keyvals (LaTeX-floatrow-DeclareNewOption-list))
+      (let* ((key (cond ((string= (nth 1 keyvals) "FloatStyle")
+                        "style")
+                       ((string= (nth 1 keyvals) "FloatFont")
+                        "font")
+                       ((string= (nth 1 keyvals) "FloatVCode")
+                        "precode")
+                       ((string= (nth 1 keyvals) "ColorBox")
+                        "colorframeset")
+                       ((string= (nth 1 keyvals) "CBoxCorners")
+                        "colorframecorners")
+                       ((string= (nth 1 keyvals) "ObjectSet")
+                        "objectset")
+                       ((string= (nth 1 keyvals) "MarginSet")
+                        "margins")
+                       ((string= (nth 1 keyvals) "FloatSeparators")
+                        "floatrowsep")
+                       ((string= (nth 1 keyvals) "FloatFootnoterule")
+                        "footnoterule")
+                       (t nil)))
+            (val (nth 2 keyvals))
+            (val-match (cadr (assoc key LaTeX-floatrow-key-val-options-local)))
+            (temp (copy-alist LaTeX-floatrow-key-val-options-local))
+            (opts (cond ((string= key "precode")
+                         (dolist (x vcode-keys)
+                           (setq temp (assq-delete-all (car (assoc x temp)) 
temp)))
+                         temp)
+                        ((string= key "floatrowsep")
+                         (setq temp (dolist (x sep-keys)
+                                      (assq-delete-all (car (assoc x temp)) 
temp)))
+                         temp)
+                        (t
+                         (assq-delete-all (car (assoc key temp)) temp)))))
+       (cond ((string= key "precode")
+              (dolist (x vcode-keys)
+                (pushnew (list x (delete-dups (append (list val) val-match)))
+                         opts :test #'equal)))
+             ((string= key "floatrowsep")
+              (dolist (x sep-keys)
+                (pushnew (list x (delete-dups (append (list val) val-match)))
+                         opts :test #'equal)))
+             (t
+              (pushnew (list key (delete-dups (append (list val) val-match)))
+                       opts :test #'equal)))
+       (setq LaTeX-floatrow-key-val-options-local (copy-alist opts))))))
+
+(defun LaTeX-floatrow-arg-floatbox (optional)
+  "Query and insert arguments of float box commands from floatrow.sty.
+If OPTIONAL is non-nil, indicate optional argument during query."
+  ;; Query for the optional arguments; ask for "vertpos" only if
+  ;; "height" is given.  let-bind `TeX-arg-*-brace' for
+  ;; `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)
+    ;; Insert an extra pair of brackets if only `height' is given,
+    ;; otherwise it will become `width'
+    (when (and (string= width "")
+              height (not (string= height "")))
+      (insert "[]"))
+    (TeX-argument-insert height t)
+    (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:
+  (let* ((currenv (if (string-match "floatrow\\*?\\_>" 
(LaTeX-current-environment))
+                     (LaTeX-current-environment 2)
+                   (LaTeX-current-environment)))
+        (caption (TeX-read-string
+                  (TeX-argument-prompt optional nil "Caption")))
+        (short-caption
+         (when (>= (length caption) LaTeX-short-caption-prompt-length)
+           (TeX-read-string
+            (TeX-argument-prompt t nil "Short caption")))))
+    (indent-according-to-mode)
+    ;; The final result will look like this with * being point:
+    ;;   \ffigbox{*}{%
+    ;;     \caption{text}%
+    ;;     \label{fig:foo}%
+    ;;   }
+    (insert TeX-grop)
+    (save-excursion
+      ;; We are inside the 1. mandatory arg: Save the pos & insert `}{':
+      (insert TeX-grcl TeX-grop)
+      (if (and caption (not (string= caption "")))
+         (progn
+           ;; If caption, move to EOL, delete any spaces and hide the line end
+           (end-of-line)
+           (delete-horizontal-space)
+           (insert "%")
+           ;; Add a newline and the caption
+           (newline-and-indent)
+           (insert (LaTeX-compose-caption-macro caption short-caption))
+           ;; If we have a caption, then we probably also want a
+           ;; label.  Hide EOL end and proceed to enter a label
+           (insert "%")
+           (newline-and-indent)
+           (when (LaTeX-label currenv 'environment)
+             ;; Move point to end of line and hide EOL
+             (end-of-line)
+             (delete-horizontal-space)
+             (insert "%")
+             (newline-and-indent))
+           ;; Now close the group
+           (insert TeX-grcl)
+           (indent-according-to-mode)
+           (end-of-line))
+       ;; Otherwise, only insert a }
+       (insert TeX-grcl)))))
+
+(defun LaTeX-floatrow-env-init ()
+  "Replace AUCTeX entries in the variable `LaTeX-environment-list'.
+After loading the style hook floatrow.el, delete the entries for
+figure*? and table*? from variable `LaTeX-environment-list' and
+replace them with the ones offered by the style.  Original
+entries are available under \"rawfigure*?\" and \"rawtable*?\"."
+  (LaTeX-environment-list)
+  (dolist (env '("figure" "figure*" "table" "table*"))
+         (setq LaTeX-environment-list
+               (assq-delete-all (car (assoc env LaTeX-environment-list))
+                                LaTeX-environment-list))
+         (LaTeX-add-environments `(,env LaTeX-floatrow-env-figure)
+                                 `(,(concat "raw" env) 
LaTeX-floatrow-env-figure-raw))))
+
+(defun LaTeX-floatrow-env-figure (environment)
+  "Create floating ENVIRONMENT suitable for floatrow macros."
+  (let ((float (and LaTeX-float
+                   (TeX-read-string
+                    (TeX-argument-prompt t nil "Float position")
+                    LaTeX-float))))
+    (LaTeX-insert-environment environment
+                             (unless (zerop (length float))
+                               (concat LaTeX-optop float LaTeX-optcl)))))
+
+(defun LaTeX-floatrow-env-figure-raw (env)
+  "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)))
+    (LaTeX-env-figure environment)
+    (save-excursion
+      ;; `LaTeX-find-matching-begin' will not work for us as we don't
+      ;; know how user answers queries from AUCTeX, hence we search
+      ;; back for `environment':
+      (re-search-backward (concat "\\\\begin{" environment "}") nil t)
+      (end-of-line)
+      (LaTeX-newline)
+      (indent-according-to-mode)
+      (insert TeX-esc "RawFloats"))))
+
+(defun LaTeX-floatrow-arg-declare-new-options (optional prompt key)
+  "Query and insert user-defined values to keys provided by floatrow.sty.
+If OPTIONAL is non-nil, ask for an optional argument and insert
+it in square brackets.  PROMPT replaces the standard one.  KEY is
+a string and corresponds to first parsed element in
+`LaTeX-floatrow-DeclareNewOption-regexp'."
+  (let ((val (TeX-read-string
+             (TeX-argument-prompt optional prompt "New value option"))))
+    (LaTeX-add-floatrow-DeclareNewOptions
+     (list (concat TeX-esc "Declare" key TeX-grop val TeX-grcl)
+          key val))
+    (LaTeX-floatrow-update-key-val-options)
+    (TeX-argument-insert val optional)
+    (TeX-argument-insert
+     (TeX-read-key-val optional LaTeX-floatrow-key-val-options-local) 
optional)))
+
+(defun LaTeX-floatrow-arg-newseparatedlabel/ref (optional type)
+  "Query and insert user defined label and reference macros from floatrow.sty.
+If OPTIONAL is non-nil, insert the argument in brackets.  TYPE is
+the string \"label\" or \"ref\"."
+  (let ((cmd (TeX-read-string
+             (if (string= type "label")
+                 (TeX-argument-prompt optional nil "Label command: \\" t)
+               (TeX-argument-prompt optional nil "Reference command: \\" t)))))
+    (LaTeX-add-floatrow-newseparatedlabel-refs (list cmd type))
+    (if (string= type "label")
+       (TeX-add-symbols `(,cmd TeX-arg-define-label))
+      (TeX-add-symbols `(,cmd TeX-arg-ref)))
+    (TeX-argument-insert cmd optional TeX-esc)))
+
+(defun LaTeX-floatrow-arg-declare-new-floattype (optional &optional cleanup)
+  "Query and insert the first argument of \"DeclareNewFloatType\" macro from 
floatrow.sty.
+If OPTIONAL is non-nil, insert the argument in brackets.  If
+CLEANUP in non-nil, skip the query and insert process as we are
+inside the function `LaTeX-floatrow-auto-cleanup' and process
+only the parsed items."
+  (let ((type (if cleanup
+                 (mapcar #'car (LaTeX-floatrow-DeclareNewFloatType-list))
+               (list (TeX-read-string
+                      (TeX-argument-prompt optional nil "Environment 
type"))))))
+    ;; If not inside `LaTeX-floatrow-auto-cleanup', add user input to
+    ;; list of new floats and insert it
+    (unless cleanup
+      (LaTeX-add-floatrow-DeclareNewFloatTypes (car type))
+      (TeX-argument-insert (car type) optional))
+    ;; Make the next variables buffer local
+    (make-local-variable 'LaTeX-floatrow-supported-float-types)
+    (when (boundp 'LaTeX-caption-supported-float-types)
+      (make-local-variable 'LaTeX-caption-supported-float-types))
+    ;; Process new float type(s): a) add type to list of known
+    ;; environments incl. "raw" version b) add different flavors of
+    ;; type to `LaTeX-floatrow-supported-float-types' c) check if
+    ;; `LaTeX-caption-supported-float-types' is bound and add
+    ;; different flavors of type to it as well
+    (dolist (elt type)
+      (LaTeX-add-environments `(,elt LaTeX-floatrow-env-figure)
+                             `(,(concat "raw" elt) 
LaTeX-floatrow-env-figure-raw))
+      (add-to-list 'LaTeX-floatrow-supported-float-types elt t)
+      (add-to-list 'LaTeX-floatrow-supported-float-types (concat "wide" elt) t)
+      (add-to-list 'LaTeX-floatrow-supported-float-types (concat elt "row") t)
+      (add-to-list 'LaTeX-floatrow-supported-float-types (concat "capbeside" 
elt) t)
+      (when (boundp 'LaTeX-caption-supported-float-types)
+       (add-to-list 'LaTeX-caption-supported-float-types elt t)
+       (add-to-list 'LaTeX-caption-supported-float-types (concat "wide" elt) t)
+       (add-to-list 'LaTeX-caption-supported-float-types (concat elt "row") t)
+       (add-to-list 'LaTeX-caption-supported-float-types (concat "capbeside" 
elt) t)))))
+
+(TeX-add-style-hook
+ "floatrow"
+ (lambda ()
+
+   ;; Add floatrow to the parser
+   (TeX-auto-add-regexp LaTeX-floatrow-DeclareNewOption-regexp)
+   (TeX-auto-add-regexp LaTeX-floatrow-newfloatcommand-regexp)
+   (TeX-auto-add-regexp LaTeX-floatrow-newseparatedlabel-ref-regexp)
+   (TeX-auto-add-regexp LaTeX-floatrow-DeclareNewFloatType-regexp)
+
+   ;; Activate the buffer-local version of key-vals
+   (setq LaTeX-floatrow-key-val-options-local
+        (copy-alist LaTeX-floatrow-key-val-options))
+
+   ;; Add pre-defined float commands:
+   (LaTeX-add-floatrow-newfloatcommands
+    "ffigbox" "fcapside" "ttabbox")
+
+   ;; Macros
+   (TeX-add-symbols
+    ;; 2.1 The \floatbox Macro
+    ;; \floatbox[<preamble>]{<captype>}[<width>][<height>][<vert 
pos>]{<caption>}{<object>}
+    '("floatbox"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Preamble")
+                    '("\\capbeside" "\\nocapbeside" "\\captop") ]
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Float type")
+                   LaTeX-floatrow-supported-float-types)
+      LaTeX-floatrow-arg-floatbox)
+
+    ;; 2.2 Creation of Personal Commands for Float Boxes
+    '("newfloatcommand"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((cmd (TeX-read-string
+                    (TeX-argument-prompt optional nil "Command"))))
+          (LaTeX-add-floatrow-newfloatcommands cmd)
+          (TeX-add-symbols
+           `(,cmd LaTeX-floatrow-arg-floatbox))
+          (format "%s" cmd))))
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Float type")
+                   '("figure" "table"))
+      [ 2 ])
+
+    '("renewfloatcommand"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Command")
+                   (LaTeX-floatrow-newfloatcommand-list))
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Float type")
+                   '("figure" "table"))
+      [ 2 ])
+
+
+    ;; 2.2.2 Predefined Float Box Commands
+    '("ffigbox"
+      LaTeX-floatrow-arg-floatbox)
+
+    '("ttabbox"
+      LaTeX-floatrow-arg-floatbox)
+
+    '("fcapside"
+      LaTeX-floatrow-arg-floatbox)
+
+    ;; 2.3.1 Mixed Row
+    '("CenterFloatBoxes" 0)
+    '("TopFloatBoxes" 0)
+    '("BottomFloatBoxes" 0)
+    '("PlainFloatBoxes" 0)
+    '("buildFBBOX" 2)
+
+    ;; 3 Float Layout Settings
+    '("floatsetup"
+      [ TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Float type")
+                    LaTeX-floatrow-supported-float-types ]
+      (TeX-arg-key-val LaTeX-floatrow-key-val-options-local))
+
+    ;; 3.2 Settings for Current Float Environment
+    '("thisfloatsetup"
+      (TeX-arg-key-val LaTeX-floatrow-key-val-options-local))
+
+    ;; 3.3 Clearing of Settings for Current Float Type
+    '("clearfloatsetup"
+      (TeX-arg-eval completing-read
+                    (TeX-argument-prompt optional nil "Float type")
+                    LaTeX-floatrow-supported-float-types))
+
+    ;; 3.4 Temporary Clearing of All Float Settings
+    '("killfloatstyle" 0)
+
+    ;; 3.6.1 Float Style Option (style=)
+    '("DeclareFloatStyle"
+      (LaTeX-floatrow-arg-declare-new-options "New style option"
+                                             "FloatStyle"))
+
+    ;; 3.6.2 Float Font Option (font=)
+    '("DeclareFloatFont"
+      (LaTeX-floatrow-arg-declare-new-options "New font option"
+                                             "FloatFont"))
+
+    ;; 3.6.3 Option for Float Rules/Skips (precode= etc.)
+    '("DeclareFloatVCode"
+      (LaTeX-floatrow-arg-declare-new-options "New rules/skip option"
+                                             "FloatVCode"))
+
+    ;; 3.6.4 Settings for Colored Frame (colorframeset=)
+    '("DeclareColorBox"
+      (LaTeX-floatrow-arg-declare-new-options "New colored frame option"
+                                             "ColorBox"))
+
+    ;; (colorframecorners=)
+    '("DeclareCBoxCorners"
+      (LaTeX-floatrow-arg-declare-new-options "New colored corner option"
+                                             "CBoxCorners"))
+
+    ;; 3.6.5 Object Justification Option (objectset=)
+    '("DeclareObjectSet"
+      (LaTeX-floatrow-arg-declare-new-options "New object justification"
+                                             "ObjectSet"))
+
+    ;; 3.6.6 Option for Float Box Alignment/Settings (margins=)
+    '("DeclareMarginSet"
+      (LaTeX-floatrow-arg-declare-new-options "New alignment option"
+                                             "MarginSet"))
+
+    '("setfloatmargins" 2)
+    '("setfloatmargins*" 2)
+    '("floatfacing" 2)
+    '("floatfacing*" 2)
+    '("floatboxmargins" 2)
+    '("floatrowmargins" 2)
+    '("floatcapbesidemargins" 2)
+
+    ;; 3.6.7 Float Separators Options (floatrowsep=, capbesidesep=)
+    '("DeclareFloatSeparators"
+      (LaTeX-floatrow-arg-declare-new-options "New separator option"
+                                             "FloatSeparators"))
+
+    ;; 3.6.8 Option for Footnote Rule's Style (footnoterule=)
+    '("DeclareFloatFootnoterule"
+      (LaTeX-floatrow-arg-declare-new-options "New footnote rule option"
+                                             "FloatFootnoterule"))
+
+    ;; 4 Creation of New Float Types
+    '("DeclareNewFloatType"
+      (LaTeX-floatrow-arg-declare-new-floattype)
+      (TeX-arg-key-val (("placement" ("tbp" "t" "b" "p"))
+                       ("name")
+                       ("fileext")
+                       ("within" ("chapter" "section" "subsection"))
+                       ("relatedcapstyle" ("yes" "no")))))
+
+    ;; 6.2 Support of The Label-Sublabel References
+    '("newseparatedlabel"
+      (LaTeX-floatrow-arg-newseparatedlabel/ref "label") 2)
+
+    '("newseparatedref"
+      (LaTeX-floatrow-arg-newseparatedlabel/ref "ref") t)
+
+    '("makelabelseparator" t) ) ;; terminate TeX-add-symbols
+
+   ;; Environments
+   (LaTeX-add-environments
+    ;; 2.3 Building Float Row
+    '("floatrow" [ "Number of beside floats" ])
+
+    ;; 6.1 Managing of Float Parts With the subfloatrow Environment
+    '("subfloatrow"  [ "Number of beside floats" ])
+    '("subfloatrow*" [ "Number of beside floats" ]))
+
+   ;; 2.1.1 Float Box Width Equals to The Width of Object Contents
+   (LaTeX-add-lengths "FBwidth" "FBheight" "Xhsize")
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("floatbox"  "[{[[[")
+                               ("ffigbox"   "[[[")
+                               ("ttabbox"   "[[[")
+                               ("fcapside"  "[[["))
+                             'textual)
+     (font-latex-add-keywords '(("newfloatcommand"           "{{[[")
+                               ("renewfloatcommand"         "{{[[")
+                               ("buildFBBOX"                "{{")
+                               ("floatsetup"                "[{")
+                               ("thisfloatsetup"            "{")
+                               ("clearfloatsetup"           "{")
+                               ("killfloatstyle"            "")
+                               ("DeclareFloatStyle"         "{{")
+                               ("DeclareFloatFont"          "{{")
+                               ("DeclareFloatVCode"         "{{")
+                               ("DeclareColorBox"           "{{")
+                               ("DeclareCBoxCorners"        "{{")
+                               ("DeclareObjectSet"          "{{")
+                               ("DeclareMarginSet"          "{{")
+                               ("DeclareFloatSeparators"    "{{")
+                               ("DeclareFloatFootnoterule"  "{{")
+                               ("newseparatedlabel"         "{{{")
+                               ("newseparatedref"           "{{")
+                               ("makelabelseparator"        "{")
+                               ("DeclareNewFloatType"       "{{")
+                               ("RawFloats"                 ""))
+                             'function)))
+ LaTeX-dialect)
+
+(defvar LaTeX-floatrow-package-options nil
+  "Prompt for package options for the floatrow package.")
+
+;;; floatrow.el ends here
diff --git a/style/fontspec.el b/style/fontspec.el
index 5ec7bb4..58f4e48 100644
--- a/style/fontspec.el
+++ b/style/fontspec.el
@@ -1,9 +1,9 @@
-;;; fontspec.el --- AUCTeX style for `fontspec.sty' version 2.3c.
+;;; fontspec.el --- AUCTeX style for `fontspec.sty' version 2.6a.
 
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2017 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
-;; Author: Mosè Giordano <address@hidden>
+;; Author: Mosè Giordano <address@hidden>
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -25,94 +25,119 @@
 
 ;;; Commentary:
 
-;; This file adds support for `fontspec.sty' version 2.3c.
+;; This file adds support for `fontspec.sty' version 2.6a.  Starting
+;; with `fontspec.sty' v2.4, the order of mandatory font names and
+;; optional font features in related macros has changed, i.e. optional
+;; argument comes after the mandatory one.  This change is now (April
+;; 2017) implemented in this file.  Fontification support retains
+;; backward compatibilty.
 
 ;;; Code:
 
 (defvar LaTeX-fontspec-font-features
-  '(;; More control over font shape selection
+  '(;; 5 Font selection
+    ("Extension" (".otf" ".ttf" ".ttc" ".dfont"))
+    ("Path")
+    ;; 6.1 More control over font shape selection
     ("BoldFont")
     ("ItalicFont")
     ("BoldItalicFont")
     ("SlantedFont")
     ("BoldSlantedFont")
     ("SmallCapsFont")
-    ;; Different features for different font shapes
+    ;; 6.2 Specifically choosing the NFSS family
+    ("NFSSFamily")
+    ("FontFace")
+    ;; 11 Different features for different font shapes
+    ("UprightFeatures")
     ("BoldFeatures")
     ("ItalicFeatures")
     ("BoldItalicFeatures")
     ("SlantedFeatures")
     ("BoldSlantedFeatures")
     ("SmallCapsFeatures")
-    ;; Different features for different font sizes
+    ;; 13 Different features for different font sizes
     ("SizeFeatures")
-    ;; Font independent options
+    ;; 14 Font independent options
     ("Color")
     ("Scale" ("MatchLowercase" "MatchUppercase"))
     ("WordSpace")
     ("PunctuationSpace")
     ("HyphenChar")
     ("OpticalSize")
-    ;; OpenType options
-    ("Ligatures" ("Required"
-                 "NoRequired"
-                 "Common"
-                 "NoCommon"
-                 "Contextual"
-                 "NoContextual"
-                 "Rare"
-                 "Historic"
-                 "TeX"))
-    ("Letters" ("Uppercase"
-               "SmallCaps"
-               "PetiteCaps"
-               "UppercaseSmallCaps"
-               "UppercasePetiteCaps"
-               "Unicase"))
-    ("Numbers" ("Lining"
-               "OldStyle"
-               "Proportional"
-               "Monospaced"
-               "SlashedZero"
-               "Arabic"))
-    ("Contextuals" ("Swash"
-                   "Alternate"
-                   "WordInitial"
-                   "WordFinal"
-                   "LineFinal"
-                   "Inner"))
-    ("VerticalPosition" ("Superior"
-                        "Inferior"
-                        "Numerator"
-                        "Denominator"
-                        "ScientificInferior"
-                        "Ordinal"))
-    ("Fraction" ("On" "Alternate"))
-    ("StylisticSet")
-    ("CharacterVariants")
-    ("Alternate")
-    ("Style" ("Alternate"
-             "Italic"
-             "Ruby"
-             "Swash"
-             "Historic"
-             "TitlingCaps"
-             "HorizontalKana"
-             "VerticalKana"))
-    ("Diacritics" ("MarkToBase"
-                  "NoMarkToBase"
-                  "MarkToMark"
-                  "NoMarkToMark"
-                  "AboveBase"
-                  "NoAboveBase"
-                  "BelowBase"
-                  "NoBelowBase"))
-    ("Kerning" ("Uppercase" "On" "Off"))
     ("AutoFakeBold")
     ("AutoFakeSlant")
     ("FakeSlant")
     ("FakeStretch")
     ("FakeBold")
+    ("LetterSpace")
+    ;; 16 OpenType options
+    ("Ligatures" ("Required"      "RequiredOff"
+                 "Common"        "CommonOff"
+                 "Contextual"    "ContextualOff"
+                 "Rare"          "RareOff"
+                 "Discretionary" "DiscretionaryOff"
+                 "Historic"      "HistoricOff"
+                 "TeX"
+                 "ResetAll"))
+    ("Letters" ("Uppercase"           "UppercaseOff"
+               "SmallCaps"           "SmallCapsOff"
+               "PetiteCaps"          "PetiteCapsOff"
+               "UppercaseSmallCaps"  "UppercaseSmallCapsOff"
+               "UppercasePetiteCaps" "UppercasePetiteCapsOff"
+               "Unicase"             "UnicaseOff"
+               "ResetAll"))
+    ("Numbers" ("Uppercase"    "UppercaseOff"
+               "Lowercase"    "LowercaseOff"
+               "Lining"       "LiningOff"
+               "OldStyle"     "OldStyleOff"
+               "Proportional" "ProportionalOff"
+               "Monospaced"   "MonospacedOff"
+               "SlashedZero"  "SlashedZeroOff"
+               "Arabic"       "ArabicOff"
+               "ResetAll"))
+    ("Contextuals" ("Swash"       "SwashOff"
+                   "Alternate"   "AlternateOff"
+                   "WordInitial" "WordInitialOff"
+                   "WordFinal"   "WordFinalOff"
+                   "LineFinal"   "LineFinalOff"
+                   "Inner"       "InnerOff"
+                   "ResetAll"))
+    ("VerticalPosition" ("Superior"           "SuperiorOff"
+                        "Inferior"           "InferiorOff"
+                        "Numerator"          "NumeratorOff"
+                        "Denominator"        "DenominatorOff"
+                        "ScientificInferior" "ScientificInferiorOff"
+                        "Ordinal"            "OrdinalOff"
+                        "ResetAll"))
+    ("Fraction" ("On" "Off" "Reset" "Alternate" "AlternateOff" "ResetAll"))
+    ("StylisticSet")
+    ("CharacterVariant")
+    ("Alternate" ("Random"))
+    ("Style" ("Alternate"      "AlternateOff"
+             "Italic"         "ItalicOff"
+             "Ruby"           "RubyOff"
+             "Swash"          "SwashOff"
+             "Cursive"        "CursiveOff"
+             "Historic"       "HistoricOff"
+             "TitlingCaps"    "TitlingCapsOff"
+             "HorizontalKana" "HorizontalKanaOff"
+             "VerticalKana"   "VerticalKanaOff"
+             "ResetAll"))
+    ("Diacritics" ("MarkToBase" "MarkToBaseOff"
+                  "MarkToMark" "MarkToMarkOff"
+                  "AboveBase"  "AboveBaseOff"
+                  "BelowBase"  "BelowBaseOff"
+                  "ResetAll"))
+    ("Kerning" ("Uppercase" "UppercaseOff" "On" "Off" "Reset" "ResetAll"))
+    ("CharacterWidth" ("Proportional"          "ProportionalOff"
+                      "Full"                  "FullOff"
+                      "Half"                  "HalfOff"
+                      "Third"                 "ThirdOff"
+                      "Quarter"               "QuarterOff"
+                      "AlternateProportional" "AlternateProportionalOff"
+                      "AlternateHalf"         "AlternateHalfOff"
+                      "ResetAll"))
     ("Annotation")
     ("CJKShape" ("Traditional"
                 "Simplified"
@@ -121,16 +146,24 @@
                 "JIS1990"
                 "Expert"
                 "NLC"))
-    ("CharacterWidth" ("Proportional"
-                      "Full"
-                      "Half"
-                      "Third"
-                      "Quarter"
-                      "AlternateProportional"
-                      "AlternateHalf"))
-    ("Vertical" ("RotatedGlyphs")))
+    ("Vertical" ("RotatedGlyphs"         "RotatedGlyphsOff"
+                "AlternatesForRotation" "AlternatesForRotationOff"
+                "Alternates"            "AlternatesOff"
+                "KanaAlternates"        "KanaAlternatesOff"
+                "Kerning"               "KerningOff"
+                "AlternateMetrics"      "AlternateMetricsOff"
+                "HalfMetrics"           "HalfMetricsOff"
+                "ProportionalMetrics"   "ProportionalMetricsOff"
+                "ResetAll"))
+    ;; 25 Going behind fontspec's back: Offer only an excerpt of all
+    ;; possible tags:
+    ("RawFeature" ("frac" "lnum" "onum" "pnum" "smcp" "tnum" "zero")))
   "Font features options for macros of the fontspec package.")
 
+(defvar LaTeX-fontspec-font-features-local nil
+  "Buffer-local font features options for macros of the fontspec package.")
+(make-variable-buffer-local 'LaTeX-fontspec-font-features-local)
+
 (defvar LaTeX-fontspec-font-list nil
   "List of the fonts accessible to fontspec.")
 
@@ -163,74 +196,205 @@ to retrieve the list of fonts."
     (or LaTeX-fontspec-font-list LaTeX-fontspec-font-list-default))
    optional))
 
+(defun LaTeX-fontspec-update-font-features ()
+  "Update Color key=values in `LaTeX-fontspec-font-features-local'."
+  ;; Check if any color defininig package is loaded and update the
+  ;; key=values for coloring.  Prefer xcolor.sty if both packages are
+  ;; loaded.
+  (when (or (member "xcolor" (TeX-style-list))
+           (member "color" (TeX-style-list)))
+    (let* ((colorcmd (if (member "xcolor" (TeX-style-list))
+                        #'LaTeX-xcolor-definecolor-list
+                      #'LaTeX-color-definecolor-list))
+          (tmp (copy-alist LaTeX-fontspec-font-features-local)))
+      (setq tmp (assq-delete-all (car (assoc "Color" tmp)) tmp))
+      (push (list "Color" (mapcar #'car (funcall colorcmd))) tmp)
+      (setq LaTeX-fontspec-font-features-local
+           (copy-alist tmp)))))
+
+;; Setup for \newfontfamily and \newfontface:
+(TeX-auto-add-type "fontspec-newfontcmd" "LaTeX")
+
+(defvar LaTeX-fontspec-newfontcmd-regexp
+  '("\\\\newfontfa\\(?:ce\\|mily\\)[ \t\n\r%]*\\\\\\([a-zA-Z]+\\)"
+    1 LaTeX-auto-fontspec-newfontcmd)
+  "Matches new macros defined with \\newfontface and \\newfontfamily.")
+
+(defun LaTeX-fontspec-auto-prepare ()
+  "Clear `LaTeX-auto-fontspec-newfontcmd' before parsing."
+  (setq LaTeX-auto-fontspec-newfontcmd nil))
+
+(defun LaTeX-fontspec-auto-cleanup ()
+  "Process parsed elements for fontspec package."
+  (dolist (mac (mapcar #'car (LaTeX-fontspec-newfontcmd-list)))
+    ;; Add macro to list of known macros
+    (TeX-add-symbols mac)
+    ;; Cater for fontification
+    (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+      (font-latex-add-keywords `((,mac ""))
+                              'type-declaration)))
+  ;; Update values of Color key:
+  (LaTeX-fontspec-update-font-features))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-fontspec-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-fontspec-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
 (TeX-add-style-hook
  "fontspec"
  (lambda ()
    (TeX-check-engine-add-engines 'luatex 'xetex)
    (TeX-run-style-hooks "expl3" "xparse")
+
+   ;; Add fontspec to the parser.
+   (TeX-auto-add-regexp LaTeX-fontspec-newfontcmd-regexp)
+
+   ;; Activate the buffer local version of font features:
+   (setq LaTeX-fontspec-font-features-local
+        (copy-alist LaTeX-fontspec-font-features))
+
    (TeX-add-symbols
-    ;; Font selection
-    '("fontspec" [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      LaTeX-fontspec-arg-font)
+    ;; 4.3 Commands for old-style and lining numbers: \oldstylenums is
+    ;; already provided by LaTeX, so just add \liningnums here
+    '("liningnums" "Numbers")
+
+    ;; 4.5 Emphasis and nested emphasis
+    ;; \emshape seems to be an internal macro
+    "emshape"
+    '("emfontdeclare" t)
+    "emreset"
+
+    ;; 4.6 Strong emphasis
+    '("strong" t)
+    '("strongfontdeclare" t)
+    "strongreset"
+
+    ;; 5 Font selection
+    '("fontspec"
+      LaTeX-fontspec-arg-font
+      [TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
+
     ;; Default font families
     '("setmainfont"
-      [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      (LaTeX-fontspec-arg-font "Main font name"))
+      (LaTeX-fontspec-arg-font "Main font name")
+      [TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
     '("setsansfont"
-      [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      (LaTeX-fontspec-arg-font "Sans font name"))
+      (LaTeX-fontspec-arg-font "Sans font name")
+      [TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
     '("setmonofont"
-      [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      (LaTeX-fontspec-arg-font "Mono font name"))
-    ;; New commands to select font families
+      (LaTeX-fontspec-arg-font "Mono font name")
+      [TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
+
+    ;; 5.3 Querying whether a font exists
+    '("IfFontExistsTF" LaTeX-fontspec-arg-font 2)
+
+    ;; 6 commands to select font families
     '("newfontfamily" TeX-arg-define-macro
-      [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      LaTeX-fontspec-arg-font)
+      LaTeX-fontspec-arg-font
+      [TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
+
     '("newfontface" TeX-arg-define-macro
-      [TeX-arg-key-val LaTeX-fontspec-font-features "Font features"]
-      LaTeX-fontspec-arg-font)
-    ;; Math(s) fonts
-    '("setmathrm" [ "Font features" ] "Font name")
-    '("setmathsf" [ "Font features" ] "Font name")
-    '("setmathtt" [ "Font features" ] "Font name")
-    '("setboldmathrm" [ "Font features" ] "Font name")
-    ;; Emphasis and nested emphasis
-    "emshape"
-    "eminnershape"
-    ;; Default settings
+      LaTeX-fontspec-arg-font
+      [TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
+
+    ;; 6.4 Math(s) fonts
+    '("setmathrm" "Font name" [ "Font features" ])
+    '("setmathsf" "Font name" [ "Font features" ])
+    '("setmathtt" "Font name" [ "Font features" ])
+    '("setboldmathrm" "Font name" [ "Font features" ])
+
+    ;; 8 Default settings
     '("defaultfontfeatures" [ LaTeX-fontspec-arg-font ]
-      (TeX-arg-key-val LaTeX-fontspec-font-features "Font features"))
+      (TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"))
+    '("defaultfontfeatures+" [ LaTeX-fontspec-arg-font ]
+      (TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"))
+
+    ;; 10 Working with the currently selected features
+    '("IfFontFeatureActiveTF"
+      [TeX-arg-key-val LaTeX-fontspec-font-features-local "Font feature"] 2)
+
     ;; Changing the currently selected features
     '("addfontfeatures"
-      (TeX-arg-key-val LaTeX-fontspec-font-features "Font features"))
-    ;; Defining new scripts and languages
+      (TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"))
+
+    ;; 23 Defining new features
+    '("newAATfeature"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Existing feature")
+                   LaTeX-fontspec-font-features-local)
+      "New option" 2)
+
+    '("newopentypefeature"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Existing feature")
+                   LaTeX-fontspec-font-features-local)
+      "New option" t)
+
+    '("newfontfeature" "New feature" t)
+
+    ;; 24 Defining new scripts and languages
     '("newfontscript" "Script name" "OpenType tag")
-    '("newfontlanguage" "Language name" "OpenType tag"))
+    '("newfontlanguage" "Language name" "OpenType tag")
+
+    ;; 26 Renaming existing features & options
+    '("aliasfontfeature"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Existing feature")
+                   LaTeX-fontspec-font-features-local)
+      "New name")
+
+    '("aliasfontfeatureoption"
+      (TeX-arg-eval
+       (lambda ()
+        (let* ((key (completing-read
+                     (TeX-argument-prompt optional nil "Feature")
+                     LaTeX-fontspec-font-features-local))
+               (val (completing-read
+                     (TeX-argument-prompt optional nil "Existing name")
+                     (cadr (assoc key LaTeX-fontspec-font-features-local)))))
+          (TeX-argument-insert key optional)
+          (format "%s" val))))
+      "New name") )
+
+   (LaTeX-add-environments
+    ;; 4.6 Strong emphasis
+    '("strong"))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("fontspec"    "[{")
-                               ("setmainfont" "[{")
-                               ("setsansfont" "[{")
-                               ("setmonofont" "[{")
-                               ("newfontfamily" "\\[{")
-                               ("newfontface" "\\[{")
-                               ("setmathrm" "[{")
-                               ("setmathsf" "[{")
-                               ("setmathtt" "[{")
-                               ("setboldmathrm" "[{")
-                               ("emshape")
-                               ("eminnershape")
-                               ("defaultfontfeatures" "[{")
-                               ("addfontfeature" "{")
-                               ("newfontscript" "{{")
-                               ("newfontlanguage" "{{"))
-                             'function)))
+     (font-latex-add-keywords '(("fontspec"    "[{[")
+                               ("setmainfont" "[{[")
+                               ("setsansfont" "[{[")
+                               ("setmonofont" "[{[")
+                               ("newfontfamily" "\\[{[")
+                               ("newfontface"   "\\[{[")
+                               ("setmathrm" "[{[")
+                               ("setmathsf" "[{[")
+                               ("setmathtt" "[{[")
+                               ("setboldmathrm" "[{[")
+                               ("defaultfontfeatures" "+[{")
+                               ("addfontfeature"  "{")
+                               ("addfontfeatures" "{")
+                               ("newfontscript"   "{{")
+                               ("newfontlanguage" "{{")
+                               ("emfontdeclare"   "{")
+                               ("strongfontdeclare"  "{")
+                               ("newAATfeature"      "{{{{")
+                               ("newopentypefeature" "{{{")
+                               ("newfontfeature"     "{{")
+                               ("aliasfontfeature"   "{{")
+                               ("aliasfontfeatureoption" "{{{"))
+                             'function)
+     (font-latex-add-keywords '(("liningnums"    "{"))
+                             'type-command)
+     (font-latex-add-keywords '(("strong"    "{"))
+                             'bold-command)))
  LaTeX-dialect)
 
 (defvar LaTeX-fontspec-package-options
-  '("math" "no-math" "config" "no-config" "quiet" "silent")
+  '("tuenc" "euenc" "math" "no-math" "config" "no-config" "quiet" "silent")
   "Package options for the fontspec package.")
 
 ;;; fontspec.el ends here
diff --git a/style/fvextra.el b/style/fvextra.el
index 6ca2341..eeb7d37 100644
--- a/style/fvextra.el
+++ b/style/fvextra.el
@@ -97,7 +97,7 @@
                   "spacecolor"))
           (tmp (copy-alist LaTeX-fancyvrb-key-val-options-local)))
       (dolist (x keys)
-       (assq-delete-all (car (assoc x tmp)) tmp)
+       (setq tmp (assq-delete-all (car (assoc x tmp)) tmp))
        (if (string= x "highlightcolor")
            (pushnew (list x (mapcar #'car (funcall colorcmd))) tmp :test 
#'equal)
          (pushnew (list x (append '("none") (mapcar #'car (funcall 
colorcmd)))) tmp :test #'equal)))
diff --git a/style/graphicx.el b/style/graphicx.el
index f7e1230..4fcdc17 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, 2016 by Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2004, 2005, 2014--2017 by Free Software Foundation, Inc.
 
 ;; Author: Ryuichi Arafune <address@hidden>
 ;; Created: 1999/3/20
@@ -51,7 +51,9 @@
     ("keepaspectratio" ("true" "false"))
     ("scale")
     ("clip"  ("true" "false"))
-    ("draft" ("true" "false")))
+    ("draft" ("true" "false"))
+    ("quiet")
+    ("interpolate" ("true" "false")))
   "Key=value options for graphicx macros.")
 
 (defvar LaTeX-includegraphics-dvips-extensions
@@ -79,7 +81,8 @@ spaces conveniently.
 
 If `TeX-engine' is set to symbol 'default (while
 `TeX-PDF-from-DVI' is set to nil) or 'luatex and `TeX-PDF-mode'
-is non-nil, add the key \"page\" to list of key-val's."
+is non-nil, add the keys \"page\" and \"pagebox\" to list of
+key-val's."
   (let ((crm-local-completion-map
         (remove (assoc 32 crm-local-completion-map)
                 crm-local-completion-map))
@@ -92,7 +95,13 @@ is non-nil, add the key \"page\" to list of key-val's."
                                         (not (TeX-PDF-from-DVI)))
                                    (eq TeX-engine 'luatex))
                                TeX-PDF-mode)
-                          (append '(("page")) LaTeX-graphicx-key-val-options)
+                          (append '(("page")
+                                    ("pagebox" ("mediabox"
+                                                "cropbox"
+                                                "bleedbox"
+                                                "trimbox"
+                                                "artbox")))
+                                  LaTeX-graphicx-key-val-options)
                         LaTeX-graphicx-key-val-options))
      optional)))
 
diff --git a/style/mdframed.el b/style/mdframed.el
index e6caeb3..79a3a8b 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 Free Software Foundation, Inc.
+;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -241,7 +241,7 @@
                   "subtitlebelowlinecolor"))
           (tmp (copy-alist LaTeX-mdframed-key-val-options-local)))
       (dolist (x keys)
-       (assq-delete-all (car (assoc x tmp)) tmp)
+       (setq tmp (assq-delete-all (car (assoc x tmp)) tmp))
        (pushnew (list x (mapcar #'car (funcall colorcmd))) tmp :test #'equal))
       (setq LaTeX-mdframed-key-val-options-local
            (copy-alist tmp)))))
@@ -257,7 +257,7 @@
   (dolist (env (mapcar #'car (LaTeX-mdframed-newmdenv-list)))
     (LaTeX-add-environments
      `(,env LaTeX-env-args [ TeX-arg-key-val 
LaTeX-mdframed-key-val-options-local ] ))
-    (TeX-ispell-skip-setcdr `((,env ispell-tex-skip-alist 0))))
+    (TeX-ispell-skip-setcdr `((,env ispell-tex-arg-end 0))))
   (dolist (newenv (LaTeX-mdframed-mdtheorem-list))
     (let ((env (car newenv))
          (new (cadr newenv)))
@@ -297,7 +297,7 @@
           (LaTeX-add-environments
            `(,env LaTeX-env-args [ TeX-arg-key-val 
LaTeX-mdframed-key-val-options-local ]))
           ;; Add new env's to `ispell-tex-skip-alist': skip the optional 
argument
-          (TeX-ispell-skip-setcdr `((,env ispell-tex-skip-alist 0)))
+          (TeX-ispell-skip-setcdr `((,env ispell-tex-arg-end 0)))
           (format "%s" env)))))
 
     '("renewmdenv"
diff --git a/style/minted.el b/style/minted.el
index 159e853..3ae3b48 100644
--- a/style/minted.el
+++ b/style/minted.el
@@ -35,28 +35,43 @@
 (defvar LaTeX-minted-key-val-options
   '(("autogobble" ("true" "false"))
     ("baselinestretch" ("auto"))
+    ("beameroverlays" ("true" "false"))
     ("breakafter")
     ("breakaftergroup" ("true" "false"))
     ("breakaftersymbolpre")
     ("breakaftersymbolpost")
+    ("breakanywhere" ("true" "false"))
+    ("breakanywheresymbolpre")
+    ("breakanywheresymbolpost")
+    ("breakautoindent" ("true" "false"))
+    ("breakbefore")
+    ("breakbeforegroup" ("true" "false"))
+    ("breakbeforesymbolpre")
+    ("breakbeforesymbolpost")
     ("breakbytoken" ("true" "false"))
     ("breakbytokenanywhere" ("true" "false"))
     ("breakindent")
+    ("breakindentnchars")
     ("breaklines" ("true" "false"))
     ("breaksymbol")
     ("breaksymbolleft")
     ("breaksymbolright")
     ("breaksymbolindent")
+    ("breaksymbolindentnchars")
     ("breaksymbolindentleft")
+    ("breaksymbolindentleftnchars")
     ("breaksymbolindentright")
+    ("breaksymbolseprightnchars")
     ("breaksymbolsep")
+    ("breaksymbolsepnchars")
     ("breaksymbolsepleft")
+    ("breaksymbolsepleftnchars")
     ("breaksymbolsepright")
+    ("breaksymbolseprightnchars")
     ("bgcolor")
     ("codetagify")
     ("curlyquotes" ("true" "false"))
     ("encoding")
-    ("outencoding")
     ("escapeinside")
     ("firstline")
     ("firstnumber" ("auto" "last" "integer"))
@@ -85,6 +100,7 @@
     ("numberblanklines" ("true" "false"))
     ("numbersep")
     ("obeytabs" ("true" "false"))
+    ("outencoding")
     ("python3" ("true" "false"))
     ("resetmargins" ("true" "false"))
     ("rulecolor")
@@ -109,7 +125,7 @@
     ("stepnumberfromfirst")
     ("stepnumberoffsetvalues" ("true" "false"))
     ("stripall" ("true" "false"))
-    ("stripnl")
+    ("stripnl" ("true" "false"))
     ("tab")
     ("tabcolor")
     ("tabsize")
@@ -196,7 +212,7 @@ are loaded."
                        "rulecolor" "spacecolor" "tabcolor"))
           (opts (copy-alist LaTeX-minted-key-val-options-local)))
       (dolist (key colorkeys)
-       (assq-delete-all (car (assoc key opts)) opts)
+       (setq opts (assq-delete-all (car (assoc key opts)) opts))
        (push (list key (mapcar #'car (funcall colorcmd)))
              opts))
       (setq LaTeX-minted-key-val-options-local
diff --git a/style/moodle.el b/style/moodle.el
new file mode 100644
index 0000000..c304481
--- /dev/null
+++ b/style/moodle.el
@@ -0,0 +1,213 @@
+;;; moodle.el --- AUCTeX style for `moodle.sty' (v0.5)
+
+;; Copyright (C) 2017 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <address@hidden>
+;; Maintainer: address@hidden
+;; Created: 2017-06-10
+;; 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 `moodle.sty' (v0.5) from 2016/01/11.
+
+;; In multi environments, the correct answer is marked with `\item*'.
+;; This style adds asterisk to the list of key=values queried after
+;; \item in this environment in order to make the input procedure
+;; easier.
+
+;;; Code:
+
+(defvar LaTeX-moodle-key-val-options
+  '(("points")
+    ("default grade")
+    ("penalty")
+    ("fraction")
+    ("feedback"))
+  "Key=value options for moodle macros and environments.")
+
+(defun LaTeX-moodle-question-env-with-args (env)
+  "Insert ENV provided by moodle.sty incl. arguments and first \\item."
+  (LaTeX-insert-environment
+   env
+   (let ((opts (TeX-read-key-val
+               t
+               (cond (;; 3.3.1 Multiple Choice
+                      (string= env "multi")
+                      (append '(("shuffle"   ("true" "false"))
+                                ("numbering" ("alph" "Alph" "arabic"
+                                              "roman" "Roman" "none"))
+                                ("single"    ("true" "false"))
+                                ("multiple"  ("true" "false")))
+                              (when (string= "cloze" 
(LaTeX-current-environment))
+                                '(("vertical" ("true" "false"))
+                                  ("horizonal" ("true" "false"))))
+                              LaTeX-moodle-key-val-options))
+                     ;; 3.3.3 Short Answer
+                     ((string= env "shortanswer")
+                      (append '(("case sensitive" ("true" "false"))
+                                ("usecase"        ("true" "false")))
+                              (when (string= "cloze" 
(LaTeX-current-environment))
+                                '(("vertical" ("true" "false"))
+                                  ("horizonal" ("true" "false"))))
+                              LaTeX-moodle-key-val-options))
+                     ;; 3.3.4 Essay Questions
+                     ((string= env "essay")
+                      (append '(("response required" ("true" "false"))
+                                ("response format"   ("html" "file"
+                                                      "html+file"
+                                                      "text" "monospaced"))
+                                ("response field lines")
+                                ("attachments allowed"  ("0" "1" "2" "3"
+                                                         "unlimited"))
+                                ("attachments required" ("0" "1" "2" "3"))
+                                ("response template"))
+                              (when (string= "cloze" 
(LaTeX-current-environment))
+                                '(("vertical" ("true" "false"))
+                                  ("horizonal" ("true" "false"))))
+                              LaTeX-moodle-key-val-options))
+                     ;; 3.4 Matching Questions
+                     ((string= env "matching")
+                      (append '(("shuffle"       ("true" "false"))
+                                ("drag and drop" ("true" "false"))
+                                ("dd"            ("true" "false")))
+                              LaTeX-moodle-key-val-options))
+                     (t (append
+                         (when (string= "cloze" (LaTeX-current-environment))
+                           '(("vertical" ("true" "false"))
+                             ("horizonal" ("true" "false"))))
+                         LaTeX-moodle-key-val-options)))))
+        (qname (unless (string= "cloze" (LaTeX-current-environment))
+                 (TeX-read-string (TeX-argument-prompt nil nil "Question 
name")))))
+     (concat
+      (when (and opts (not (string= opts "")))
+       (format "[%s]" opts))
+      (when (and qname (not (string= qname "")))
+       (format "{%s}" qname)))))
+  (if (TeX-active-mark)
+      (progn
+       (LaTeX-find-matching-begin)
+       (end-of-line 1))
+    (end-of-line 0))
+  (delete-char 1)
+  (when (looking-at (concat "^[ \t]+$\\|"
+                           "^[ \t]*" TeX-comment-start-regexp "+[ \t]*$"))
+    (delete-region (point) (line-end-position)))
+  (delete-horizontal-space)
+  ;; Deactivate the mark here in order to prevent `TeX-parse-macro'
+  ;; from swapping point and mark and the \item ending up right after
+  ;; \begin{...}.
+  (TeX-deactivate-mark)
+  ;; Query and insert the question text.
+  (let ((qtext (TeX-read-string (TeX-argument-prompt nil nil "Question 
Text"))))
+    (when (and qtext (not (string= qtext "")))
+      (newline)
+      (indent-according-to-mode)
+      (insert qtext)
+      (LaTeX-fill-paragraph)))
+  (LaTeX-insert-item)
+  ;; The inserted \item may have outdented the first line to the
+  ;; right.  Fill it, if appropriate.
+  (when (and (not (looking-at "$"))
+            (not (assoc env LaTeX-indent-environment-list))
+            (> (- (line-end-position) (line-beginning-position))
+               (current-fill-column)))
+    (LaTeX-fill-paragraph nil)))
+
+(defun LaTeX-moodle-item-argument ()
+  "Insert an \\item with optional argument in environments of moodle package."
+  ;; Do not query for an optional argument here, this happens below:
+  (let ((TeX-insert-macro-default-style 'mandatory-args-only))
+    (TeX-insert-macro "item"))
+  ;; Add * to `LaTeX-moodle-key-val-options' in multi environment and
+  ;; query for the key=values:
+  (let ((opts
+        (TeX-read-key-val t (if (string= "multi" (LaTeX-current-environment))
+                                (append '(("*")) LaTeX-moodle-key-val-options)
+                              LaTeX-moodle-key-val-options))))
+    ;; Insert key=values; if * is chosen, drop []:
+    (when (and opts (not (string= opts "")))
+      (delete-horizontal-space)
+      (if (string= opts "*")
+         (insert opts)
+       (insert LaTeX-optop opts LaTeX-optcl))))
+  (just-one-space)
+  ;; Bonus point: Insert the macro \answer in matching environment:
+  (when (string= "matching" (LaTeX-current-environment))
+    (save-excursion
+      (insert TeX-esc "answer")
+      (just-one-space))))
+
+(TeX-add-style-hook
+ "moodle"
+ (lambda ()
+
+   (LaTeX-add-environments
+    ;; 3.2 Quiz and Question Environments
+    '("quiz"
+      (lambda (environment)
+       (LaTeX-insert-environment
+        environment
+        (let ((opts (TeX-read-key-val t LaTeX-moodle-key-val-options))
+              (bank (TeX-read-string (TeX-argument-prompt nil nil "Question 
bank name"))))
+          (concat
+           (when (and opts (not (string= opts "")))
+             (format "[%s]" opts))
+           (format "{%s}" bank))))))
+    ;; 3.5 Cloze Questions
+    '("cloze" "Question bank name"))
+
+   ;; Make other environments available to AUCTeX:
+   (dolist (env '("multi" "numerical" "shortanswer" "essay" "matching"))
+     (LaTeX-add-environments `(,env LaTeX-moodle-question-env-with-args))
+     (add-to-list 'LaTeX-item-list `(,env . LaTeX-moodle-item-argument) t))
+
+   (TeX-add-symbols
+    '("moodleset"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((opts (TeX-read-key-val optional
+                                      (append '(("ppi")) 
LaTeX-moodle-key-val-options))))
+          (format "%s" opts)))))
+
+    ;; 5 Graphics
+    '("ghostscriptcommand" "File name")
+    '("imagemagickcommand" "File name")
+    '("opensslcommand"     "File name"))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("moodleset"          "{")
+                               ("ghostscriptcommand" "{")
+                               ("imagemagickcommand" "{")
+                               ("opensslcommand"     "{"))
+                             'function)
+     (font-latex-add-keywords '(("answer" "")
+                               ;; Cater for a fontified starred \item
+                               ("item"   "*["))
+                             'textual)))
+ LaTeX-dialect)
+
+(defvar LaTeX-moodle-package-options
+  '("draft")
+  "Package options for the moodle package.")
+
+;;; moodle.el ends here
diff --git a/style/expl3.el b/style/newzealand.el
similarity index 57%
copy from style/expl3.el
copy to style/newzealand.el
index b686b52..c24a265 100644
--- a/style/expl3.el
+++ b/style/newzealand.el
@@ -1,10 +1,10 @@
-;;; expl3.el --- AUCTeX style for `expl3.sty'
+;;; newzealand.el --- AUCTeX style for the `newzealand' babel option.
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2017 Free Software Foundation, Inc.
 
-;; Author: Tassilo Horn <address@hidden>
+;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
-;; Created: 2015-02-22
+;; Created: 2017-07-02
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -26,23 +26,15 @@
 
 ;;; Commentary:
 
-;; This file adds support for `expl3.sty'.
+;; Set up AUCTeX for editing Newzealand text in connection with the
+;; `newzealand' babel option.
 
 ;;; Code:
 
-(defvar LaTeX-expl3-syntax-table
-  (let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
-    ;; Make _ and : symbol chars
-    (modify-syntax-entry ?\_ "_" st)
-    (modify-syntax-entry ?\: "_" st)
-    st))
-
 (TeX-add-style-hook
- "expl3"
+ "newzealand"
  (lambda ()
-   (set-syntax-table LaTeX-expl3-syntax-table)
-   (when (and (fboundp 'font-latex-update-font-lock)
-             (eq TeX-install-font-lock 'font-latex-setup))
-     ;; Tell font-lock about the update.
-     (font-latex-update-font-lock t)))
+   (TeX-run-style-hooks "english"))
  LaTeX-dialect)
+
+;;; newzealand.el ends here
diff --git a/style/subcaption.el b/style/subcaption.el
index 6c4405a..f158f44 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 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2017 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -143,8 +143,8 @@ caption, insert only a caption."
                    (TeX-argument-prompt nil nil "Type")
                    '("figure" "table"))))
 
-   ;; Everything starting with \subcaption should get its own line
-   (LaTeX-paragraph-commands-add-locally "subcaption")
+   ;; \subcaption(box)? macros should get their own lines
+   (LaTeX-paragraph-commands-add-locally '("subcaption" "subcaptionbox"))
 
    ;; The subfigure & subtable environments
    (LaTeX-add-environments
diff --git a/style/tcolorbox.el b/style/tcolorbox.el
index 77cab08..6805983 100644
--- a/style/tcolorbox.el
+++ b/style/tcolorbox.el
@@ -475,7 +475,7 @@ e.g. \"tcolorboxlib-raster.el\"."
                 "coltitle"))
         (tmp (copy-alist LaTeX-tcolorbox-keyval-options-local)))
     (dolist (key keys)
-      (assq-delete-all (car (assoc key tmp)) tmp)
+      (setq tmp (assq-delete-all (car (assoc key tmp)) tmp))
       (pushnew
        (list key (mapcar #'car (LaTeX-xcolor-definecolor-list))) tmp :test 
#'equal))
     (setq LaTeX-tcolorbox-keyval-options-local (copy-alist tmp)))
diff --git a/style/textcomp.el b/style/textcomp.el
index 8a6df9b..3f0feb0 100644
--- a/style/textcomp.el
+++ b/style/textcomp.el
@@ -1,6 +1,6 @@
 ;;; textcomp.el --- AUCTeX style for `textcomp.sty' (v1.99g)
 
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2017 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <address@hidden>
 ;; Maintainer: address@hidden
@@ -161,14 +161,7 @@
     '("textdiv"                  0)     ; Type: Symbol -- Slot: 246
     '("textcircled"              1)     ; Type: Command -- Slot: N/A
     '("capitalcedilla"           1)     ; Type: Command -- Slot: N/A
-    '("capitalogonek"            1)     ; Type: Command -- Slot: N/A
-    '("oldstylenums" "Numbers"    ))    ; Type: Command -- Slot: N/A
-
-   ;; Fontification
-   (when (and (featurep 'font-latex)
-              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("oldstylenums"  "{"))
-                              'type-command)))
+    '("capitalogonek"            1)))   ; Type: Command -- Slot: N/A
  LaTeX-dialect)
 
 (defvar LaTeX-textcomp-package-options
diff --git a/tests/context/context-indentation-in.tex 
b/tests/context/context-indentation-in.tex
new file mode 100644
index 0000000..c1c3aed
--- /dev/null
+++ b/tests/context/context-indentation-in.tex
@@ -0,0 +1,24 @@
+\setuphead
+[section]
+[before={\blank[big]},
+after={\blank[medium]}]
+
+\setuphead
+[subsection]
+  [
+before={\blank[big]},
+after={\blank[medium]},
+]
+
+\starttext
+
+  \startitemize[a]
+  \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+tempor incididunt ut labore et dolore magna aliqua.
+  \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris 
nisi ut
+  aliquip ex ea commodo consequat.
+  \item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
+    dolore eu fugiat nulla pariatur.
+  \stopitemize
+
+\stoptext
diff --git a/tests/context/context-indentation-out.tex 
b/tests/context/context-indentation-out.tex
new file mode 100644
index 0000000..e963574
--- /dev/null
+++ b/tests/context/context-indentation-out.tex
@@ -0,0 +1,24 @@
+\setuphead
+  [section]
+  [before={\blank[big]},
+    after={\blank[medium]}]
+
+\setuphead
+  [subsection]
+  [
+    before={\blank[big]},
+    after={\blank[medium]},
+  ]
+
+\starttext
+
+\startitemize[a]
+\item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+  tempor incididunt ut labore et dolore magna aliqua.
+\item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi 
ut
+  aliquip ex ea commodo consequat.
+\item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
+  dolore eu fugiat nulla pariatur.
+\stopitemize
+
+\stoptext
diff --git a/tests/context/context-test.el b/tests/context/context-test.el
new file mode 100644
index 0000000..05647e4
--- /dev/null
+++ b/tests/context/context-test.el
@@ -0,0 +1,56 @@
+;;; context-test.el --- tests for ConTeXt mode
+
+;; Copyright (C) 2017 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 'context)
+
+(defun AUCTeX-set-ert-path (&rest sym-val)
+  "Set first element of SYM-VAL to the next one, and so on.
+
+The value is the path to the test file, make sure it is expanded
+in the right directory even when the ERT test from the command
+line and from another directory."
+  (while sym-val
+    (set (pop sym-val)
+        (expand-file-name (pop sym-val)
+                          (when load-file-name
+                            (file-name-directory load-file-name))))))
+
+(AUCTeX-set-ert-path
+ 'ConTeXt-indent-test/in
+ "context-indentation-in.tex"
+ 'ConTeXt-indent-test/out
+ "context-indentation-out.tex")
+
+(ert-deftest ConTeXt-indent ()
+  (should (string=
+           (with-temp-buffer
+             (insert-file-contents ConTeXt-indent-test/in)
+             (ConTeXt-mode)
+             (indent-region (point-min) (point-max))
+             (buffer-string))
+           (with-temp-buffer
+             (insert-file-contents ConTeXt-indent-test/out)
+             (buffer-string)))))
+
+;;; context-test.el ends here
diff --git a/tests/japanese/error-parsing.el b/tests/japanese/error-parsing.el
new file mode 100644
index 0000000..c2f8f90
--- /dev/null
+++ b/tests/japanese/error-parsing.el
@@ -0,0 +1,64 @@
+;;; error-parsing.el --- tests for error parsing
+
+;; Copyright (C) 2017 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 'tex-buf)
+(setq japanese-TeX-error-messages t)
+(require 'tex-jp)
+
+(ert-deftest japanese-TeX-help-message ()
+  "Test the fallback behavior of `TeX-help-error'.
+It should pick up error messages from the log file even if
+tex-jp.el modified `TeX-error-description-list'."
+  (should (let* ((dummyfile (make-temp-file "japanese-TeX-ert"))
+                (logfile (concat dummyfile ".log")))
+           (find-file logfile)
+           (insert "\
+./errorsamp.tex:3: EROOR NEVER COVERED BY TeX-error-description-list.
+l.3 }
+     
+FOO BAR
+HOGE FUGA
+")
+           (save-buffer 0)
+           (find-file dummyfile)
+           ;; Actually, the contents of dummyfile is irrelavent to
+           ;; this test.  It is only used to make the log file name
+           ;; which is analysed in `TeX-help-error' to be
+           ;; predictable.
+           (let ((TeX-command-buffer (current-buffer)))
+             (TeX-help-error
+              "EROOR NEVER COVERED BY TeX-error-description-list."
+              "" (current-buffer) 'error))
+           (delete-other-windows)
+           (kill-buffer (get-file-buffer logfile))
+           (delete-file logfile)
+           (kill-buffer (get-file-buffer dummyfile))
+           (delete-file dummyfile)
+           (set-buffer "*TeX Help*")
+           (goto-char (point-min))
+           (prog1
+               (search-forward "From the .log file...")
+             (kill-buffer)))))
+
+;;; error-parsing.el ends here
diff --git a/tests/japanese/preview-error-test.tex 
b/tests/japanese/preview-error-test.tex
new file mode 100644
index 0000000..4ae90cd
--- /dev/null
+++ b/tests/japanese/preview-error-test.tex
@@ -0,0 +1,42 @@
+% Please check that all preview images in this buffer come out at the
+% correct position.  I.e., preview images should hide each \section
+% command.
+% When done, type C-M-c or M-x exit-recursive-edit.
+%
+% If the image is at the beginning of the line and "\section{xxx}" is
+% placed far rightward of the image, then the result should be considered
+% as fail.
+% In addition, if the image covers "\section{xxx}" only partially, the
+% result should be considered as fail, too.
+% On the contrary, if the text shown in the image is garbled while the
+% position of the image is correct, then the result should be considered as
+% OK.  That means that your ghostscript is not configured to handle
+% Japanese postscript font names correctly and the functionality of
+% preview-latex is just fine.
+\documentclass{jarticle}
+
+\begin{document}
+
+\section{�\(1)}
+
+\section{�\{a}}
+
+\section{\(�\\|\)}
+
+\section{�A�[�X}
+
+\section{�^}
+
+% The comment "%�\" will be displayed rightward to the image on the next
+% line.  That is a normal outcome and should be considered as OK.
+\section{��} %�\
+
+\end{document}
+
+%%% Local Variables:
+%%% coding: shift_jis
+%%% mode: japanese-latex
+%%% TeX-master: t
+%%% TeX-engine: ptex
+%%% TeX-PDF-mode: nil
+%%% End:
diff --git a/tests/japanese/preview-error-test2.tex 
b/tests/japanese/preview-error-test2.tex
new file mode 100644
index 0000000..3acdf7b
--- /dev/null
+++ b/tests/japanese/preview-error-test2.tex
@@ -0,0 +1,20 @@
+% Please check that the preview image in this buffer comes out at the
+% correct position.  I.e., preview images should hide the equation.
+% When done, type C-M-c or M-x exit-recursive-edit.
+%
+% If the image is at the beginning of the line and does not cover the
+% equation, then the result should be considered as fail.
+\documentclass{jarticle}
+
+\begin{document}
+preview-latex �� \(a^{2}=b^{2}+c^{2}\) �Τ褦�ʿ������ܸ� LaTeX �Ǥ�
+preview ��������
+\end{document}
+
+%%% Local Variables:
+%%% coding: euc-jp
+%%% mode: japanese-latex
+%%% TeX-master: t
+%%% TeX-engine: ptex
+%%% TeX-PDF-mode: nil
+%%% End:
diff --git a/tests/japanese/preview-latex.el b/tests/japanese/preview-latex.el
new file mode 100644
index 0000000..4fac047
--- /dev/null
+++ b/tests/japanese/preview-latex.el
@@ -0,0 +1,302 @@
+;;; preview-latex.el --- tests for preview-latex compatibility
+
+;; Copyright (C) 2017 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)
+(let ((japanese-TeX-error-messages nil))
+  (require 'tex-jp))
+(require 'preview)
+
+(defun AUCTeX-set-ert-path (&rest sym-val)
+  "Set first element of SYM-VAL to the next one, and so on.
+
+The value is the path to the test file, make sure it is expanded
+in the right directory even when the ERT test from the command
+line and from another directory."
+  (while sym-val
+    (set (pop sym-val)
+        (expand-file-name (pop sym-val)
+                          (when load-file-name
+                            (file-name-directory load-file-name))))))
+
+(AUCTeX-set-ert-path
+ 'platex-shift-jis
+ "preview-error-test.tex"
+ 'preserve-kanji-option
+ "preview-error-test2.tex"
+ 'different-coding-system
+ "prv-dif-code.tex"
+)
+
+;; Make sure coding system output from tex process to be expected
+;; value.
+(setq japanese-TeX-use-kanji-opt-flag t) ; assume unix or darwin.
+
+(setq TeX-process-asynchronous t)
+(setq TeX-after-start-process-function #'TeX-adjust-process-coding-system)
+
+(ert-deftest japanese-preview-shift-jis ()
+  "Coding system `shift_jis' is harmless to preview-latex or not.
+The second byte in `shift_jis' encoding which coincides with a regexp meta
+character used to cause trouble.  Such patterns are tested."
+  ;; The test is meaningful only in interactive session.  Skip in
+  ;; batch mode.
+  (skip-unless (not noninteractive))
+  (let ((TeX-clean-confirm nil)
+       (preview-auto-cache-preamble nil)
+       (process-environment process-environment)
+       (locale-coding-system 'shift_jis)
+       (TeX-japanese-process-output-coding-system nil)
+       (TeX-japanese-process-input-coding-system nil))
+    ;; Make platex binary to output in `shift_jis' encoding.
+    (setenv "LC_ALL" "ja_JP.SJIS")
+    ;; If your startup script for `TeX-shell' (normally "/bin/sh")
+    ;; overwrites LC_ALL, you cannot trust the result of this test.
+    ;; I.e., the positive result can be reported as negative, and the
+    ;; negative can be as positive.
+    (unwind-protect
+       (save-window-excursion
+         (find-file platex-shift-jis)
+         (delete-other-windows)
+         (preview-document)
+         (message "Please wait for asynchronous process to finish...")
+         (sleep-for 5)
+         ;; Actually, this type of trouble seems to be captured early by
+         ;; ert mechanism as error and not to reach here.
+         (should-not (string-match "error in process sentinel:"
+                                   (current-message)))
+         (message "Please wait for asynchronous process to finish...done")
+         (message "Type %s when checking is done."
+                  (substitute-command-keys "\\[exit-recursive-edit]"))
+         (recursive-edit)
+         (should (yes-or-no-p "\
+Did all images come out at the correct position? ")))
+      ;; Cleanup.
+      (set-buffer (get-file-buffer platex-shift-jis))
+      (let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
+            (process (get-buffer-process buffer)))
+       (if process (delete-process process))
+       (kill-buffer buffer))
+      (preview-clearout-document)
+      (TeX-clean t)
+      (dolist (dir preview-temp-dirs)
+       (if (file-exists-p (directory-file-name dir))
+           (delete-directory dir t)))
+      (kill-buffer))))
+
+(ert-deftest japanese-preview-different-coding-system ()
+  "Different coding systems between file and process are OK or not.
+Japanese TeX by itself converts encoding of Japanese text, so sometimes
+`buffer-file-coding-system' and the coding system of the output from
+the process differ."
+  ;; The test is meaningful only in interactive session.  Skip in
+  ;; batch mode.
+  (skip-unless (not noninteractive))
+  (let ((TeX-clean-confirm nil)
+       (preview-auto-cache-preamble nil)
+       (process-environment process-environment)
+       (locale-coding-system 'shift_jis)
+       (TeX-japanese-process-output-coding-system nil)
+       (TeX-japanese-process-input-coding-system nil))
+    ;; Make platex binary to output in `shift_jis' encoding.
+    (setenv "LC_ALL" "ja_JP.SJIS")
+    ;; If your startup script for `TeX-shell' (normally "/bin/sh")
+    ;; overwrites LC_ALL, you cannot trust the result of this test.
+    ;; I.e., the positive result can be reported as negative, and the
+    ;; negative can be as positive.
+    (unwind-protect
+       (save-window-excursion
+         (find-file different-coding-system)
+         (delete-other-windows)
+         (preview-document)
+         (message "Please wait for asynchronous process to finish...")
+         (sleep-for 5)
+         ;; Actually, this type of trouble seems to be captured early by
+         ;; ert mechanism as error and not to reach here.
+         (should-not (string-match "error in process sentinel:"
+                                   (current-message)))
+         (message "Please wait for asynchronous process to finish...done")
+         (message "Type %s when checking is done."
+                  (substitute-command-keys "\\[exit-recursive-edit]"))
+         (recursive-edit)
+         (should (yes-or-no-p "\
+Did all images come out at the correct position? ")))
+      ;; Cleanup.
+      (set-buffer (get-file-buffer different-coding-system))
+      (let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
+            (process (get-buffer-process buffer)))
+       (if process (delete-process process))
+       (kill-buffer buffer))
+      (preview-clearout-document)
+      (TeX-clean t)
+      (dolist (dir preview-temp-dirs)
+       (if (file-exists-p (directory-file-name dir))
+           (delete-directory dir t)))
+      (kill-buffer))))
+
+(ert-deftest japanese-preview-preserve-kanji-option ()
+  "`TeX-inline-preview-internal' preserves kanji option or not.
+Internal Japanese encoding of `platex' is utf-8 by default in TeXLive of
+unix flavors.  So the document encoded in `euc-jp' is not processed
+correctly without kanji option, which used to be dropped during the
+command substitutions performed within preview-latex when preamble cache
+is enabled."
+  ;; The test is meaningful only in interactive session.  Skip in
+  ;; batch mode.
+  (skip-unless (not noninteractive))
+  (let ((TeX-clean-confirm nil)
+       (preview-auto-cache-preamble t)
+       (TeX-japanese-process-output-coding-system nil)
+       (TeX-japanese-process-input-coding-system nil))
+    (unwind-protect
+       (save-window-excursion
+         (find-file preserve-kanji-option)
+         (delete-other-windows)
+         (preview-document)
+         (message "Please wait for asynchronous process to finish...")
+         (sleep-for 3)
+         (message "Please wait for asynchronous process to finish...done")
+         (message "Type %s when checking is done."
+                  (substitute-command-keys "\\[exit-recursive-edit]"))
+         (recursive-edit)
+         (should (yes-or-no-p "\
+Did the image come out at the correct position? ")))
+      ;; Cleanup.
+      (set-buffer (get-file-buffer preserve-kanji-option))
+      (let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
+            (process (get-buffer-process buffer)))
+       (if process (delete-process process))
+       (kill-buffer buffer))
+      (preview-clearout-document)
+      (TeX-clean t)
+      (dolist (dir preview-temp-dirs)
+       (if (file-exists-p (directory-file-name dir))
+           (delete-directory dir t)))
+      (kill-buffer))))
+
+;; The following tests the individual parts fixed in May 2017 and can be
+;; automated with batch mode.  Note that these tests just check specific
+;; parts of preview-latex and do not gurarantee that final outcome of
+;; the preview images are fine in total even if all these tests pass.
+
+(ert-deftest japanese-preview-error-quote-shift-jis ()
+  "`preview-error-quote' is robust against `shift_jis' or not.
+String encoded in `shift_jis' can have regexp meta characters in it."
+  (let (case-fold-search
+       (buffer-file-coding-system 'shift_jis)
+       (TeX-japanese-process-output-coding-system nil))
+    (dolist (str '("$BI=(B(1)" "$BM=(B{a}" "$BG=(B\|" "{$B$"(B} 
%$BG=(B" "$B%"!<%9(B" "$B7?(B"))
+      (should (string-match (preview-error-quote str 'shift_jis) str)))))
+
+(ert-deftest japanese-preview-decode-^^ab ()
+  "`preview--decode-^^ab' doesn't leave regexp meta characters in results."
+  (let (case-fold-search)
+    ;; "$B$"(B" is encoded as \x82 \xa0 in SJIS.
+    (should (string= (preview--decode-^^ab "^^82^^a0" 'shift_jis) "$B$"(B"))
+    ;; "$BI=(B" is encoded as \x95 '\' in SJIS.
+    (should (string= (preview--decode-^^ab "^^95\\" 'shift_jis) "$BI=(B"))
+    ;; "$B!<(B" is encoded as \x81 '[' in SJIS.
+    (should (string= (preview--decode-^^ab "^^81[^^Ab" 'shift_jis) 
"$B!<(B^^Ab"))
+    ;; "$B7?(B" is encoded as \x8c '^' in SJIS.
+    (should (string= (preview--decode-^^ab "$B7?(B^ab" 'shift_jis) 
"$B7?(B^ab"))))
+
+(ert-deftest japanese-preview-convert-^^ab ()
+  "`preview--convert-^^ab' converts ^^ab to raw 8bits and leaves ^^Ab."
+  (let (case-fold-search)
+    (should (string= (preview--convert-^^ab "^^80") "\x80"))
+    (should (string= (preview--convert-^^ab "^^80^^f0") "\x80\xf0"))
+    (should (string= (preview--convert-^^ab "^^^a0") "^\xa0"))
+    (should (string= (preview--convert-^^ab "^^c0^^Ab") "\xc0^^Ab"))))
+
+(ert-deftest japanese-preview-process-coding-system ()
+  "`TeX-inline-preview-internal' records process coding system or not.
+It used to discard the coding system for decode without recording
+previously set by `japanese-TeX-set-process-coding-system'."
+  (let ((dummyfile (make-temp-file "japanese-TeX-ert"))
+       (file-cs 'japanese-shift-jis-unix)
+       (locale-cs 'japanese-iso-8bit-unix)
+       ;; Make `preview-call-hook' inactive.
+       (preview-image-creators nil)
+       process)
+    (find-file dummyfile)
+    ;; Make `japanese-TeX-set-process-coding-system' to be called in
+    ;; `TeX-adjust-process-coding-system'.
+    (setq japanese-TeX-mode t)
+    (setq buffer-file-coding-system file-cs)
+    (unwind-protect
+       (progn
+         (setq process (TeX-inline-preview-internal
+                        "echo foo" dummyfile '(nil . nil) (current-buffer)
+                        '(nil . nil) dummyfile '(nil nil nil)))
+         ;; coding system assigned by `TeX-run-command' should be saved in
+         ;; `preview-coding-system'.
+         (should (coding-system-equal locale-cs preview-coding-system))
+         ;; actual process coding system should be the one derived from the
+         ;; original coding system via `preview-buffer-recode-system'.
+         (should (coding-system-equal
+                  (car (process-coding-system process))
+                  (preview-buffer-recode-system locale-cs)))))
+    ;; Cleanup.
+    ;; Let process to exit before finishing test.
+    (accept-process-output process)
+    (set-buffer (get-file-buffer dummyfile))
+    (let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
+          (process (get-buffer-process buffer)))
+      (if process (delete-process process))
+      (kill-buffer buffer))
+    (kill-buffer)
+    (delete-file dummyfile)))
+
+(ert-deftest japanese-preview-preserve-kanji-option2 ()
+  "`TeX-inline-preview-internal' preserve kanji option or not."
+  (let ((TeX-clean-confirm nil)
+       ;; Make `preview-call-hook' inactive.
+       (preview-image-creators nil)
+       dummy process)
+    (unwind-protect
+       (save-window-excursion
+         (find-file preserve-kanji-option)
+         (setq dummyfile (TeX-master-file))
+         (delete-other-windows)
+         (setq process (TeX-inline-preview-internal
+                        "platex" dummyfile '(nil . nil) (current-buffer)
+                        '(nil . (t . t)) dummyfile '(nil nil nil)))
+         (let ((cmd (process-command process)))
+           (should (string-match "-kanji" (nth (1- (length cmd)) cmd)))))
+      ;; Cleanup.
+      (accept-process-output process)
+      (set-buffer (get-file-buffer preserve-kanji-option))
+      (let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
+            (process (get-buffer-process buffer)))
+       (if process (delete-process process))
+       (kill-buffer buffer))
+      (TeX-clean t)
+      (dolist (dir preview-temp-dirs)
+       (if (file-exists-p (directory-file-name dir))
+           (delete-directory dir t)))
+      (kill-buffer))))
+
+;;; preview-latex.el ends here
+
+;; Local Variables:
+;; coding: iso-2022-jp
+;; End:
diff --git a/tests/japanese/prv-dif-code.tex b/tests/japanese/prv-dif-code.tex
new file mode 100644
index 0000000..f8d1c82
--- /dev/null
+++ b/tests/japanese/prv-dif-code.tex
@@ -0,0 +1,42 @@
+% Please check that all preview images in this buffer come out at the
+% correct position.  I.e., preview images should hide each \section
+% command.
+% When done, type C-M-c or M-x exit-recursive-edit.
+%
+% If the image is at the beginning of the line and "\section{xxx}" is
+% placed far rightward of the image, then the result should be considered
+% as fail.
+% In addition, if the image covers "\section{xxx}" only partially, the
+% result should be considered as fail, too.
+% On the contrary, if the text shown in the image is garbled while the
+% position of the image is correct, then the result should be considered as
+% OK.  That means that your ghostscript is not configured to handle
+% Japanese postscript font names correctly and the functionality of
+% preview-latex is just fine.
+\documentclass{jarticle}
+
+\begin{document}
+
+\section{$BI=(B(1)}
+
+\section{$BM=(B{a}}
+
+\section{\($BG=(B\|\)}
+
+\section{$B%"!<%9(B}
+
+\section{$B7?(B}
+
+% The comment "%$BG=(B" will be displayed rightward to the image on the next
+% line.  That is a normal outcome and should be considered as OK.
+\section{$B$"(B} %$BG=(B
+
+\end{document}
+
+%%% Local Variables:
+%%% coding: iso-2022-jp
+%%% mode: japanese-latex
+%%% TeX-master: t
+%%% TeX-engine: ptex
+%%% TeX-PDF-mode: nil
+%%% End:
diff --git a/tests/latex/fontification-general.tex 
b/tests/latex/fontification-general.tex
new file mode 100644
index 0000000..4866e4f
--- /dev/null
+++ b/tests/latex/fontification-general.tex
@@ -0,0 +1,358 @@
+\documentclass[a4paper]{article}
+
+\usepackage{expl3}
+\usepackage[overload]{empheq}
+\usepackage{breqn}
+
+\begin{document}
+
+This is a test document for general fontification support of macros
+and environments provided by \LaTeX{} and other packages within
+AUC\TeX.  As it is not part of \verb|ert|-tests, it does not have an
+\verb|out|-counterpart.
+
+\part{Macros}
+
+\section{Special characters}
+
+\subsection{Standard reserved characters}
+
+\subsubsection{\protect\LaTeX{} input}
+
+The following symbols are reserved characters that have a special
+meaning under \LaTeX{}.
+\begin{center}
+  address@hidden
+    \hline
+    \verb|#|   & \verb|$| & \verb|%| & \verb|^|
+    & \verb|&| & \verb|_| & \verb|{| & \verb|}| \\
+    \verb|~|   & \verb|`| & \verb|'| & \verb|=|
+    & \verb|.| \\
+    \hline
+  \end{tabular}\\
+\end{center}
+In a document, characters in the first line are printed by using a
+prefix \verb|\| (backslash).  The characters in the second line become
+control symbols taking an argument when prefixed with a backslash.
+
+\subsubsection{AUC\protect\TeX{} fontification}
+
+AUC\TeX{} has the following strategy for fontification:
+\begin{description}
+\item[Control symbols without argument] do not get any fontification
+  as they only print a special character and have a textual context,
+  e.g. \$10, 5\%, Mr.\&Mrs.  They are listed below:
+  \begin{center}
+    address@hidden@{}}
+      \hline
+      \#   & \verb|\#| & \$ & \verb|\$|
+      & \% & \verb|\%| & \& & \verb|\&| \\
+      \_   & \verb|\_| & \{ & \verb|\{|
+      & \} & \verb|\}|                  \\
+      \hline
+    \end{tabular}
+\end{center}
+\item[Control symbols with argument] do not receive any fontification.
+  These macros take a mandatory argument, but they have a textual
+  context.  Since the argument is usually not enclosed in braces,
+  fontification would be rather distracting:
+  \begin{center}
+    address@hidden@{}}
+      \hline
+      \`o   & \verb|\`o| & \'o & \verb|\'o|
+      & \^o & \verb|\^o| & \~o & \verb|\~o|  \\
+      \=o   & \verb|\=o| & \.o & \verb|\.o|
+      & \"o & \verb|\"o|                     \\
+      \hline
+    \end{tabular} \\[1ex]
+    \begin{minipage}{0.4\linewidth}\centering
+      H\^{o}tel, na\"\i ve, \'{e}l\`{e}ve,\\
+      sm\o rrebr\o d, !`Se\~{n}orita!
+    \end{minipage}\quad
+    \begin{minipage}{0.4\linewidth}\centering
+      H\^otel, na\"\i ve, \'el\`eve,\\
+      sm\o rrebr\o d, !`Se\~norita!
+    \end{minipage}
+  \end{center}
+\item[Control words] receive fontification, e.g.
+  \begin{center}
+    address@hidden@{}}
+      \hline
+      \u o    & \verb|\u o| & \v o & \verb|\v o|
+      & \H o  & \verb|\H o| & \c o & \verb|\c o| \\
+      \d o    & \verb|\d o| & \b o & \verb|\b o|
+      & \t oo & \verb|\t oo|                     \\[6pt]
+      \oe     & \verb|\oe|  & \OE  & \verb|\OE|
+      & \ae   & \verb|\ae|  & \AE  & \verb|\AE|  \\
+      \aa     & \verb|\aa|  & \AA  & \verb|\AA|
+      & \c c  & \verb|\c c|                      \\[6pt]
+      \o      & \verb|\o|   & \O   & \verb|\O|
+      & \l    & \verb|\l|   & \L   & \verb|\L|   \\
+      \i      & \verb|\i|   & \j   & \verb|\J|
+      & \ss   & \verb|\ss|                       \\
+      \hline
+    \end{tabular}\\[1ex]
+  \end{center}
+\end{description}
+
+\subsection{@ character}
+
+\subsubsection{\protect\LaTeX{} input}
+
+In regular text, \verb|@| is not a special character and can be used
+as address@hidden'.  Further, \verb|\@| can be used to force a wide space
+after an uppercase character, e.g. address@hidden
+
+On the other hand, \verb|@| is used as ``letter'' for defining internal
+macros, e.g. \verb|address@hidden|.
+
+\subsubsection{AUC\protect\TeX{} fontification}
+
+Being a non-textual macro, \verb|\@| receives a fontification in
+AUC\TeX.  Used as letter as part of a macro, it gets the fontification
+as the rest. Example \bgroup\ttfamily address@hidden
+
+\subsection{\_ and : characters}
+
+\subsubsection{\protect\LaTeX{} input}
+
+For \LaTeXe, the behavior of \verb|_| and \verb|\_| was described
+above.  \verb|:| is not special for regular text.  \verb|\:| is a
+spacing macro ($\frac{4}{18}$ quad) within math mode.
+
+\LaTeX3 does not use \verb|@| as ``letter'' for defining internal
+macros.  Instead, the symbols \verb|_| and \verb|:| are used in
+internal macro names to provide structure.  These extra letters are
+used only between parts of a macro name (no strange vowel
+replacement)\cite{expl3}.
+
+\subsubsection{AUC\protect\TeX{} fontification}
+
+\verb|\:| is only allowed in math mode; fontification is done there,
+e.g. $a\:\:+b$ or
+\begin{equation}
+  \int_1^2 \ln x \mathrm{d}x
+  \qquad
+  \int_1^2 \ln x \:\:\:\mathrm{d}x
+\end{equation}
+
+Regarding \LaTeX3, \verb|expl3| says:
+\begin{quote}
+  3.2.1 Separating private and public material \\
+  Functions created by a module may either be ``public'' (documented
+  with a defined interface) or ``private'' (to be used only within
+  that module, and thus not formally documented).  It is important
+  that only documented interfaces are used; [...] \\
+  To allow clear separation of these two cases, the following
+  convention is used. Private functions should be defined with
+  \verb|__| added to the beginning of the module name. Thus
+  \begin{quote}
+    \ttfamily \catcode`\_11\relax
+    \string\module_foo:nnn
+  \end{quote}
+  is a public function which should be documented while
+  \begin{quote}
+    \ttfamily \catcode`\_11\relax
+    \string\__module_foo:nnn
+  \end{quote}
+  is private to the module, and should not be used outside of that
+  module.
+\end{quote}
+%
+Hopefully, this means that \verb|\__module_foo:nnn| macros will not be
+used somewhere in the preamble of a \verb|.tex| file -- they should
+appear only in a \verb|.dtx| file.
+
+AUC\TeX{} provides a style file \verb|expl3.el| containing this code:
+\begin{verbatim}
+(defvar LaTeX-expl3-syntax-table
+  (let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
+    ;; Make _ and : symbol chars
+    (modify-syntax-entry ?\_ "_" st)
+    (modify-syntax-entry ?\: "_" st)
+    st))
+\end{verbatim}
+It changes the syntax for \verb|_| and \verb|:| from
+\textsl{punctuation} to \textsl{symbol}.  For public functions
+mentioned above, this results in correct fontification in regular
+\verb|.tex| files.  For private functions, \verb|font-latex.el|
+provides some code for doc\TeX{} mode to fontify them correctly.
+
+\section{Math mode}
+
+\subsection{\protect\LaTeX{} input}
+
+In-line math is typeset with plain \TeX{}
+\verb|$|\,\textsl{formula\_text}\,\verb|$| or \LaTeX{} shorthand
+\verb|\(|\,\textsl{formula\_text}\,\verb|\)|, e.g. $(a+b)^2$ is equal
+to \(a^2+2ab+b^2\).
+
+\subsection{AUC\protect\TeX{} fontification}
+
+AUC\TeX{} fontifies math with \texttt{font-latex-math-face}.  There is
+a bug report \#26630 for this issue: {\bfseries Text before, $(a+b)^2$
+  is equal to \(a^2+2ab+b^2\)!}  First math expression is fontified
+with
+\begin{quote}
+\verb|(font-latex-math-face font-latex-bold-face)|
+\end{quote}
+while the second with
+\begin{quote}
+\verb|(font-latex-bold-face font-latex-math-face)|
+\end{quote}
+
+\part{Environments}
+
+\section{Math mode}
+
+\subsection{\protect\LaTeX{} input}
+
+Standard \LaTeX{} math environments are \verb|equation|,
+\verb|displaymath| and others.  \verb|amsmath| package provides
+environments like \verb|align|, \verb|flalign| etc.  These
+environments do not take any arguments.  Environments like
+\verb|alignat|, \verb|xalignat| and \verb|xxalignat| take a mandatory
+argument.  Other math environments provided by packages like
+\verb|empheq.sty| or \verb|breqn.sty| take an optional and/or
+mandatory argument.
+
+\subsection{AUC\protect\TeX{} fontification}
+
+AUC\TeX{} fontifies the entire math content with
+\texttt{font-latex-math-face}.  The optional and mandatory argument(s)
+should not be fontified.  Spaces or line breaks are used in order to
+distinguish argument from math content, i.e.
+\begin{quote}
+\verb|\begin{<mathenv>}[<opt-arg>]{<mand-arg>}|
+\end{quote}
+will be fontified differently than
+\begin{quote}
+\verb|\begin{<mathenv>}[<opt-arg>] {<math-content>}|
+\end{quote}
+or
+\begin{quote}
+\verb|\begin{<mathenv>} [<math-content>]{<math-content>}|
+\end{quote}
+
+The relevant functions is \verb|font-latex.el| are
+\begin{quote}
+\verb|font-latex-match-math-envII|\quad and \\
+\verb|font-latex-extend-region-backwards-math-envII|
+\end{quote}
+
+\subsubsection{Standard \protect\LaTeX{}}
+
+Examples taken from \cite{voss16}.
+\begin{equation}
+f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)
+\end{equation}
+or
+\begin{displaymath}
+f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)
+\end{displaymath}
+or
+\[ f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right) \]
+or
+\begin{eqnarray*}
+  y & = & d\\
+  y & = & cx+d\\
+  y & = & bx^{2}+cx+d\\
+  y & = & ax^{3}+bx^{2}+cx+d
+\end{eqnarray*}
+
+\subsubsection{\texttt{amsmath} package}
+
+Examples taken from \cite{voss16}.
+\begin{align}
+  y &= d & z &= 1 \\
+  y &= cx+d & z &= x+1 \\
+  y_{12} &= bx^{2}+cx+d & z &= x^{2}+x+1\nonumber \\
+  y(x) &= ax^{3}+bx^{2}+cx+d & z &= x^{3}+x^{2}+x+1
+\end{align}
+or
+\begin{alignat}{2}
+  y &= d & z &= 1 \\
+  y &= cx+d & z & =x+1 \\
+  y_{12} &= bx^{2}+cx+d & z &= x^{2}+x+1\nonumber \\
+  y(x) &= ax^{3}+bx^{2}+cx+d & z &= x^{3}+x^{2}+x+1
+\end{alignat}
+
+\subsubsection{\texttt{breqn} package}
+
+Examples taken from \cite{breqn}:
+\begin{dmath}
+  f(x)=\frac{1}{x} \condition{for $x\neq 0$}
+\end{dmath}
+or
+\begin{dmath}[label={sna74}]
+  \frac{1}{6} \left(\sigma(k,h,0) +\frac{3(h-1)}{h}\right)
+  +\frac{1}{6} \left(\sigma(h,k,0) +\frac{3(k-1)}{k}\right)
+  =\frac{1}{6} \left(\frac{h}{k} +\frac{k}{h} +\frac{1}{hk}\right)
+  +\frac{1}{2} -\frac{1}{2h} -\frac{1}{2k},
+\end{dmath}
+or \newcommand\mx[1]{\begin{math}#1\end{math}}%
+\begin{dseries}[frame]
+  \mx{v^{[2]} =(0,5,5,0,9,5,1,0)},
+  \mx{v^{[3]} =(0,9,11,9,10,12,0,1)}.
+\end{dseries}
+
+\begin{dgroup*}
+  \begin{dmath*}
+    H_1^3 = x_1 + x_2 + x_3
+  \end{dmath*},
+  \begin{dmath*}
+    H_2^2 = x_1^2 + x_1 x_2 + x_2^2 - q_1 - q_2
+  \end{dmath*},
+  \begin{dsuspend}
+    and
+  \end{dsuspend}
+  \begin{dmath*}
+    H_3^1 = x_1^3 - 2x_1 q_1 - x_2 q_1
+  \end{dmath*}.
+\end{dgroup*}
+
+\subsubsection{\texttt{empheq} package}
+
+Examples taken from \cite{empheq}:
+\begin{empheq}{align*}
+  a&= b \tag{*}\\
+  E&= mc^2 + \int_a^a x\,dx
+\end{empheq}
+or
+\begin{empheq}{alignat=2}
+  a &= b &\quad c &= d \\
+  \text{this} &= \text{that} &\quad \mathit{fish}&\neq fish
+\end{empheq}
+or
+\begin{empheq}[innerbox=\fbox,
+  left=L\Rightarrow]{align}
+  a&=b\\
+  E&=mc^2 + \int_a^a x\, dx
+\end{empheq}
+or
+\begin{empheq}[
+  left={\parbox[c][\EmphEqdisplayheight+\EmphEqdisplaydepth][t]
+    {4.5cm}
+    {You may find this kind of description useful.}\enspace}%
+  ]{align}
+  a&=\int_0^1 x\,dx +\frac{foo + bar}{baz}\\
+  E&= mc^2
+\end{empheq}
+
+\begin{thebibliography}{9}\raggedright
+\bibitem{breqn} Downes, Michael J.; H\o gholm, Morten: The
+  \texttt{breqn} package.  Released 2017/01/27.
+\bibitem{empheq} H\o gholm, Morten; Madsen, Lars: The \texttt{empheq}
+  package.  Released 2014/08/04.
+\bibitem{expl3} The \LaTeX3 Project: The expl3 package and \LaTeX3
+  programming.  Released 2017/04/01.
+\bibitem{voss16} Vo\ss, Herbert: Mathematical Typesetting with
+  \LaTeX.  TUG-Version 0.32, released 2016/11/08.
+\end{thebibliography}
+
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:
diff --git a/tests/tex/compilation-log.txt b/tests/tex/compilation-log.txt
index 85e56c0..f9ce7ac 100644
--- a/tests/tex/compilation-log.txt
+++ b/tests/tex/compilation-log.txt
@@ -61,6 +61,10 @@ Overfull \hbox (13.59138pt too wide) in paragraph at lines 
367--368
 
 [93])
 
+! Undefined control sequence.
+l.11 \doesnotexist
+
+(./foo.aux) )
 LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input line 48.
 
 LaTeX Warning: There were undefined references.
diff --git a/tests/tex/error-parsing.el b/tests/tex/error-parsing.el
index ed34409..3da46c1 100644
--- a/tests/tex/error-parsing.el
+++ b/tests/tex/error-parsing.el
@@ -110,12 +110,35 @@ ABD: EveryShipout initializing macros"
              (bad-box "./file  name/with spaces.tex" 367 "Overfull \\hbox 
(13.59138pt too wide) in paragraph at lines 367--368"
               0 "\n[]\\T1/pplj/m/n/10.95 Un qua-dri-vet-to-re co-va-rian-te 
$\\OMS/zplm/m/n/10.95 f\\OML/zplm/m/it/10.95 A[]\\OMS/zplm/m/n/10.95 g$ 
\\T1/pplj/m/n/10.95 e un in-sie-me di quat-tro quan-ti-ta $\\OT1/zplm/m/n/10.95 
(\\OML/zplm/m/it/10.95 A[]; A[]; A[]; A[]\\OT1/zplm/m/n/10.95 )$" "$"
               368 t 2600 nil)
+             (error "./test.tex" 11 "Undefined control sequence." 0
+                   "\nl.11 \\doesnotexist\n\n(./foo.aux) )"
+                   "\\doesnotexist\n" nil nil 2682 nil)
              (warning "./test.tex" 48
               "LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input 
line 48." 0
               "LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input 
line 48.\n"
-              "Knuth:TeXbook-1984" 48 nil 2692 nil)
+              "Knuth:TeXbook-1984" 48 nil 2756 nil)
              (warning "./test.tex" nil "LaTeX Warning: There were undefined 
references."
-              0 "LaTeX Warning: There were undefined references.\n" nil nil 
nil 2741 nil)))))
+              0 "LaTeX Warning: There were undefined references.\n" nil nil 
nil 2805 nil)
+))))
+
+(ert-deftest TeX-error-parsing-expl3-warnings ()
+  "Test parsing of expl3 warnings."
+  (should (equal
+          (with-temp-buffer
+            (setq TeX-debug-warnings t
+                  TeX-debug-bad-boxes t)
+             (insert
+             "*************************************************
+* xsim warning: \"rerun\"
+* 
+* Exercise properties may have changed. Rerun to get them synchronized.
+*************************************************
+")
+             (TeX-parse-all-errors)
+            TeX-error-list)
+          '((warning nil nil "* xsim warning: \"rerun\"" 0
+                     "* xsim warning: \"rerun\"\n* \n* Exercise properties may 
have changed. Rerun to get them 
synchronized.\n*************************************************\n"
+                     nil nil nil 200 nil)))))
 
 ;; See https://lists.gnu.org/archive/html/auctex/2017-04/msg00007.html.
 (ert-deftest TeX-LaTeX2e-date ()
diff --git a/tex-buf.el b/tex-buf.el
index 8c9c7ef..f64fa2d 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -177,11 +177,15 @@ temporary file before the region itself.  The document's 
header is all
 text before `TeX-header-end'.
 
 If the master file for the document has a trailer, it is written to
-the temporary file before the region itself.  The document's trailer is
+the temporary file after the region itself.  The document's trailer is
 all text after `TeX-trailer-start'."
   (interactive "P")
   (TeX-region-update)
-  (TeX-command (TeX-command-query (TeX-region-file nil t)) 'TeX-region-file
+  ;; In the next line, `TeX-region-file' should be called with nil
+  ;; `nondirectory' argument, otherwise `TeX-comand-default' called
+  ;; within `TeX-command-query' won't work in included files not
+  ;; placed in `TeX-master-directory'.
+  (TeX-command (TeX-command-query (TeX-region-file)) 'TeX-region-file
               override-confirm))
 
 (defun TeX-command-buffer (&optional override-confirm)
@@ -492,6 +496,11 @@ been set."
         (setq TeX-current-process-region-p t))
        ((eq file #'TeX-master-file)
         (setq TeX-current-process-region-p nil)))
+
+  ;; When we're operating on a region, we need to update the position
+  ;; of point in the region file so that forward search works.
+  (if (string= name "View") (TeX-region-update-point))
+
   (let ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list))
                                     file))
        (hook (nth 2 (assoc name TeX-command-list)))
@@ -772,7 +781,7 @@ omitted) and `TeX-region-file'."
     (cond (;; name might be absolute or relative, so expand it for
           ;; comparison.
           (if (string-equal (expand-file-name name)
-                            (expand-file-name TeX-region))
+                            (expand-file-name (TeX-region-file)))
               (TeX-check-files (concat name "." (TeX-output-extension))
                                ;; Each original will be checked for all dirs
                                ;; in `TeX-check-path' so this needs to be just
@@ -818,7 +827,7 @@ omitted) and `TeX-region-file'."
          (completion-ignore-case t)
          (answer (or TeX-command-force
                      (completing-read
-                      (concat "Command: (default " default ") ")
+                      (concat "Command (default " default "): ")
                       (TeX-mode-specific-command-list major-mode) nil t
                       nil 'TeX-command-history default))))
     ;; If the answer is "latex" it will not be expanded to "LaTeX"
@@ -846,10 +855,9 @@ QUEUE is non-nil when we are checking for the printer 
queue."
             (setq printer (if TeX-printer-list
                               (let ((completion-ignore-case t))
                                 (completing-read
-                                 (concat "Printer: "
-                                         (and TeX-printer-default
-                                              (concat "(default "
-                                                      TeX-printer-default ") 
")))
+                                 (format "Printer%s: "
+                                         (if TeX-printer-default
+                                             (format " (default %s)" 
TeX-printer-default) ""))
                                  TeX-printer-list))
                             ""))
             (setq printer (or (car-safe (TeX-assoc printer TeX-printer-list))
@@ -899,18 +907,22 @@ QUEUE is non-nil when we are checking for the printer 
queue."
 Thereafter, point in the region file is on the same text as in
 the current buffer.
 
-Does nothing in case the last command hasn't operated on the
-region."
-  (when TeX-current-process-region-p
+Do nothing in case the last command hasn't operated on the region
+or `TeX-source-correlate-mode' is disabled."
+  (when (and TeX-current-process-region-p TeX-source-correlate-mode)
     (let ((region-buf (get-file-buffer (TeX-region-file t)))
-         (current-line (TeX-line-number-at-pos)))
+         (orig-line (TeX-current-offset))
+         (pos-in-line (- (point) (max (line-beginning-position)
+                                      (or TeX-command-region-begin
+                                          (region-beginning))))))
       (when region-buf
        (with-current-buffer region-buf
          (goto-char (point-min))
-         (when (re-search-forward "!offset(\\(-?[0-9]+\\)")
+         (when (re-search-forward "!offset(\\(-?[0-9]+\\)" nil t)
            (let ((offset (string-to-number (match-string 1))))
              (goto-char (point-min))
-             (forward-line (- current-line (1+ offset))))))))))
+             (forward-line (- orig-line offset))
+             (forward-char pos-in-line))))))))
 
 (defun TeX-view ()
   "Start a viewer without confirmation.
@@ -919,11 +931,7 @@ depending on the last command issued."
   (interactive)
   (let ((output-file (TeX-active-master (TeX-output-extension))))
     (if (file-exists-p output-file)
-       (progn
-         ;; When we're operating on a region, we need to update the position
-         ;; of point in the region file so that forward search works.
-         (TeX-region-update-point)
-         (TeX-command "View" 'TeX-active-master 0))
+       (TeX-command "View" 'TeX-active-master 0)
       (message "Output file %S does not exist." output-file))))
 
 (defun TeX-output-style-check (styles)
@@ -978,9 +986,58 @@ requires that the corresponding mode defines a sensible
       (with-current-buffer buf
        (revert-buffer nil t t)))))
 
-(defvar TeX-after-start-process-function nil
-  "Hooks to run after starting an asynchronous process.
-Used by Japanese TeX to set the coding system.")
+(defvar TeX-after-start-process-function
+  #'TeX-adjust-process-coding-system
+  "Function to adjust coding system of an asynchronous process.
+Called with one argument PROCESS.")
+
+(defun TeX-adjust-process-coding-system (process)
+  "Adjust coding system of PROCESS to suitable value.
+Usually coding system is the same as the TeX file with eol format
+adjusted to OS default value.  Take care of Japanese TeX, which
+requires special treatment."
+  (when (featurep 'mule)
+    (if (and (boundp 'japanese-TeX-mode)
+            (fboundp 'japanese-TeX-set-process-coding-system)
+            (with-current-buffer TeX-command-buffer
+              japanese-TeX-mode))
+       (japanese-TeX-set-process-coding-system process)
+      (let ((cs (with-current-buffer TeX-command-buffer
+                 buffer-file-coding-system)))
+       ;; The value of `buffer-file-coding-system' is sometimes
+       ;; undecided-{unix,dos,mac}.  That happens when the file
+       ;; contains no multibyte chars and only end of line format is
+       ;; determined.  Emacs lisp reference recommends not to use
+       ;; undecided-* for process coding system, so it might seem
+       ;; reasonable to change undecided-* to some fixed coding
+       ;; system like this:
+       ;; (if (eq 'undecided (coding-sytem-type cs))
+       ;;     (setq cs 'utf-8))
+       ;; However, that can lose when the following conditions are
+       ;; met:
+       ;; (1) The document is divided into multiple files.
+       ;; (2) The command buffer contains no multibyte chars.
+       ;; (3) The other files contain mutlibyte chars and saved in
+       ;;     a coding system other than the coding system chosen
+       ;;     above.
+       ;; So we leave undecided-* unchanged here.  Although
+       ;; undecided-* is not quite safe for the coding system for
+       ;; encoding, i.e., keyboard input to the TeX process, we
+       ;; expect that this does not raise serious problems because it
+       ;; is pretty rare that TeX process needs keyboard input of
+       ;; multibyte chars.
+
+       ;; Eol format of TeX files can differ from OS default. TeX
+       ;; binaries accept all type of eol format in the given files
+       ;; and output messages according to OS default.  So we set eol
+       ;; format to OS default value.
+       (setq cs (coding-system-change-eol-conversion
+                 cs
+                 ;; The eol of macosX is LF, not CR.  So we choose
+                 ;; other than `unix' only for w32 system.
+                 ;; FIXME: what should we do for cygwin?
+                 (if (eq system-type 'windows-nt) 'dos 'unix)))
+       (set-process-coding-system process cs cs)))))
 
 (defcustom TeX-show-compilation nil
   "*If non-nil, show output of TeX compilation in other window."
@@ -1237,7 +1294,7 @@ With support for MS-DOS, especially when dviout is used 
with PC-9801 series."
     (if dir (cd dir))
     (erase-buffer)
     (let ((process (start-process (concat name " silent")
-                                 nil TeX-shell
+                                 (current-buffer) TeX-shell
                                  TeX-shell-command-option command)))
       (if TeX-after-start-process-function
          (funcall TeX-after-start-process-function process))
@@ -1473,7 +1530,7 @@ Return nil ifs no errors were found."
 ;;   Package xyz123 Warning: ...
 ;;   Class xyz123 Warning: ...
 (defvar LaTeX-warnings-regexp
-  "\\(?:LaTeX\\|Class\\|Package\\) [-A-Za-z0-9]* ?Warning:"
+  "\\(?:LaTeX\\|Class\\|Package\\|\*\\) [-A-Za-z0-9]* ?[Ww]arning:"
   "Regexp matching LaTeX warnings.")
 
 (defun TeX-LaTeX-sentinel-has-warnings ()
@@ -1580,6 +1637,10 @@ Rerun to get mark in right position\\." nil t)
         (message
          "%s" "You should run LaTeX again to get TikZ marks in right position")
         (setq TeX-command-next TeX-command-default))
+       ((re-search-forward "^\* xsim warning: \"rerun\"" nil t)
+        (message
+         "%s" "You should run LaTeX again to synchronize exercise properties")
+        (setq TeX-command-next TeX-command-default))
        ((re-search-forward
          "^\\(\\*\\* \\)?J?I?p?\\(La\\|Sli\\)TeX\\(2e\\)? \
 \\(Version\\|ver\\.\\|<[0-9/-]*\\(?:u[^>]*\\)?>\\)" nil t)
@@ -2093,14 +2154,6 @@ original file."
                ") }\n"
                trailer)
        (setq TeX-region-orig-buffer orig-buffer)
-       ;; Position point at the line/col that corresponds to point's line in
-       ;; orig-buffer in order to make forward search work.
-       (let ((line-col (with-current-buffer orig-buffer
-                         (cons (TeX-line-number-at-pos)
-                               (current-column)))))
-          (goto-char (point-min))
-          (forward-line (1- (abs (- header-offset (car line-col)))))
-         (forward-char (cdr line-col)))
        (run-hooks 'TeX-region-hook)
        (if (string-equal (buffer-string) original-content)
            (set-buffer-modified-p nil)
diff --git a/tex-ispell.el b/tex-ispell.el
index 98615c6..cd279c6 100644
--- a/tex-ispell.el
+++ b/tex-ispell.el
@@ -46,6 +46,7 @@
 ;; booktabs.sty
 ;; breqn.sty
 ;; cleveref.sty
+;; empheq.sty
 ;; enumitem.sty
 ;; fancyref.sty
 ;; fancyvrb.sty
@@ -127,6 +128,7 @@
       ("attachfilesetup" . 1)
       ("textattachfile" . 1)
       ;; booktabs.sty
+      ("addlinespace" . 0)
       ("specialrule" . 3)
       ;; cleveref.sty
       ("cref" . 1)
@@ -145,6 +147,8 @@
       ("Cpagerefrange" . 2)
       ("crefrange*" . 2)
       ("Crefrange*" . 2)
+      ;; empheq.sty
+      ("empheqset" . 1)
       ;; fancyref.sty
       ("fref" . 1)
       ("Fref" . 1)
@@ -260,6 +264,8 @@ argument and spell check the mandatory one."))
       "dmath*"
       "dseries"
       "dseries*"
+      ;; empheq.sty
+      "empheq"
       ;; fancyvrb.sty
       "BVerbatim"
       "BVerbatim*"
diff --git a/tex-jp.el b/tex-jp.el
index 5bdae54..09909ba 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -446,14 +446,20 @@ See also a user custom option 
`TeX-japanese-process-input-coding-system'."
                 ;; uptex $B$J$i(B utf-8 $B$K8GDj$9$k!#(B
                 (t
                  'utf-8))))
+
+       ;; $B2~9T%3!<%I$r;XDj!#(B
+       (setq dec (coding-system-change-eol-conversion
+                  dec
+                  (if (eq system-type 'windows-nt) 'dos 'unix))
+             enc (coding-system-change-eol-conversion
+                  enc
+                  (if (eq system-type 'windows-nt) 'dos 'unix)))
+
        ;; Customize $BCM$,$"address@hidden(B
        (set-process-coding-system
         process
         (or TeX-japanese-process-output-coding-system dec)
         (or TeX-japanese-process-input-coding-system enc))))))
-(when (featurep 'mule)
-  (setq TeX-after-start-process-function
-        #'japanese-TeX-set-process-coding-system))
 
 (defun japanese-TeX-coding-ejsu (coding-system)
   "Convert japanese CODING-SYSTEM to mnemonic string.
diff --git a/tex-site.el.in b/tex-site.el.in
index dc4b803..7ceb64e 100644
--- a/tex-site.el.in
+++ b/tex-site.el.in
@@ -39,7 +39,14 @@
 ;;; Code:
 
 (if (< emacs-major-version 21)
-    (error "AUCTeX requires Emacs 21 or later"))
+    (error "AUCTeX requires Emacs 21 or later")) ;FIXME: Really?
+
+(unless (or (fboundp 'TeX-modes-set)     ;Avoid inf-looping.
+            (fboundp 'TeX-tex-mode))     ;auctex-autoloads is not loaded.
+  ;; Try and support the case where someone loads tex-site.el or
+  ;; auctex.el directly, in the old way.
+  (provide 'tex-site)        ;Avoid (re)loading tex-site from auctex-autoloads.
+  (load "auctex-autoloads" 'noerror 'nomessage))
 
 ;; Define here in order for `M-x customize-group <RET> AUCTeX <RET>'
 ;; to work if the main AUCTeX files are not loaded yet.
diff --git a/tex.el b/tex.el
index 41838bb..972110b 100644
--- a/tex.el
+++ b/tex.el
@@ -160,7 +160,7 @@ If nil, none is specified."
     ("Index" "makeindex %s" TeX-run-index nil t
      :help "Run makeindex to create index file")
     ("upMendex" "upmendex %s" TeX-run-index t t
-     :help "Run mendex to create index file")
+     :help "Run upmendex to create index file")
     ("Xindy" "texindy %s" TeX-run-command nil t
      :help "Run xindy to create index file")
     ("Check" "lacheck %s" TeX-run-compile nil (latex-mode)
@@ -1234,33 +1234,31 @@ The following built-in predicates are available:
   :group 'TeX-view
   :type '(alist :key-type symbol :value-type (group sexp)))
 
-;; XXX: Atril is a fork of Evince and shares an almost identical interface with
-;; it.  Instead of having different functions for each program, we keep the
-;; original *-evince-* functions and make them accept arguments to specify the
-;; actual name of the program and the desktop environment, that will be used to
-;; set up DBUS communication.
+;; XXX: Atril and xreader are forks of Evince and share an almost
+;; identical interface with it. Instead of having different functions
+;; for each program, we keep the original *-evince-* functions and
+;; make them accept arguments to specify the actual name of the
+;; program and the desktop environment, that will be used to set up
+;; DBUS communication.
 
 ;; Require dbus at compile time to prevent errors due to `dbus-ignore-errors'
 ;; not being defined.
 (eval-when-compile (and (featurep 'dbusbind)
                        (require 'dbus nil :no-error)))
 (defun TeX-evince-dbus-p (de app &rest options)
-  "Return non-nil, if atril or evince are installed and accessible via DBUS.
+  "Return non-nil, if an evince-compatible reader is accessible via DBUS.
 Additional OPTIONS may be given to extend the check.  If none are
 given, only the minimal requirements needed by backward search
 are checked.  If OPTIONS include `:forward', which is currently
 the only option, then additional requirements needed by forward
 search are checked, too.
 
-DE is the name of the desktop environment, either \"gnome\" or
-\"mate\", APP is the name of viewer, either \"evince\" or
-\"atril\"."
+DE is the name of the desktop environment, APP is the name of viewer."
   (let ((dbus-debug nil))
     (and (featurep 'dbusbind)
         (require 'dbus nil :no-error)
         (dbus-ignore-errors (dbus-get-unique-name :session))
         (dbus-ping :session (format "org.%s.%s.Daemon" de app))
-        (executable-find app)
         (or (not (memq :forward options))
             (let ((spec (dbus-introspect-get-method
                          :session (format "org.%s.%s.Daemon" de app)
@@ -1308,12 +1306,11 @@ entry in `TeX-view-program-list-builtin'."
 (defun TeX-evince-sync-view-1 (de app)
   "Focus the focused page/paragraph in Evince with the position
 of point in emacs by using Evince's DBUS API.  Used by default
-for the Atril or Evince entries in
+for the Evince-compatible entries in
 `TeX-view-program-list-builtin' if the requirements are met.
 
-DE is the name of the desktop environment, either \"gnome\" or
-\"mate\", APP is the name of viewer, either \"evince\" or
-\"atril\"."
+DE is the name of the desktop environment, APP is the name of
+viewer."
   (require 'url-util)
   (let* ((uri (concat "file://" (url-encode-url
                                 (expand-file-name
@@ -1335,7 +1332,13 @@ DE is the name of the desktop environment, either 
\"gnome\" or
           (format "org.%s.%s.Window" de app)
           "SyncView"
           (buffer-file-name)
-          (list :struct :int32 (TeX-line-number-at-pos)
+          (list :struct :int32 (1+ (TeX-current-offset))
+                ;; FIXME: Using `current-column' here is dubious.
+                ;; Most of CJK letters count as occupying 2 columns,
+                ;; so the column number is not equal to the number of
+                ;; the characters counting from the beginning of a
+                ;; line.  What is the right number to specify here?
+                ;; number of letters? bytes in UTF8? or other?
                 :int32 (1+ (current-column)))
           :uint32 0))
       (error "Couldn't find the %s instance for %s" (capitalize app) uri))))
@@ -1348,12 +1351,15 @@ DE is the name of the desktop environment, either 
\"gnome\" or
   "Run `TeX-evince-sync-view-1', which see, set up for Evince."
   (TeX-evince-sync-view-1 "gnome" "evince"))
 
+(defun TeX-xreader-sync-view ()
+  "Run `TeX-evince-sync-view-1', which see, set up for Evince."
+  (TeX-evince-sync-view-1 "x" "reader"))
+
 (defun TeX-view-program-select-evince (de app)
   "Select how to call the Evince-like viewer.
 
-DE is the name of the desktop environment, either \"gnome\" or
-\"mate\", APP is the name of viewer, either \"evince\" or
-\"atril\"."
+DE is the name of the desktop environment, APP is the name of
+viewer."
   (if (TeX-evince-dbus-p de app :forward)
       (intern (format "TeX-%s-sync-view" app))
     `(,app (mode-io-correlate
@@ -1385,7 +1391,7 @@ DE is the name of the desktop environment, either 
\"gnome\" or
                 "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout")
       ("SumatraPDF"
        ("SumatraPDF -reuse-instance"
-       (mode-io-correlate " -forward-search \"%b\" %n") " %o")
+       (mode-io-correlate " -forward-search %b %n") " %o")
        "SumatraPDF")
       ("dvips and start" "dvips %d -o && start \"\" %f" "dvips")
       ("start" "start \"\" %o")))
@@ -1412,6 +1418,7 @@ DE is the name of the desktop environment, either 
\"gnome\" or
       ("xpdf" ("xpdf -remote %s -raise %o" (mode-io-correlate " %(outpage)")) 
"xpdf")
       ("Evince" ,(TeX-view-program-select-evince "gnome" "evince") "evince")
       ("Atril" ,(TeX-view-program-select-evince "mate" "atril") "atril")
+      ("Xreader" ,(TeX-view-program-select-evince "x" "reader") "xreader")
       ("Okular" ("okular --unique %o" (mode-io-correlate "#src:%n%a")) 
"okular")
       ("xdg-open" "xdg-open %o" "xdg-open")
       ("PDF Tools" TeX-pdf-tools-sync-view)
@@ -1885,8 +1892,8 @@ file and LINE to (+ LINE offset-of-region).  Else, return 
nil."
 (defcustom TeX-raise-frame-function #'raise-frame
   "A function which will be called to raise the Emacs frame.
 The function is called after `TeX-source-correlate-sync-source'
-has processed an inverse search DBUS request from Evince or
-Atril in order to raise the Emacs frame.
+has processed an inverse search DBUS request from
+Evince-compatible viewers in order to raise the Emacs frame.
 
 The default value is `raise-frame', however, depending on window
 manager and focus stealing policies, it might very well be that
@@ -1976,8 +1983,9 @@ SyncTeX are recognized."
                                       TeX-source-correlate-map))
   (TeX-set-mode-name 'TeX-source-correlate-mode t t)
   (setq TeX-source-correlate-start-server-flag TeX-source-correlate-mode)
-  ;; Register Emacs for the SyncSource DBUS signal emitted by Evince or Atril.
-  (dolist (de-app '(("gnome" "evince") ("mate" "atril")))
+  ;; Register Emacs for the SyncSource DBUS signal emitted by
+  ;; Evince-compatible viewers.
+  (dolist (de-app '(("gnome" "evince") ("mate" "atril") ("x" "reader")))
     (when (TeX-evince-dbus-p (car de-app) (cadr de-app))
       (dbus-register-signal
        :session nil (format "/org/%s/%s/Window/0" (car de-app) (cadr de-app))
@@ -2090,11 +2098,14 @@ enabled and the `synctex' binary is available."
   (let ((synctex-output
         (with-output-to-string
           (call-process "synctex" nil (list standard-output nil) nil "view"
-                        "-i" (format "%s:%s:%s" (TeX-line-number-at-pos)
-                                     (current-column)
+                        "-i" (format "%s:%s:%s" (1+ (TeX-current-offset))
+                                     ;; FIXME: Using `current-column'
+                                     ;; here is dubious.  See comment in
+                                     ;; `TeX-evince-sync-view-1'.
+                                     (1+ (current-column))
                                      file)
                         "-o" (TeX-active-master (TeX-output-extension))))))
-    (when (string-match "Page:\\([0-9]+\\)" synctex-output)
+    (when (string-match "^Page:\\([0-9]+\\)" synctex-output)
       (match-string 1 synctex-output))))
 
 (defun TeX-synctex-output-page ()
@@ -2430,7 +2441,7 @@ this variable to \"<none>\"."
     (let* ((default (TeX-dwim-master))
           (name (or (and (eq 'dwim TeX-master) default)
                     (condition-case nil
-                        (read-file-name (format "Master file: (default %s) "
+                        (read-file-name (format "Master file (default %s): "
                                                 (or default "this file"))
                                         nil default)
                       (quit "<quit>")))))
@@ -2488,7 +2499,7 @@ name of master file if it cannot be determined otherwise."
          (setq TeX-master
                (let* ((default (TeX-dwim-master))
                       (name (read-file-name
-                             (format "Master file: (default %s) "
+                             (format "Master file (default %s): "
                                      (or default "this file"))
                              nil default)))
                  (cond ((string= name default)
@@ -3077,7 +3088,7 @@ FORCE is not nil."
                                    TeX-style-hook-list))))
        (TeX-auto-apply))
     (run-hooks 'TeX-update-style-hook)
-    (message "Applying style hooks... done")))
+    (message "Applying style hooks...done")))
 
 (defvar TeX-remove-style-hook nil
   "List of hooks to call when we remove the style specific information.")
@@ -3892,6 +3903,7 @@ The algorithm is as follows:
       (set local
           (sort (mapcar 'TeX-listify (apply 'append (symbol-value local)))
                 'TeX-car-string-lessp))
+      (message "Sorting %s...done" name)
       ;; Make it unique
       (message "Removing duplicates...")
       (let ((entry (symbol-value local)))
@@ -3905,7 +3917,7 @@ The algorithm is as follows:
              (if (> (length next) (length this))
                  (setcdr this (cdr next)))
              (setcdr entry (cdr (cdr entry)))))))
-      (message "Removing duplicates... done"))
+      (message "Removing duplicates...done"))
     (symbol-value local)))
 
 (defmacro TeX-auto-add-type (name prefix &optional plural)
@@ -4087,7 +4099,7 @@ If TEX is a directory, generate style files for all files 
in the directory."
                                                        t)
                                   ".el"))
           (kill-buffer (current-buffer))
-          (message "Parsing %s... done" tex)))))
+          (message "Parsing %s...done" tex)))))
 
 ;;;###autoload
 (defun TeX-auto-generate-global ()



reply via email to

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