[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa 8ed465a 50/51: Merge branch 'master' into elpa
From: |
Tassilo Horn |
Subject: |
[elpa] elpa 8ed465a 50/51: Merge branch 'master' into elpa |
Date: |
Sun, 22 May 2016 07:22:51 +0000 (UTC) |
branch: elpa
commit 8ed465a83f237f088d01c63fec56ace90cb75fff
Merge: 7ba0a0e cf54f7d
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>
Merge branch 'master' into elpa
---
ChangeLog-preview.1 | 24 +-
Makefile.in | 2 +-
aclocal.m4 | 2 +-
autogen.sh | 2 +-
build-aux/gitlog-to-auctexlog | 4 +-
doc/auctex.texi | 49 +++-
doc/changes.texi | 26 +-
latex.el | 3 +-
style/alltt.el | 7 +-
style/beamer.el | 7 +-
style/color.el | 79 ++---
style/colortbl.el | 34 ++-
style/currvita.el | 2 +-
style/doc.el | 78 +++--
style/fancyvrb.el | 14 +-
style/filecontents.el | 6 +-
style/hyperref.el | 7 +-
style/ifluatex.el | 8 +-
style/listings.el | 9 +-
style/longtable.el | 11 +-
style/ltx-base.el | 14 +-
style/minted.el | 11 +-
style/ntheorem.el | 8 +-
style/tabularx.el | 9 +-
style/tabulary.el | 7 +-
style/textpos.el | 10 +-
style/tikz.el | 130 ++++++---
style/xcolor.el | 628 ++++++++++++++++++++++++++++++++++++++++
tests/tex/command-expansion.el | 43 +++
tex-buf.el | 140 ++++++---
tex-jp.el | 93 +++---
tex-site.el.in | 32 +-
tex.el | 123 ++++++--
texmathp.el | 4 +-
34 files changed, 1303 insertions(+), 323 deletions(-)
diff --git a/ChangeLog-preview.1 b/ChangeLog-preview.1
index f771697..cdd9956 100644
--- a/ChangeLog-preview.1
+++ b/ChangeLog-preview.1
@@ -117,7 +117,7 @@
preview-gs-get-colors.
(preview-dvipng-get-colors): Removed.
-2004-03-02 Jan-�ke Larsson <address@hidden>
+2004-03-02 Jan-Åke Larsson <address@hidden>
* preview.el: Fix xemacs' defalias problem
@@ -193,7 +193,7 @@
* Makefile.in, doc/Makefile.in, latex/Makefile.in: Add DESTDIR
variable
-2003-11-10 Jan-�ke Larsson <address@hidden>
+2003-11-10 Jan-Åke Larsson <address@hidden>
* preview.el: Add 'dvipng preview-scale functionality
@@ -203,11 +203,11 @@
this file is not needed for distribution (rpm 4.1+ complains about
this 'missing' file).
-2003-11-07 Jan-�ke Larsson <address@hidden>
+2003-11-07 Jan-Åke Larsson <address@hidden>
* preview.el: Fix dvipng resolution
-2003-11-06 Jan-�ke Larsson <address@hidden>
+2003-11-06 Jan-Åke Larsson <address@hidden>
* prv-xemacs.el:
* prv-emacs.el:
@@ -266,15 +266,15 @@
* aclocal.m4 (library): Try setting the EMACS_cv_SYS_* variable
that we are actually checking. Is that correct?
-2003-04-17 Jan-�ke Larsson <address@hidden>
+2003-04-17 Jan-Åke Larsson <address@hidden>
* doc/wininstall.texi: Corrected --with-lispdir and --with-packagedir
-2003-04-09 Jan-�ke Larsson <address@hidden>
+2003-04-09 Jan-Åke Larsson <address@hidden>
* aclocal.m4: More sane emacs-macro path-searching.
-2003-03-31 Jan-�ke Larsson <address@hidden>
+2003-03-31 Jan-Åke Larsson <address@hidden>
* aclocal.m4 (EMACS_PROG_EMACS): Make the test fail gracefully
when no binary executable is found. More generally, make the
@@ -1961,7 +1961,7 @@
2002-03-27 David Kastrup <address@hidden>
* preview.dtx: be careful in unboxing so as not to remove
- possibly shifted hboxes (bug reported by Jan-�ke) protected by an
+ possibly shifted hboxes (bug reported by Jan-Åke) protected by an
otherwise inexplicable penalty.
* preview.el: Complete overhaul of parsing to avoid (costly)
@@ -2389,7 +2389,7 @@
* doc/problems.texi (Font problems with Dvips): Changed pounds
sign. Not much of an improvement (we get the wrong character),
- but 7bit safe. If Jan-�ke finds this as desirable as to have his
+ but 7bit safe. If Jan-Åke finds this as desirable as to have his
own name mangled, we should follow at least make it pay off.
* doc/preview-latex.texi (On EPS previews): png16m is default
@@ -2667,7 +2667,7 @@
* doc/Makefile (preview-latex/index.html): generate HTML with
makeinfo as texi2html does not grok @preview-latex.
- * doc/preview-latex.texi: Write � instead of @AA (x-symbol sneaked
+ * doc/preview-latex.texi: Write Å instead of @AA (x-symbol sneaked
that in). And revert again: does not print.
* doc/install.texi: Use @previewlatex.
@@ -2851,7 +2851,7 @@
(preview-handle-insert-behind): same.
(preview-handle-modification): same.
-2001-11-29 Jan-�ke Larsson <address@hidden>
+2001-11-29 Jan-Åke Larsson <address@hidden>
* doc/preview-latex.texi: Created first draft
@@ -3717,7 +3717,7 @@
* README: Clarified comment about how to improve EPS support in Emacs.
- * README: Removed link to pretest Emacs on request from Gerd M�llmann.
+ * README: Removed link to pretest Emacs on request from Gerd Möllmann.
2001-09-12 David Kastrup <address@hidden>
diff --git a/Makefile.in b/Makefile.in
index b390c66..23bf4a5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -154,7 +154,7 @@ STYLESRC = style/prosper.el \
style/fontenc.el style/Alegreya.el style/gloss-italian.el \
style/newfloat.el style/subcaption.el style/AlegreyaSans.el \
style/hologo.el style/theorem.el style/ntheorem.el \
- style/splitidx.el style/tikz.el
+ style/splitidx.el style/tikz.el style/xcolor.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/aclocal.m4 b/aclocal.m4
index b701653..08b0b52 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -94,7 +94,7 @@ fi
AC_DEFUN(AC_DATE_VERSION_FROM_CHANGELOG, [
AC_MSG_CHECKING([for date with git])
-$1=[`git log -1 --date=short --format=%ad 2> /dev/null`]
+$1=[`git log -1 --date=short --format=%cd 2> /dev/null`]
if test "X${$1}" = X
then
AC_MSG_RESULT([git not found, checking for date in ChangeLog:])
diff --git a/autogen.sh b/autogen.sh
index 1bed156..ae22c80 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -32,7 +32,7 @@ ${AUTOCONF} || { echo "Error running ${AUTOCONF} in ." >&2 ;
exit 1; }
rm -rf autom4te.cache
if test "x${AUCTEXDATE}" = x
then
- AUCTEXDATE=`git log -1 --date=short --format=%ad 2> /dev/null`
+ AUCTEXDATE=`git log -1 --date=short --format=%cd 2> /dev/null`
if test "X${AUCTEXDATE}" = X
then
echo "Can't find date with git, trying with ChangeLog.1..." >&2
diff --git a/build-aux/gitlog-to-auctexlog b/build-aux/gitlog-to-auctexlog
index 9836713..1159748 100755
--- a/build-aux/gitlog-to-auctexlog
+++ b/build-aux/gitlog-to-auctexlog
@@ -76,12 +76,10 @@ test -d .git || {
# Use Gnulib's packaged ChangeLog generator.
# Maybe we should skip all "Merge branch 'master'" messages.
-# NOTE: in AUCTeX the ChangeLog is encoded with ISO-8859-1, use iconv
-# to enforce this encoding in the output file.
./build-aux/gitlog-to-changelog \
--ignore-matching="^; |^Merge branch .*$|^Merge from master\.$|^Merge
master branch\.$" \
--ignore-line='^; ' --format='%B' \
- "$gen_origin..$new_origin" | iconv -f UTF-8 -t ISO-8859-1 - >"ChangeLog.tmp"
|| exit
+ "$gen_origin..$new_origin" >"ChangeLog.tmp" || exit
if test -s "ChangeLog.tmp"; then
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 8c5218a..afb0c9e 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2926,23 +2926,40 @@ the document into @acronym{DVI} output. Thus, if you
want a
@acronym{PDF} document in the end you can either use address@hidden engine,
see below for information about how to set engines, or compile the
document with @command{tex} and then convert to @acronym{PDF} with
address@hidden@command{ps2pdf} before viewing it. The latter can be
-done automatically in @AUCTeX{} by setting the
address@hidden variable to a non-nil value.
-
address@hidden TeX-PDF-via-dvips-ps2pdf
-With @code{TeX-PDF-mode} set to non-nil, if
address@hidden is non-nil too, the document is compiled
-with @command{tex} (or @command{latex}) instead of @command{pdftex} (or
address@hidden). When the document is ready, @kbd{C-c C-c} will
-suggest to run @command{dvips} and then @command{ps2pdf} in order to
-convert the @acronym{DVI} file to @acronym{PDF}. When the @acronym{PDF}
-file is finally ready, the next suggested command will be to open the
-viewer.
address@hidden@command{ps2pdf} before viewing it. In addition,
+current Japanese @TeX{} engines cannot generate @acronym{PDF} directly
+so they rely on @address@hidden converters. Usually
address@hidden command is used for this purpose. You can use the
address@hidden variable to let @AUCTeX{} know you want to
+generate the final @acronym{PDF} by converting a @acronym{DVI} file.
+
address@hidden TeX-PDF-from-DVI
+This option controls if and how to produce a @acronym{PDF} file by
+converting a @acronym{DVI} file.
+
+When @code{TeX-PDF-mode} is non-nil, if @code{TeX-PDF-from-DVI} is
+non-nil too the document is compiled to @acronym{DVI} instead of
address@hidden When the document is ready, @kbd{C-c C-c} will suggest
+to run the converter to @acronym{PDF} or an intermediate format.
+
+If non-nil, @code{TeX-PDF-from-DVI} should be the name of the command,
+as a string, used to convert the @acronym{DVI} file to @acronym{PDF} or
+to an intermediate format. Values currently supported are:
address@hidden
address@hidden
address@hidden"Dvips"}: the @acronym{DVI} file is converted to @acronym{PS} with
address@hidden After successfully running it, @command{ps2pdf} will
+be the default command to convert the @acronym{PS} file to
address@hidden
address@hidden
address@hidden"Dvipdfmx"}: the @acronym{DVI} file is converted to @acronym{PDF}
+with @command{dvipdfmx}.
address@hidden itemize
+When the @acronym{PDF} file is finally ready, the next suggested command
+will be to open the viewer.
This option can also be set as a file local variable, in order to use
-the sequence @address@hidden@command{ps2pdf} on a
-per-document basis.
+this conversion on a per-document basis.
Recall the whole sequence of @kbd{C-c C-c} commands can be replace by
the single @kbd{C-c C-a}.
@@ -4430,7 +4447,7 @@ These correspond to the personal @TeX{} macros.
@AUCTeX{} can update the style information about a file each time you
save it, and it will do this if the directory @code{TeX-auto-local}
-exist. @code{TeX-auto-local} is by default set to @samp{"auto"}, so
+exists. @code{TeX-auto-local} is by default set to @samp{"auto"}, so
simply creating an @file{auto} directory will enable automatic saving of
style information.
diff --git a/doc/changes.texi b/doc/changes.texi
index 9d36f09..d819cc0 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -35,13 +35,22 @@ after compilation of the document.
@end ifclear
@item
-Added support for Atril viewer. Forward and inverse search requires
-version 1.9.1 or later to work.
+A new option, @code{TeX-PDF-from-DVI}, controls if and how to produce a
address@hidden file by converting a @acronym{DVI} file. This supersedes
address@hidden which is still recognized but marked as
+obsolete and may be removed in future releases.
@item
-Added support for dviout viewer on Windows. Note that this setup works
-when @code{TeX-source-correlate-method} is set to use
address@hidden for @acronym{DVI}, e.g.:
+Support for a number of external viewers has been addedd:
address@hidden
address@hidden
+Atril viewer. Forward and inverse search requires version 1.9.1 or
+later to work.
+
address@hidden
+dviout viewer on Windows. Note that this setup works when
address@hidden is set to use @samp{source-specials}
+for @acronym{DVI}, e.g.:
@lisp
(setq TeX-source-correlate-method
'((dvi . source-specials)
@@ -50,11 +59,12 @@ when @code{TeX-source-correlate-method} is set to use
which is the default.
@item
-Added support for SumatraPDF viewer on Windows.
+SumatraPDF viewer on Windows.
@item
-Added support for Zathura viewer. Forward and inverse search requires a
-recent version of the program to work (3.4 or later).
+Zathura viewer. Forward and inverse search requires a recent version of
+the program to work (3.4 or later).
address@hidden itemize
@item
A new function, @code{TeX-documentation-texdoc}, for reading
diff --git a/latex.el b/latex.el
index 9c2ccb5..16d6760 100644
--- a/latex.el
+++ b/latex.el
@@ -1259,7 +1259,8 @@ You may use `LaTeX-item-list' to change the routines used
to insert the item."
(defun LaTeX-item-argument ()
"Insert a new item with an optional argument."
- (let ((TeX-arg-item-label-p t))
+ (let ((TeX-arg-item-label-p t)
+ (TeX-insert-macro-default-style 'show-optional-args))
(TeX-insert-macro "item")))
(defun LaTeX-item-bib ()
diff --git a/style/alltt.el b/style/alltt.el
index 86b4993..ccb6ac9 100644
--- a/style/alltt.el
+++ b/style/alltt.el
@@ -1,6 +1,6 @@
;;; alltt.el --- AUCTeX style for `alltt.sty'
-;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2014, 2016 Free Software Foundation, Inc.
;; Author: Ralf Angeli <address@hidden>
;; Maintainer: address@hidden
@@ -34,9 +34,8 @@
"alltt"
(lambda ()
(LaTeX-add-environments "alltt")
- (make-local-variable 'LaTeX-indent-environment-list)
- (add-to-list 'LaTeX-indent-environment-list
- '("alltt" current-indentation))
+ (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
+ '("alltt" current-indentation) t)
(add-to-list 'LaTeX-verbatim-environments-local "alltt")
;; Fontification
(when (and (featurep 'font-latex)
diff --git a/style/beamer.el b/style/beamer.el
index 30cb328..b9e5953 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -1,6 +1,6 @@
;;; beamer.el --- AUCTeX style for the latex-beamer class
-;; Copyright (C) 2003, 2004, 2005, 2008, 2013, 2014 Free Software Foundation
+;; Copyright (C) 2003, 2004, 2005, 2008, 2013-2016 Free Software Foundation
;; Author: Thomas Baumann <address@hidden>
;; Created: 2003-12-20
@@ -169,9 +169,8 @@
"subsectionslide" "framenumber" "figure" "table"
"beamerpauses")
(LaTeX-add-pagestyles "navigation")
- (make-local-variable 'LaTeX-indent-environment-list)
- (add-to-list 'LaTeX-indent-environment-list
- '("semiverbatim" current-indentation))
+ (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
+ '("semiverbatim" current-indentation) t)
(add-to-list 'LaTeX-verbatim-environments-local "semiverbatim")
;; Fontification
diff --git a/style/color.el b/style/color.el
index 9d008b7..a7cce3f 100644
--- a/style/color.el
+++ b/style/color.el
@@ -1,6 +1,6 @@
;;; color.el --- AUCTeX style for `color.sty' (v1.1a)
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <esbati'at'gmx.de>
;; Maintainer: address@hidden
@@ -259,44 +259,45 @@ package.")
(LaTeX-provided-package-options-member "color" "dvipsnames")))
(apply #'LaTeX-add-color-definecolors LaTeX-color-dvipsnames-colors))
- (TeX-add-symbols
- ;; \definecolor{<name>}{<model>}{<color spec>}
- '("definecolor" TeX-arg-color-definecolor)
-
- ;; \color{<name>} or \color[<model>]{<color spec>}
- '("color" TeX-arg-color)
-
- ;; \textcolor{<name>}{<text>} or
- ;; \textcolor[<model>]{<color spec>}{<text>}
- '("textcolor" TeX-arg-color "Text")
-
- ;; \pagecolor{<name>} or
- ;; \pagecolor[<model>]{<color spec>}
- '("pagecolor" TeX-arg-color)
-
- ;; \nopagecolor
- '("nopagecolor" 0)
-
- ;; \colorbox{<name>}{<text>} or
- ;; \colorbox[<model>]{<color spec>}{<text>}
- '("colorbox" TeX-arg-color "Text")
-
- ;; \fcolorbox{<frame color name>}{<box color name>}{<text>} or
- ;; \fcolorbox[<model>]{<frame color spec>}{<box color spec>}{<text>}
- '("fcolorbox" TeX-arg-color-fcolorbox "Text"))
-
- ;; Fontification
- (when (and (featurep 'font-latex)
- (eq TeX-install-font-lock 'font-latex-setup))
- (font-latex-add-keywords '(("color" "[{")
- ("pagecolor" "[{"))
- 'type-declaration)
- (font-latex-add-keywords '(("textcolor" "[{{")
- ("colorbox" "[{{" )
- ("fcolorbox" "[{{{"))
- 'type-command)
- (font-latex-add-keywords '(("definecolor" "{{{"))
- 'function)))
+ (unless (member "xcolor" (TeX-style-list))
+ (TeX-add-symbols
+ ;; \definecolor{<name>}{<model>}{<color spec>}
+ '("definecolor" TeX-arg-color-definecolor)
+
+ ;; \color{<name>} or \color[<model>]{<color spec>}
+ '("color" TeX-arg-color)
+
+ ;; \textcolor{<name>}{<text>} or
+ ;; \textcolor[<model>]{<color spec>}{<text>}
+ '("textcolor" TeX-arg-color "Text")
+
+ ;; \pagecolor{<name>} or
+ ;; \pagecolor[<model>]{<color spec>}
+ '("pagecolor" TeX-arg-color)
+
+ ;; \nopagecolor
+ '("nopagecolor" 0)
+
+ ;; \colorbox{<name>}{<text>} or
+ ;; \colorbox[<model>]{<color spec>}{<text>}
+ '("colorbox" TeX-arg-color "Text")
+
+ ;; \fcolorbox{<frame color name>}{<box color name>}{<text>} or
+ ;; \fcolorbox[<model>]{<frame color spec>}{<box color spec>}{<text>}
+ '("fcolorbox" TeX-arg-color-fcolorbox "Text"))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("color" "[{")
+ ("pagecolor" "[{"))
+ 'type-declaration)
+ (font-latex-add-keywords '(("textcolor" "[{{")
+ ("colorbox" "[{{" )
+ ("fcolorbox" "[{{{"))
+ 'type-command)
+ (font-latex-add-keywords '(("definecolor" "{{{"))
+ 'function))))
LaTeX-dialect)
(defvar LaTeX-color-package-options
diff --git a/style/colortbl.el b/style/colortbl.el
index 7332ced..be4b5b5 100644
--- a/style/colortbl.el
+++ b/style/colortbl.el
@@ -1,6 +1,6 @@
;;; colortbl.el --- AUCTeX style for `colortbl.sty' (v1.0a)
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <esbati'at'gmx.de>
;; Maintainer: address@hidden
@@ -35,22 +35,40 @@
"colortbl"
(lambda ()
- (TeX-run-style-hooks "color" "array")
+ ;; array.el is always loaded:
+ (TeX-run-style-hooks "array")
+
+ ;; Load color.el only if xcolor.el is not already loaded. This is
+ ;; mainly for the option `table' from xcolor.sty which loads
+ ;; colortbl.sty, but we don't want to load color.el.
+ (unless (member "xcolor" (TeX-style-list))
+ (TeX-run-style-hooks "color"))
(TeX-add-symbols
- ;; `TeX-arg-color' is provided by `color.el'.
- '("columncolor" TeX-arg-color
+ ;; `TeX-arg-color' is provided by color.el,
+ ;; `TeX-arg-xcolor' is provided by xcolor.el.
+ '("columncolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
+ (TeX-arg-xcolor)
+ (TeX-arg-color))
[ TeX-arg-length "Left overhang" ] [ TeX-arg-length "Right overhang" ] )
- '("rowcolor" TeX-arg-color
+ '("rowcolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
+ (TeX-arg-xcolor)
+ (TeX-arg-color))
[ TeX-arg-length "Left overhang" ] [ TeX-arg-length "Right overhang" ] )
- '("cellcolor" TeX-arg-color
+ '("cellcolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
+ (TeX-arg-xcolor)
+ (TeX-arg-color))
[ TeX-arg-length "Left overhang" ] [ TeX-arg-length "Right overhang" ] )
- '("arrayrulecolor" TeX-arg-color)
+ '("arrayrulecolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
+ (TeX-arg-xcolor)
+ (TeX-arg-color)))
- '("doublerulesepcolor" TeX-arg-color))
+ '("doublerulesepcolor" (TeX-arg-conditional (member "xcolor"
(TeX-style-list))
+ (TeX-arg-xcolor)
+ (TeX-arg-color))))
(LaTeX-add-lengths "minrowclearance")
diff --git a/style/currvita.el b/style/currvita.el
index a008753..bc6872d 100644
--- a/style/currvita.el
+++ b/style/currvita.el
@@ -1,6 +1,6 @@
;;; currvita.el --- AUCTeX style for `currvita.sty' (v0.9i)
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <esbati'at'gmx.de>
;; Maintainer: address@hidden
diff --git a/style/doc.el b/style/doc.el
index 3176368..57b3ee9 100644
--- a/style/doc.el
+++ b/style/doc.el
@@ -1,6 +1,6 @@
;;; doc.el --- AUCTeX style for `doc.sty'
-;; Copyright (C) 2004, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2008, 2016 Free Software Foundation, Inc.
;; Author: Frank K�ster <address@hidden>
;; Maintainer: address@hidden
@@ -31,7 +31,12 @@
(defun LaTeX-env-no-comment (environment)
"Insert ENVIRONMENT and make sure there is no commented empty line inside."
- (LaTeX-insert-environment environment)
+ (LaTeX-insert-environment environment
+ (when (string-equal environment "macro")
+ (let ((macroname (TeX-read-string
+ (TeX-argument-prompt nil nil
"Macro")
+ TeX-esc)))
+ (format "{%s}" macroname))))
(unless (TeX-active-mark)
(when (save-excursion
(beginning-of-line)
@@ -42,7 +47,7 @@
(defun LaTeX-doc-after-insert-macrocode (env start end)
"Make sure the macrocode environment is properly formatted after insertion."
- (when (TeX-member env '("macrocode" "macrocode*") 'string-equal)
+ (when (TeX-member env '("macro" "macrocode" "macrocode*") 'string-equal)
(save-excursion
(goto-char end)
(skip-chars-backward " \t")
@@ -59,37 +64,48 @@
"doc"
(lambda ()
(add-to-list (make-local-variable 'LaTeX-indent-environment-list)
- '("macrocode" current-indentation))
+ '("macrocode" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list
- '("macrocode*" current-indentation))
+ '("macrocode*" current-indentation) t)
+ (add-to-list 'LaTeX-indent-environment-list
+ '("macro" current-indentation) t)
(add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-doc-after-insert-macrocode
nil t)
(LaTeX-add-environments
"theglossary"
'("macrocode" LaTeX-env-no-comment)
'("macrocode*" LaTeX-env-no-comment)
- '("macro" "Macro"))
+ '("macro" LaTeX-env-no-comment))
(TeX-add-symbols
"EnableCrossrefs"
"DisableCrossrefs"
- "DoNotIndex"
+ '("DoNotIndex" t)
"DontCheckModules"
"CheckModules"
"Module"
- '("DescribeMacro" "Macro")
+ '("DescribeMacro" (TeX-arg-eval
+ (lambda ()
+ (let ((name (TeX-read-string
+ (TeX-argument-prompt optional nil "Macro")
+ TeX-esc)))
+ (format "%s" name)))))
'("DescribeEnv" "Environment")
"verbatim"
"verb"
- "parg"
- "oarg"
- "marg"
- "meta"
- "cmd"
+ '("parg" "Argument")
+ '("oarg" "Argument")
+ '("marg" "Argument")
+ '("meta" "Text")
+ '("cs" "Name")
+ '("cmd" (TeX-arg-eval
+ (lambda ()
+ (let ((name (TeX-read-string
+ (TeX-argument-prompt optional nil "Name")
+ TeX-esc)))
+ (format "%s" name)))))
"makelabel"
- "MacroFont"
- "MacroFont"
- "AltMacroFont"
- "AltMacroFont"
+ '("MacroFont" t)
+ '("AltMacroFont" t)
"PrintMacroName"
"PrintDescribeMacro"
"PrintDescribeEnv"
@@ -126,7 +142,7 @@
"GlossaryParms"
"PrintChanges"
"AlsoImplementation"
- "StopEventually"
+ '("StopEventually" t)
"OnlyDescription"
"Finale"
"IndexInput"
@@ -142,16 +158,34 @@
"CodelineIndex"
"PageIndex"
"theCodelineNo"
- "theCodelineNo"
"DocstyleParms"
"MakePercentIgnore"
"MakePercentComment"
- "DocInput"
- "DocInclude"
+ '("DocInput"
+ (TeX-arg-eval
+ (lambda ()
+ (let ((file (file-relative-name
+ (read-file-name
+ "File to input: " nil nil nil nil
+ (lambda (x)
+ (string-match "\\.fdd$\\|\\.dtx$" x)))
+ (TeX-master-directory))))
+ (format "%s" file)))))
+ '("DocInclude"
+ (TeX-arg-eval
+ (lambda ()
+ (let ((file (file-relative-name
+ (read-file-name
+ "File to include: " nil nil nil nil
+ (lambda (x)
+ (string-match "\\.fdd$\\|\\.dtx$" x)))
+ (TeX-master-directory))))
+ (format "%s" file)))))
"GetFileInfo"
"filename"
"fileinfo")
- (TeX-run-style-hooks "shortvrb"))
+ (TeX-run-style-hooks "shortvrb")
+ (LaTeX-add-lengths "MacrocodeTopsep" "MacroTopsep" "MacroIndent"))
LaTeX-dialect)
;; Local Variables:
diff --git a/style/fancyvrb.el b/style/fancyvrb.el
index 8334708..3404365 100644
--- a/style/fancyvrb.el
+++ b/style/fancyvrb.el
@@ -1,9 +1,9 @@
;;; fancyvrb.el --- AUCTeX style for `fancyvrb.sty' version 2.8.
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2014, 2016 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.
@@ -165,11 +165,11 @@
(add-to-list 'LaTeX-verbatim-environments-local "SaveVerbatim")
(add-to-list 'LaTeX-verbatim-environments-local "VerbatimOut")
(make-local-variable 'LaTeX-indent-environment-list)
- (add-to-list 'LaTeX-indent-environment-list '("Verbatim"
current-indentation))
- (add-to-list 'LaTeX-indent-environment-list '("BVerbatim"
current-indentation))
- (add-to-list 'LaTeX-indent-environment-list '("LVerbatim"
current-indentation))
- (add-to-list 'LaTeX-indent-environment-list '("SaveVerbatim"
current-indentation))
- (add-to-list 'LaTeX-indent-environment-list '("VerbatimOut"
current-indentation))
+ (add-to-list 'LaTeX-indent-environment-list '("Verbatim"
current-indentation) t)
+ (add-to-list 'LaTeX-indent-environment-list '("BVerbatim"
current-indentation) t)
+ (add-to-list 'LaTeX-indent-environment-list '("LVerbatim"
current-indentation) t)
+ (add-to-list 'LaTeX-indent-environment-list '("SaveVerbatim"
current-indentation) t)
+ (add-to-list 'LaTeX-indent-environment-list '("VerbatimOut"
current-indentation) t)
(add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "Verb")
diff --git a/style/filecontents.el b/style/filecontents.el
index 256c214..639e1f4 100644
--- a/style/filecontents.el
+++ b/style/filecontents.el
@@ -1,6 +1,6 @@
;;; filecontents.el --- AUCTeX style for `filecontents.sty'
-;; Copyright (C) 2013--2015 Free Software Foundation, Inc.
+;; Copyright (C) 2013--2016 Free Software Foundation, Inc.
;; Author: Mads Jensen <address@hidden>
;; Maintainer: address@hidden
@@ -42,9 +42,9 @@
(make-local-variable 'LaTeX-indent-environment-list)
(add-to-list 'LaTeX-indent-environment-list
- '("filecontents" current-indentation))
+ '("filecontents" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list
- '("filecontents*" current-indentation)))
+ '("filecontents*" current-indentation) t))
LaTeX-dialect)
(defun LaTeX-env-filecontents (environment)
diff --git a/style/hyperref.el b/style/hyperref.el
index c57c188..973796a 100644
--- a/style/hyperref.el
+++ b/style/hyperref.el
@@ -267,10 +267,11 @@
(LaTeX-add-environments
'("Form"))
- ;; Do not indent the content of the "Form"-env; it is odd if the
- ;; whole document is indented.
+ ;; Do not indent the content of the "Form"-env; it is odd if the whole
+ ;; document is indented. Append to `LaTeX-indent-environment-list' in order
+ ;; not to override custom settings.
(make-local-variable 'LaTeX-indent-environment-list)
- (add-to-list 'LaTeX-indent-environment-list '("Form" current-indentation))
+ (add-to-list 'LaTeX-indent-environment-list '("Form" current-indentation) t)
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
diff --git a/style/ifluatex.el b/style/ifluatex.el
index 48e1bd6..cddd9fd 100644
--- a/style/ifluatex.el
+++ b/style/ifluatex.el
@@ -1,6 +1,6 @@
;;; ifluatex.el --- AUCTeX style for `ifluatex.sty' version 1.3.
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2016 Free Software Foundation, Inc.
;; Author: Davide G. M. Salvetti <address@hidden>
;; Maintainer: address@hidden
@@ -43,11 +43,15 @@
(TeX-arg-literal "\n\\else%\n\\fi%"))
'("luatexversion" 0)
'("luatexrevision" 0))
-
(TeX-declare-expert-macros
"ifluatex"
"ifluatex" "luatexversion" "luatexrevision")
+ ;; This package is used to make it possible to compile a document with both
+ ;; LuaTeX and base TeX engines. By setting `TeX-check-engine-list' to nil
+ ;; we ignore engine restrictions posed by other packages.
+ (setq TeX-check-engine-list nil)
+
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("luatexversion")
diff --git a/style/listings.el b/style/listings.el
index 0dff6ec..2d50b2c 100644
--- a/style/listings.el
+++ b/style/listings.el
@@ -1,6 +1,6 @@
;;; listings.el --- AUCTeX style for `listings.sty'
-;; Copyright (C) 2004, 2005, 2009, 2013, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2009, 2013-2016 Free Software Foundation, Inc.
;; Author: Ralf Angeli <address@hidden>
;; Maintainer: address@hidden
@@ -290,7 +290,7 @@ with user-defined values via the \"lstdefinestyle\" macro."
(list env (string-to-number args))))
(t ; No args
(add-to-list 'LaTeX-auto-environment (list env))))
- (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation))
+ (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation)
t)
(add-to-list 'LaTeX-verbatim-environments-local env)))
(when (LaTeX-listings-lstdefinestyle-list)
(LaTeX-listings-update-style-key)))
@@ -342,9 +342,8 @@ with user-defined values via the \"lstdefinestyle\" macro."
'("lstlisting" LaTeX-env-args
[TeX-arg-key-val LaTeX-listings-key-val-options-local]))
;; Filling
- (make-local-variable 'LaTeX-indent-environment-list)
- (add-to-list 'LaTeX-indent-environment-list
- '("lstlisting" current-indentation))
+ (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
+ '("lstlisting" current-indentation) t)
(add-to-list 'LaTeX-verbatim-environments-local "lstlisting")
(add-to-list 'LaTeX-verbatim-macros-with-delims-local "lstinline")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "lstinline")
diff --git a/style/longtable.el b/style/longtable.el
index 7401c8d..a9659dc 100644
--- a/style/longtable.el
+++ b/style/longtable.el
@@ -1,9 +1,9 @@
;;; longtable.el --- AUCTeX style for `longtable.sty'.
-;; Copyright (C) 2013--2015 Free Software Foundation, Inc.
+;; Copyright (C) 2013--2016 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.
@@ -75,9 +75,10 @@
;; This parameter is set with \setcounter
(LaTeX-add-counters "LTchunksize")
- ;; Use the enhanced table formatting
- (add-to-list 'LaTeX-indent-environment-list
- '("longtable" LaTeX-indent-tabular))
+ ;; Use the enhanced table formatting. Append to
+ ;; `LaTeX-indent-environment-list' in order not to override custom settings.
+ (add-to-list (make-variable-buffer-local 'LaTeX-indent-environment-list)
+ '("longtable" LaTeX-indent-tabular) t)
;; Append longtable to `LaTeX-label-alist', in order not to override
possible
;; custome values.
diff --git a/style/ltx-base.el b/style/ltx-base.el
index a586a7a..12f9234 100644
--- a/style/ltx-base.el
+++ b/style/ltx-base.el
@@ -1,6 +1,6 @@
;;; ltx-base.el --- AUCTeX style for basic LaTeX commands.
-;; Copyright (C) 2004 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2016 Free Software Foundation, Inc.
;; Author: Frank K�ster <address@hidden>
;; Maintainer: address@hidden
@@ -48,20 +48,20 @@
'("DeclareOption" "option" t)
;; would be great if DeclareOption RET * RET would give
;; \DeclareOption*!
- "DeclareOption*"
+ '("DeclareOption*" t)
'("CurrentOption" 0)
'("PassOptionsToPackage" "option list" "package")
'("ExecuteOptions" "option list")
- "ProcessOptions"
+ '("ProcessOptions" (TeX-arg-literal "\\relax"))
"ProcessOptions*"
'("OptionNotUsed" 0)
;; candidate for opt/mand toggling
'("RequirePackage" [ "option list" ] "package" [ "release" ])
'("LoadClass" [ "option list" ] "class" [ "release" ])
- "AtEndOfPackage"
- "AtEndOfClass"
- "AtBeginDocument"
- "AtEndDocument"
+ '("AtEndOfPackage" t)
+ '("AtEndOfClass" t)
+ '("AtBeginDocument" t)
+ '("AtEndDocument" t)
'("IfFileExists" "filename" 2)
'("InputIfFileExists" "filename" 2)
'("PackageWarning" "name" t)
diff --git a/style/minted.el b/style/minted.el
index d829e93..a4f413d 100644
--- a/style/minted.el
+++ b/style/minted.el
@@ -1,6 +1,6 @@
;;; minted.el --- AUCTeX style for `minted.sty'
-;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
;; Author: Tassilo Horn <address@hidden>
;; Maintainer: address@hidden
@@ -141,8 +141,8 @@
(add-to-list 'LaTeX-auto-environment
(list env* 'LaTeX-env-args
'(TeX-arg-key-val LaTeX-minted-key-val-options)))
- (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation))
- (add-to-list 'LaTeX-indent-environment-list `(,env* current-indentation))
+ (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation)
t)
+ (add-to-list 'LaTeX-indent-environment-list `(,env* current-indentation)
t)
(add-to-list 'LaTeX-verbatim-environments-local env)
(add-to-list 'LaTeX-verbatim-environments-local env*)))
;; \newmint{foo}{opts} => \foo|code|
@@ -210,9 +210,8 @@
(TeX-auto-add-regexp LaTeX-minted-newmintedfile-regexp)
;; Filling
- (make-local-variable 'LaTeX-indent-environment-list)
- (add-to-list 'LaTeX-indent-environment-list
- '("minted" current-indentation))
+ (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
+ '("minted" current-indentation) t)
(add-to-list 'LaTeX-verbatim-environments-local "minted")
;; FIXME: That doesn't work because \mintinline has 2 args and only the
;; second argument is verbatim.
diff --git a/style/ntheorem.el b/style/ntheorem.el
index 068f40d..2cfd4f5 100644
--- a/style/ntheorem.el
+++ b/style/ntheorem.el
@@ -1,6 +1,6 @@
;;; ntheorem.el --- AUCTeX style for `ntheorem.sty' (v1.33)
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <esbati'at'gmx.de>
;; Maintainer: address@hidden
@@ -289,8 +289,10 @@ make them available as new environments. Update
(TeX-arg-eval
(lambda ()
(let ((color
- (if (fboundp 'LaTeX-color-definecolor-list)
- (completing-read "color: " (LaTeX-color-definecolor-list))
+ (if (or (member "xcolor" (TeX-style-list))
+ (member "color" (TeX-style-list)))
+ (completing-read "color: " (or
(LaTeX-xcolor-definecolor-list)
+
(LaTeX-color-definecolor-list)))
(TeX-read-string "color: "))))
(format "%s" color)))))
diff --git a/style/tabularx.el b/style/tabularx.el
index 5cfebc8..63a1272 100644
--- a/style/tabularx.el
+++ b/style/tabularx.el
@@ -1,6 +1,6 @@
;;; tabularx.el --- AUCTeX style for the tabularx package.
-;; Copyright (C) 2009, 2013, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2013-2016 Free Software Foundation, Inc.
;; Author: Ralf Angeli <address@hidden>
;; Maintainer: address@hidden
@@ -39,9 +39,10 @@
(lambda ()
;; Make tabularx the default tabular environment
(setq LaTeX-default-tabular-environment "tabularx")
- ;; Use the enhanced tabular indentation
- (add-to-list 'LaTeX-indent-environment-list
- '("tabularx" LaTeX-indent-tabular))
+ ;; Use the enhanced tabular indentation. Append to
+ ;; `LaTeX-indent-environment-list' in order not to override custom settings.
+ (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
+ '("tabularx" LaTeX-indent-tabular) t)
;; New symbols
(TeX-add-symbols
"tracingtabularx"
diff --git a/style/tabulary.el b/style/tabulary.el
index 30e3a64..289401e 100644
--- a/style/tabulary.el
+++ b/style/tabulary.el
@@ -1,6 +1,6 @@
;;; tabulary.el --- AUCTeX style for the tabulary package.
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2016 Free Software Foundation, Inc.
;; Author: Mads Jensen <address@hidden>
;; Maintainer: address@hidden
@@ -39,8 +39,9 @@
(lambda ()
;; Make tabulary the default tabular environment
(setq LaTeX-default-tabular-environment "tabulary")
- ;; Use the enhanced tabular indentation
- (add-to-list 'LaTeX-indent-environment-list
+ ;; Use the enhanced tabular indentation. Append to
+ ;; `LaTeX-indent-environment-list' in order not to override custom settings.
+ (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
'("tabulary" LaTeX-indent-tabular))
;; New symbols
(TeX-add-symbols
diff --git a/style/textpos.el b/style/textpos.el
index c2f3e19..9c27ddd 100644
--- a/style/textpos.el
+++ b/style/textpos.el
@@ -1,6 +1,6 @@
;;; textpos.el --- AUCTeX style for `textpos.sty' version v1.7j
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <esbati'at'gmx.de>
;; Maintainer: address@hidden
@@ -65,7 +65,7 @@ them."
"textpos"
(lambda ()
- (TeX-run-style-hooks "everyshi" "color")
+ (TeX-run-style-hooks "everyshi")
(LaTeX-add-environments
;; \begin{textblock}{<hsize>}[<ho>,<vo>](<hpos>,<vpos>) ... \end{textblock}
@@ -84,14 +84,16 @@ them."
(TeX-arg-eval
(lambda ()
(let ((color (completing-read "Color name: "
- (LaTeX-color-definecolor-list))))
+ (or (LaTeX-xcolor-definecolor-list)
+ (LaTeX-color-definecolor-list)))))
(format "%s" color)))))
'("textblockrulecolour"
(TeX-arg-eval
(lambda ()
(let ((color (completing-read "Color name: "
- (LaTeX-color-definecolor-list))))
+ (or (LaTeX-xcolor-definecolor-list)
+ (LaTeX-color-definecolor-list)))))
(format "%s" color)))))
'("TPshowboxestrue")
diff --git a/style/tikz.el b/style/tikz.el
index be93110..4a2fc03 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -42,21 +42,21 @@ CLOSE\". If OPEN or CLOSE are nil, set them to
`LaTeX-optop' and
(concat open arg close)
""))
-(defun TeX-TikZ-arg-rect-point (_ignored)
+(defun TeX-TikZ-arg-rect-point (_ignored &optional prefix)
"Prompt the user for a point on the Cartesian plane.
Ask the user for an X and Y coordinate, and return the string
\"(X,Y)\"."
(let ((x (TeX-read-string (TeX-argument-prompt nil nil "X-coordinate")))
(y (TeX-read-string (TeX-argument-prompt nil nil "Y-coordinate"))))
- (concat " (" x ", " y") ")))
+ (concat " " prefix "(" x ", " y") ")))
-(defun TeX-TikZ-arg-polar-point (_ignored)
+(defun TeX-TikZ-arg-polar-point (_ignored &optional prefix)
"Prompt the user for a point on the polar plane.
Ask the user for r and theta values, and return the string
\"(THETA:R)\"."
(let ((r (TeX-read-string (TeX-argument-prompt nil nil "R")))
(theta (TeX-read-string (TeX-argument-prompt nil nil "Theta"))))
- (concat " (" theta ":" r ") ")))
+ (concat " " prefix "(" theta ":" r ") ")))
(defun TeX-TikZ-arg-options (optional)
"Prompt the user for options to a TikZ macro.
@@ -94,27 +94,36 @@ string \"node[OPTIONS](NAME){TEXT}\"."
(label (TeX-TikZ-arg-label nil)))
(concat "node" options name label " ")))
-(defun TeX-TikZ-get-arg-type (types &optional prompt)
+(defun TeX-TikZ-get-arg-type (types prompt)
"Prompt the user for an argument type.
-TYPES is a list of possible types that the user can specify. If
-PROMPT is non-nil use that prompt instead."
- (let ((completion-ignore-case t)
- (prompt (if prompt
- prompt
- "Next argument type (RET to finish): ")))
+TYPES is a list of possible types that the user can specify. Use
+PROMPT as the prompt for input."
+ (let ((completion-ignore-case t))
(completing-read prompt types nil t)))
-(defun TeX-TikZ-single-macro-arg (function-alist &optional prompt)
+(defun TeX-TikZ-single-macro-arg (function-alist prompt &optional optional)
"Prompt the user for a single argument to compose a TikZ macro.
FUNCTION-ALIST is a mapping of argument-types to functions. The
user is prompted for the argument type, the chosen function is
then called and the value returned. PROMPT is used as the prompt
-for the argument type."
- (let* ((argument-types (mapcar 'car function-alist))
- (argument-type (TeX-TikZ-get-arg-type argument-types prompt)))
- (funcall
- (cadr (assoc argument-type function-alist))
- argument-type)))
+for the argument type. When OPTIONAL is non-nil, add \"\" to
+FUNCTION-ALIST with a mapping to `identity', permitting an
+optional input."
+ (let* ((selected-argument-type (TeX-TikZ-get-arg-type function-alist prompt))
+ (fn-alist-with-optional-elm (if optional
+ `(,@function-alist ("" identity))
+ function-alist))
+ (selected-mapping (assoc selected-argument-type
+ fn-alist-with-optional-elm)))
+
+ (eval
+ ;; Build the form we wish to evaluate. This will be the function
+ ;; to be called (the second element in the assoc element),
+ ;; followed by the type name (the first element), followed by any
+ ;; other elements in the list as extra arguments.
+ `(,(cadr selected-mapping)
+ ,(car selected-mapping)
+ ,@(cddr selected-mapping)))))
(defun TeX-TikZ-macro-arg (function-alist)
@@ -125,10 +134,8 @@ choose form the cars in FUNCTION-ALIST and the appropriate
function is then called. If the user enters \"\", then the macro
is finished."
(let* ((options (TeX-TikZ-arg-options t))
- ;; For the iterative version, we need to add "" to the
- ;; function-alist, allowing the user to end the macro.
- (function-alist-iterative `(,@function-alist ("" identity)))
- (string-to-insert (TeX-TikZ-single-macro-arg
function-alist-iterative)))
+ (prompt "Next argument type (RET to finish): ")
+ (string-to-insert (TeX-TikZ-single-macro-arg function-alist prompt
t)))
;; Insert the macro options.
(insert options " ")
@@ -138,7 +145,7 @@ is finished."
(while (not (string= string-to-insert ""))
(insert string-to-insert)
(setq string-to-insert
- (TeX-TikZ-single-macro-arg function-alist-iterative)))
+ (TeX-TikZ-single-macro-arg function-alist prompt t)))
;; Finish the macro.
(insert ";")))
@@ -157,44 +164,89 @@ them as a list of strings, dropping the '()'."
(let* ((env-end (save-excursion
(LaTeX-find-matching-end)
(point)))
- (matches ()))
+ (matches))
;; TODO: Handle cases where we are in a nested environment, \scope
;; for example.
(save-excursion
(LaTeX-find-matching-begin)
(save-match-data
(while (re-search-forward TeX-TikZ-point-name-regexp env-end t)
- (add-to-list 'matches (match-string 1)))))
+ (push (match-string 1) matches))))
matches))
-(defun TeX-TikZ-arg-named-point (_ignored)
+(defun TeX-TikZ-arg-named-point (_ignored &optional prefix)
"Prompt the user for the name of a previous named-point."
(let ((point-name (completing-read "Point name: "
(TeX-TikZ-find-named-points))))
- (concat " (" point-name ") ")))
+ (concat " " prefix "(" point-name ") ")))
+
+(defun TeX-TikZ-arg-circle (_ignored)
+ "Prompt the user for the arguments to the circle command."
+ (let ((options (TeX-TikZ-arg-options t)))
+ (concat "circle" options)))
+
+(defun TeX-TikZ-arg-arc (_ignored)
+ "Prompt the user for the arguments to the arc command."
+ (let ((options (TeX-TikZ-arg-options t)))
+ (concat "arc" options)))
+
+(defun TeX-TikZ-arg-bend (optional)
+ "Prompt the user for a bend argument.
+If OPTIONAL is non-nil and the user doesn't provide a point,
+ return \"\"."
+ (let ((point
+ (TeX-TikZ-single-macro-arg TeX-TikZ-point-function-map
+ (TeX-argument-prompt optional nil "Bend
point")
+ optional)))
+ (if (string= point "")
+ point
+ (concat " bend" point))))
+
+(defun TeX-TikZ-arg-parabola (_ignored)
+ "Prompt the user for the arguments to the parabola command."
+ (let ((options (TeX-TikZ-arg-options t))
+ (bend (TeX-TikZ-arg-bend t)))
+ (concat "parabola" options bend)))
+
+(defun TeX-TikZ-arg-grid (_ignored)
+ "Prompt the user for the arguments to the grid command."
+ (let ((options (TeX-TikZ-arg-options t)))
+ (concat "grid" options)))
(defconst TeX-TikZ-point-function-map
'(("Rect Point" TeX-TikZ-arg-rect-point)
("Polar Point" TeX-TikZ-arg-polar-point)
("Named Point" TeX-TikZ-arg-named-point))
- "An alist of point specification types and their functions." )
+ "An alist of point specification types and their functions.")
+
+(defconst TeX-TikZ-relative-point-function-map
+ (apply 'append (mapcar
+ (lambda (point-map)
+ (let ((key (car point-map))
+ (value (cadr point-map)))
+ `((,(concat "+" key) ,value "+")
+ (,(concat "++" key) ,value "++"))))
+ TeX-TikZ-point-function-map))
+ "`TeX-TikZ-point-function-map' with \"+\" and \"++\" as a
+prefix.")
(defconst TeX-TikZ-path-connector-function-map
- (let ((connectors '("--" "|-" "-|")))
- (apply 'append (mapcar
- (lambda (connector)
- `((,connector identity)
- (,(concat connector " +") identity)
- (,(concat connector " ++") identity)))
- connectors)))
- "An alist of path connectors.
-A set of base connectors along with variants that have \" +\" and
-\" ++\" appended to them, mapping to the identity function.")
+ '(("--" identity)
+ ("|-" identity)
+ ( "-|" identity)
+ ("sin" identity)
+ ("cos" identity))
+ "An alist of path connectors.")
(defconst TeX-TikZ-draw-arg-function-map
`(,@TeX-TikZ-point-function-map
+ ,@TeX-TikZ-relative-point-function-map
,@TeX-TikZ-path-connector-function-map
- ("Node" TeX-TikZ-arg-node))
+ ("Node" TeX-TikZ-arg-node)
+ ("Circle" TeX-TikZ-arg-circle)
+ ("Arc" TeX-TikZ-arg-arc)
+ ("Parabola" TeX-TikZ-arg-parabola)
+ ("Grid" TeX-TikZ-arg-grid))
"An alist of argument names and functoins for TikZ's \draw.")
(defun TeX-TikZ-draw-arg (_ignored)
diff --git a/style/xcolor.el b/style/xcolor.el
new file mode 100644
index 0000000..2466b12
--- /dev/null
+++ b/style/xcolor.el
@@ -0,0 +1,628 @@
+;; xcolor.el --- AUCTeX style for `xcolor.sty' (v2.12)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <esbati'at'gmx.de>
+;; Maintainer: address@hidden
+;; Created: 2015-07-04
+;; 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 `xcolor.sty' (v2.12) from 2016/05/11.
+;; `xcolor.sty' is part of TeXLive.
+
+;; `xcolor.sty' and `color.sty' share many command namens, but the
+;; number of arguments is not always identical -- `xcolor.sty'
+;; commands take more arguments. In order to make the commands and
+;; font-locking work correctly, we follow this strategy: If
+;; `xcolor.sty' is loaded after `color.sty', everything works fine.
+;; For the way around, we guard the definitions in `color.sty' with:
+;;
+;; (unless (member "xcolor" (TeX-TeX-style-list))
+;; (<define stuff from color.sty<))
+;;
+;; to make sure that we define stuff `color.sty' only if `xcolor.sty'
+;; is not already loaded.
+
+;;; Code:
+
+(defvar LaTeX-xcolor-core-color-models
+ '("rgb" "cmy" "cmyk" "hsb" "gray")
+ "List of core color models provided by xcolor.sty.")
+
+(defvar LaTeX-xcolor-num-color-models
+ '("RGB" "HTML" "HSB" "Gray" "HsB" "tHsB" "wave")
+ "List of integer and decimal color models provided by xcolor.sty.")
+
+(defvar LaTeX-xcolor-pseudo-color-models
+ '("named")
+ "List of pseudo color models provided by xcolor.sty.")
+
+(defvar LaTeX-xcolor-type-color-models
+ '("named" "ps")
+ "List of type color models provided by xcolor.sty.")
+
+(defvar LaTeX-xcolor-base-colors
+ '("red" "green" "blue" "cyan" "magenta" "yellow" "black"
+ "gray" "white" "darkgray" "lightgray" "brown" "lime" "olive"
+ "orange" "pink" "purple" "teal" "violet")
+ "List of colors defined and always available from xcolor.sty.")
+
+(defvar LaTeX-xcolor-dvipsnames-colors
+ '("Apricot" "Aquamarine" "Bittersweet" "Black"
+ "Blue" "BlueGreen" "BlueViolet" "BrickRed"
+ "Brown" "BurntOrange" "CadetBlue" "CarnationPink"
+ "Cerulean" "CornflowerBlue" "Cyan" "Dandelion"
+ "DarkOrchid" "Emerald" "ForestGreen" "Fuchsia"
+ "Goldenrod" "Gray" "Green" "GreenYellow"
+ "JungleGreen" "Lavender" "LimeGreen" "Magenta"
+ "Mahogany" "Maroon" "Melon" "MidnightBlue"
+ "Mulberry" "NavyBlue" "OliveGreen" "Orange"
+ "OrangeRed" "Orchid" "Peach" "Periwinkle"
+ "PineGreen" "Plum" "ProcessBlue" "Purple"
+ "RawSienna" "Red" "RedOrange" "RedViolet"
+ "Rhodamine" "RoyalBlue" "RoyalPurple" "RubineRed"
+ "Salmon" "SeaGreen" "Sepia" "SkyBlue"
+ "SpringGreen" "Tan" "TealBlue" "Thistle"
+ "Turquoise" "Violet" "VioletRed" "White"
+ "WildStrawberry" "Yellow" "YellowGreen" "YellowOrange")
+ "List of colors defined by package option dvipsnames from xcolor.sty.")
+
+(defvar LaTeX-xcolor-svgnames-colors
+ '("AliceBlue" "DarkTurquoise" "LightSalmon" "PaleVioletRed"
+ "AntiqueWhite" "DarkViolet" "LightSeaGreen" "PapayaWhip"
+ "Aqua" "DeepPink" "LightSkyBlue" "PeachPuff"
+ "Aquamarine" "DeepSkyBlue" "LightSlateBlue" "Peru"
+ "Azure" "DimGray" "LightSlateGray" "Pink"
+ "Beige" "DimGrey" "LightSlateGrey" "Plum"
+ "Bisque" "DodgerBlue" "LightSteelBlue" "PowderBlue"
+ "Black" "FireBrick" "LightYellow" "Purple"
+ "BlanchedAlmond" "FloralWhite" "Lime" "Red"
+ "Blue" "ForestGreen" "LimeGreen" "RosyBrown"
+ "BlueViolet" "Fuchsia" "Linen" "RoyalBlue"
+ "Brown" "Gainsboro" "Magenta" "SaddleBrown"
+ "BurlyWood" "GhostWhite" "Maroon" "Salmon"
+ "CadetBlue" "Gold" "MediumAquamarine" "SandyBrown"
+ "Chartreuse" "Goldenrod" "MediumBlue" "SeaGreen"
+ "Chocolate" "Gray" "MediumOrchid" "Seashell"
+ "Coral" "Green" "MediumPurple" "Sienna"
+ "CornflowerBlue" "GreenYellow" "MediumSeaGreen" "Silver"
+ "Cornsilk" "Grey" "MediumSlateBlue" "SkyBlue"
+ "Crimson" "Honeydew" "MediumSpringGreen" "SlateBlue"
+ "Cyan" "HotPink" "MediumTurquoise" "SlateGray"
+ "DarkBlue" "IndianRed" "MediumVioletRed" "SlateGrey"
+ "DarkCyan" "Indigo" "MidnightBlue" "Snow"
+ "DarkGoldenrod" "Ivory" "MintCream" "SpringGreen"
+ "DarkGray" "Khaki" "MistyRose" "SteelBlue"
+ "DarkGreen" "Lavender" "Moccasin" "Tan"
+ "DarkGrey" "LavenderBlush" "NavajoWhite" "Teal"
+ "DarkKhaki" "LawnGreen" "Navy" "Thistle"
+ "DarkMagenta" "LemonChiffon" "NavyBlue" "Tomato"
+ "DarkOliveGreen" "LightBlue" "OldLace" "Turquoise"
+ "DarkOrange" "LightCoral" "Olive" "Violet"
+ "DarkOrchid" "LightCyan" "OliveDrab" "VioletRed"
+ "DarkRed" "LightGoldenrod" "Orange" "Wheat"
+ "DarkSalmon" "LightGoldenrodYellow" "OrangeRed" "White"
+ "DarkSeaGreen" "LightGray" "Orchid" "WhiteSmoke"
+ "DarkSlateBlue" "LightGreen" "PaleGoldenrod" "Yellow"
+ "DarkSlateGray" "LightGrey" "PaleGreen" "YellowGreen"
+ "DarkSlateGrey" "LightPink" "PaleTurquoise")
+ "List of colors defined by package option svgnames from xcolor.sty.")
+
+(defvar LaTeX-xcolor-x11names-colors
+ '("AntiqueWhite1" "DeepSkyBlue1" "LightYellow1" "RoyalBlue1"
+ "AntiqueWhite2" "DeepSkyBlue2" "LightYellow2" "RoyalBlue2"
+ "AntiqueWhite3" "DeepSkyBlue3" "LightYellow3" "RoyalBlue3"
+ "AntiqueWhite4" "DeepSkyBlue4" "LightYellow4" "RoyalBlue4"
+ "Aquamarine1" "DodgerBlue1" "Magenta1" "Salmon1"
+ "Aquamarine2" "DodgerBlue2" "Magenta2" "Salmon2"
+ "Aquamarine3" "DodgerBlue3" "Magenta3" "Salmon3"
+ "Aquamarine4" "DodgerBlue4" "Magenta4" "Salmon4"
+ "Azure1" "Firebrick1" "Maroon1" "SeaGreen1"
+ "Azure2" "Firebrick2" "Maroon2" "SeaGreen2"
+ "Azure3" "Firebrick3" "Maroon3" "SeaGreen3"
+ "Azure4" "Firebrick4" "Maroon4" "SeaGreen4"
+ "Bisque1" "Gold1" "MediumOrchid1" "Seashell1"
+ "Bisque2" "Gold2" "MediumOrchid2" "Seashell2"
+ "Bisque3" "Gold3" "MediumOrchid3" "Seashell3"
+ "Bisque4" "Gold4" "MediumOrchid4" "Seashell4"
+ "Blue1" "Goldenrod1" "MediumPurple1" "Sienna1"
+ "Blue2" "Goldenrod2" "MediumPurple2" "Sienna2"
+ "Blue3" "Goldenrod3" "MediumPurple3" "Sienna3"
+ "Blue4" "Goldenrod4" "MediumPurple4" "Sienna4"
+ "Brown1" "Green1" "MistyRose1" "SkyBlue1"
+ "Brown2" "Green2" "MistyRose2" "SkyBlue2"
+ "Brown3" "Green3" "MistyRose3" "SkyBlue3"
+ "Brown4" "Green4" "MistyRose4" "SkyBlue4"
+ "Burlywood1" "Honeydew1" "NavajoWhite1" "SlateBlue1"
+ "Burlywood2" "Honeydew2" "NavajoWhite2" "SlateBlue2"
+ "Burlywood3" "Honeydew3" "NavajoWhite3" "SlateBlue3"
+ "Burlywood4" "Honeydew4" "NavajoWhite4" "SlateBlue4"
+ "CadetBlue1" "HotPink1" "OliveDrab1" "SlateGray1"
+ "CadetBlue2" "HotPink2" "OliveDrab2" "SlateGray2"
+ "CadetBlue3" "HotPink3" "OliveDrab3" "SlateGray3"
+ "CadetBlue4" "HotPink4" "OliveDrab4" "SlateGray4"
+ "Chartreuse1" "IndianRed1" "Orange1" "Snow1"
+ "Chartreuse2" "IndianRed2" "Orange2" "Snow2"
+ "Chartreuse3" "IndianRed3" "Orange3" "Snow3"
+ "Chartreuse4" "IndianRed4" "Orange4" "Snow4"
+ "Chocolate1" "Ivory1" "OrangeRed1" "SpringGreen1"
+ "Chocolate2" "Ivory2" "OrangeRed2" "SpringGreen2"
+ "Chocolate3" "Ivory3" "OrangeRed3" "SpringGreen3"
+ "Chocolate4" "Ivory4" "OrangeRed4" "SpringGreen4"
+ "Coral1" "Khaki1" "Orchid1" "SteelBlue1"
+ "Coral2" "Khaki2" "Orchid2" "SteelBlue2"
+ "Coral3" "Khaki3" "Orchid3" "SteelBlue3"
+ "Coral4" "Khaki4" "Orchid4" "SteelBlue4"
+ "Cornsilk1" "LavenderBlush1" "PaleGreen1" "Tan1"
+ "Cornsilk2" "LavenderBlush2" "PaleGreen2" "Tan2"
+ "Cornsilk3" "LavenderBlush3" "PaleGreen3" "Tan3"
+ "Cornsilk4" "LavenderBlush4" "PaleGreen4" "Tan4"
+ "Cyan1" "LemonChiffon1" "PaleTurquoise1" "Thistle1"
+ "Cyan2" "LemonChiffon2" "PaleTurquoise2" "Thistle2"
+ "Cyan3" "LemonChiffon3" "PaleTurquoise3" "Thistle3"
+ "Cyan4" "LemonChiffon4" "PaleTurquoise4" "Thistle4"
+ "DarkGoldenrod1" "LightBlue1" "PaleVioletRed1" "Tomato1"
+ "DarkGoldenrod2" "LightBlue2" "PaleVioletRed2" "Tomato2"
+ "DarkGoldenrod3" "LightBlue3" "PaleVioletRed3" "Tomato3"
+ "DarkGoldenrod4" "LightBlue4" "PaleVioletRed4" "Tomato4"
+ "DarkOliveGreen1" "LightCyan1" "PeachPuff1" "Turquoise1"
+ "DarkOliveGreen2" "LightCyan2" "PeachPuff2" "Turquoise2"
+ "DarkOliveGreen3" "LightCyan3" "PeachPuff3" "Turquoise3"
+ "DarkOliveGreen4" "LightCyan4" "PeachPuff4" "Turquoise4"
+ "DarkOrange1" "LightGoldenrod1" "Pink1" "VioletRed1"
+ "DarkOrange2" "LightGoldenrod2" "Pink2" "VioletRed2"
+ "DarkOrange3" "LightGoldenrod3" "Pink3" "VioletRed3"
+ "DarkOrange4" "LightGoldenrod4" "Pink4" "VioletRed4"
+ "DarkOrchid1" "LightPink1" "Plum1" "Wheat1"
+ "DarkOrchid2" "LightPink2" "Plum2" "Wheat2"
+ "DarkOrchid3" "LightPink3" "Plum3" "Wheat3"
+ "DarkOrchid4" "LightPink4" "Plum4" "Wheat4"
+ "DarkSeaGreen1" "LightSalmon1" "Purple1" "Yellow1"
+ "DarkSeaGreen2" "LightSalmon2" "Purple2" "Yellow2"
+ "DarkSeaGreen3" "LightSalmon3" "Purple3" "Yellow3"
+ "DarkSeaGreen4" "LightSalmon4" "Purple4" "Yellow4"
+ "DarkSlateGray1" "LightSkyBlue1" "Red1" "Gray0"
+ "DarkSlateGray2" "LightSkyBlue2" "Red2" "Green0"
+ "DarkSlateGray3" "LightSkyBlue3" "Red3" "Grey0"
+ "DarkSlateGray4" "LightSkyBlue4" "Red4" "Maroon0"
+ "DeepPink1" "LightSteelBlue1" "RosyBrown1" "Purple0"
+ "DeepPink2" "LightSteelBlue2" "RosyBrown2"
+ "DeepPink3" "LightSteelBlue3" "RosyBrown3"
+ "DeepPink4" "LightSteelBlue4" "RosyBrown4")
+ "List of colors defined by package option x11names from xcolor.sty.")
+
+(defvar LaTeX-xcolor-color-models
+ (append LaTeX-xcolor-core-color-models
+ LaTeX-xcolor-num-color-models
+ LaTeX-xcolor-pseudo-color-models)
+ "Combine three variables `LaTeX-xcolor-core-color-models',
+`LaTeX-xcolor-num-color-models' and `LaTeX-xcolor-pseudo-color-models'.")
+
+(defun LaTeX-xcolor-color-models (&optional no-named)
+ "Return the value of variable `LaTeX-xcolor-color-models'.
+If NO-NAMED is non-nil, remove \"named\" and return the
+remainder."
+ (if no-named
+ (remove "named" LaTeX-xcolor-color-models)
+ (symbol-value 'LaTeX-xcolor-color-models)))
+
+;; Needed for auto-parsing.
+(require 'tex)
+
+;; Setup AUCTeX parser for \definecolor(set):
+(TeX-auto-add-type "xcolor-definecolor" "LaTeX")
+(TeX-auto-add-type "xcolor-definecolorset" "LaTeX")
+
+(defvar LaTeX-xcolor-definecolor-regexp
+ `(,(concat "\\\\\\(?:define\\|provide\\|prepare\\)?"
+ "color"
+ "\\(?:let\\)?"
+ "\\(?:\\[\\(?:[^]]*\\)\\]\\)?{\\([^}]+\\)}")
+ 1 LaTeX-auto-xcolor-definecolor)
+ "Match the argument of various color defining macros from
+xcolor package.")
+
+(defvar LaTeX-xcolor-definecolorset-regexp
+ `(,(concat "\\\\\\(?:define\\|provide\\|prepare\\)"
+ "colorset"
+ "\\(?:\\[\\(?:[^]]*\\)\\]\\)?"
+ "{\\(?:[^}]+\\)}"
+ "{\\([^}]+\\)}"
+ "{\\([^}]+\\)}"
+ "{\\([^}]+\\)}")
+ (1 2 3) LaTeX-auto-xcolor-definecolorset)
+ "Match the argument of various color-set defining macros from
+xcolor package.")
+
+(defun LaTeX-xcolor-auto-prepare ()
+ "Clear `LaTeX-auto-xcolor-definecolor' before parsing."
+ (setq LaTeX-auto-xcolor-definecolor nil))
+
+(defun LaTeX-xcolor-auto-cleanup ()
+ "Process the parsed elements from `LaTeX-auto-xcolor-definecolorset'."
+ (dolist (colset (LaTeX-xcolor-definecolorset-list))
+ (let ((head (car colset))
+ (tail (cadr colset))
+ (cols (split-string
+ (replace-regexp-in-string "[ %\n\r\t]*" "" (nth 2 colset))
+ "\\(,[^;]+;\\|,[^;]+$\\)" t)))
+ (dolist (color cols)
+ (LaTeX-add-xcolor-definecolors (concat head color tail))))))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-xcolor-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-xcolor-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun TeX-arg-xcolor-definecolor (optional)
+ "Insert arguments of \\definecolor and similar macros from
+xcolor.sty."
+ ;; \definecolor[<type>]{<name>}{<model-list>}{<spec-list>}
+ (let* ((xcoltype (completing-read
+ (TeX-argument-prompt t nil "Type")
+ LaTeX-xcolor-type-color-models))
+ (xcolname (TeX-read-string
+ (TeX-argument-prompt optional nil "Color name")))
+ (xcolmodel (completing-read
+ (TeX-argument-prompt optional nil "Model (list)")
+ (if (string= xcoltype "named")
+ (LaTeX-xcolor-color-models t)
+ LaTeX-xcolor-color-models)))
+ (xcolspec (if (string= xcolmodel "named")
+ (completing-read
+ (TeX-argument-prompt optional nil "Color")
+ (LaTeX-xcolor-definecolor-list))
+ (TeX-read-string
+ (TeX-argument-prompt optional nil (concat xcolmodel "
spec (list)"))))))
+ (when (and xcoltype (not (string= xcoltype "")))
+ (insert (format "[%s]" xcoltype)))
+ (TeX-argument-insert xcolname optional)
+ (LaTeX-add-xcolor-definecolors xcolname)
+ (TeX-argument-insert xcolmodel optional)
+ (TeX-argument-insert xcolspec optional)))
+
+(defun TeX-arg-xcolor-definecolorset (optional)
+ "Insert arguments of \\definecolorset and similar macros from
+xcolor.sty."
+ (let ((xcoltype (completing-read
+ (TeX-argument-prompt t nil "Type")
+ LaTeX-xcolor-type-color-models))
+ (xcolmodel (completing-read
+ (TeX-argument-prompt optional nil "Model")
+ (LaTeX-xcolor-color-models t))))
+ (when (and xcoltype (not (string= xcoltype "")))
+ (insert (format "[%s]" xcoltype)))
+ (TeX-argument-insert xcolmodel optional)))
+
+(defun TeX-arg-xcolor (optional)
+ "Insert arguments of various color commands from xcolor.sty."
+ ;; \color{<name>} or \color[<model-list>]{<spec-list>}
+ (let* ((xcolmodel (completing-read
+ (TeX-argument-prompt t nil "Model (list)")
+ (LaTeX-xcolor-color-models t)))
+ (xcolor (if (and xcolmodel (not (string= xcolmodel "")))
+ (TeX-read-string
+ (TeX-argument-prompt optional nil (concat xcolmodel "
spec (list)")))
+ (completing-read
+ (TeX-argument-prompt optional nil "Color")
+ (LaTeX-xcolor-definecolor-list)))))
+ (when (and xcolmodel (not (string= xcolmodel "")))
+ (insert (format "[%s]" xcolmodel)))
+ (TeX-argument-insert xcolor optional)))
+
+(defun TeX-arg-xcolor-fcolorbox (optional)
+ "Insert arguments of \\fcolorbox from xcolor.sty."
+ ;;\fcolorbox[<frame model>]{<frame spec>}[<background model>]{<background
spec>}{<text>}
+ (let* ((xfrmodel (completing-read
+ (TeX-argument-prompt t nil "(Frame) Color model")
+ LaTeX-xcolor-color-models))
+ (xfrspec (if (or (string= xfrmodel "")
+ (string= xfrmodel "named"))
+ (completing-read
+ (TeX-argument-prompt optional nil "Frame color spec")
+ (LaTeX-xcolor-definecolor-list))
+ (TeX-read-string
+ (TeX-argument-prompt optional nil "Frame color spec"))))
+ (xbgmodel (completing-read
+ (TeX-argument-prompt t nil "Background Color model")
+ LaTeX-xcolor-color-models))
+ (xbgspec (if (or (string= xfrmodel "")
+ (string= xfrmodel "named")
+ (string= xbgmodel "")
+ (string= xbgmodel "named"))
+ (completing-read
+ (TeX-argument-prompt optional nil "Background color
spec")
+ (LaTeX-xcolor-definecolor-list))
+ (TeX-read-string
+ (TeX-argument-prompt optional nil "Background color
spec")))))
+ (when (and xfrmodel (not (string= xfrmodel "")))
+ (insert (format "[%s]" xfrmodel)))
+ (TeX-argument-insert xfrspec optional)
+ (when (and xbgmodel (not (string= xbgmodel "")))
+ (insert (format "[%s]" xbgmodel)))
+ (TeX-argument-insert xbgspec optional)))
+
+
+(TeX-add-style-hook
+ "xcolor"
+ (lambda ()
+ ;; Add color to the parser.
+ (TeX-auto-add-regexp LaTeX-xcolor-definecolor-regexp)
+ (TeX-auto-add-regexp LaTeX-xcolor-definecolorset-regexp)
+
+ ;; Add list of colors which are always available.
+ (apply #'LaTeX-add-xcolor-definecolors LaTeX-xcolor-base-colors)
+
+ ;; Add dvips colors in conjunction with `dvipsnames*?'.
+ (when (or (LaTeX-provided-package-options-member "xcolor" "dvipsnames")
+ (LaTeX-provided-package-options-member "xcolor" "dvipsnames*"))
+ (apply #'LaTeX-add-xcolor-definecolors LaTeX-xcolor-dvipsnames-colors))
+
+ ;; For `svgnames*?'
+ (when (or (LaTeX-provided-package-options-member "xcolor" "svgnames")
+ (LaTeX-provided-package-options-member "xcolor" "svgnames*"))
+ (apply #'LaTeX-add-xcolor-definecolors LaTeX-xcolor-svgnames-colors))
+
+ ;; For `x11ames*?'
+ (when (or (LaTeX-provided-package-options-member "xcolor" "x11names")
+ (LaTeX-provided-package-options-member "xcolor" "x11names*"))
+ (apply #'LaTeX-add-xcolor-definecolors LaTeX-xcolor-x11names-colors))
+
+ (TeX-add-symbols
+ ;; 2.5.2 Color definition in xcolor
+ ;; \definecolor[<type>]{<name>}{<model-list>}{<spec-list>}
+ '("definecolor" TeX-arg-xcolor-definecolor)
+
+ ;; \providecolor[<type>]{<name>}{<model-list>}{<spec-list>}
+ '("providecolor" TeX-arg-xcolor-definecolor)
+
+ ;; \colorlet[<type>]{<name>}{<num model>}{<color>}
+ '("colorlet"
+ [ TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Type")
+ LaTeX-xcolor-type-color-models ]
+ (TeX-arg-eval
+ (lambda ()
+ (let ((xcolor (TeX-read-string
+ (TeX-argument-prompt optional nil "Color"))))
+ (LaTeX-add-xcolor-definecolors xcolor)
+ (format "%s" xcolor))))
+ [ TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Model")
+ (LaTeX-xcolor-color-models t) ]
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Color")
+ (LaTeX-xcolor-definecolor-list)))
+
+ ;; 2.5.3 Defining sets of colors
+ ;; \definecolorset[<type>]{<model-list>}{<head>}{<tail>}{<set spec>}
+ '("definecolorset" TeX-arg-xcolor-definecolorset "Head" "Tail" t)
+
+ ;; \providecolorset[<type>]{<model-list>}{<head>}{<tail>}{<set spec>}
+ '("providecolorset" TeX-arg-xcolor-definecolorset "Head" "Tail" t)
+
+ ;; 2.5.4 Immediate and deferred definitions
+ ;; \preparecolor[<type>]{<name>}{<model-list>}{<spec-list>}
+ '("preparecolor" TeX-arg-xcolor-definecolor)
+
+ ;; \preparecolorset[<type>]{<model-list>}{<head>}{<tail>}{<set spec>}
+ '("preparecolorset" TeX-arg-xcolor-definecolorset "Head" "Tail" t)
+
+ ;; \definecolors{<id-list>}
+ '("definecolors" t)
+
+ ;; \providecolors{<id-list>}
+ '("providecolors" t)
+
+ ;; 2.6 Color application
+ ;; 2.6.1 Standard color commands
+
+ ;; \color{<name>} or \color[<model>]{<color spec>}
+ '("color" TeX-arg-xcolor)
+
+ ;; \textcolor{<name>}{<text>} or
+ ;; \textcolor[<model>]{<color spec>}{<text>}
+ '("textcolor" TeX-arg-xcolor "Text")
+
+ ;; \pagecolor{<name>} or
+ ;; \pagecolor[<model>]{<color spec>}
+ '("pagecolor" TeX-arg-xcolor)
+
+ ;; \nopagecolor
+ '("nopagecolor" 0)
+
+ ;; 2.6.2 Colored boxes
+ ;; \colorbox{<name>}{<text>} or
+ ;; \colorbox[<model>]{<color spec>}{<text>}
+ '("colorbox" TeX-arg-xcolor "Text")
+
+ ;; \fcolorbox{<frame color>}{<box color>}{<text>} or
+ ;; \fcolorbox[<model>]{<frame spec>}{<background spec>}{<text>} or
+ ;; \fcolorbox[<frame model>]{<frame spec>}[<background model>]{<background
spec>}{<text>}
+ '("fcolorbox" TeX-arg-xcolor-fcolorbox "Text")
+
+ ;; 2.6.4 Color testing
+ ;; \testcolor{<name>} or
+ ;; \testcolor[<model>]{<color spec>}
+ '("testcolor" TeX-arg-xcolor)
+
+ ;; 2.7 Color blending
+ '("blendcolors"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Mix expr")
+ (LaTeX-xcolor-definecolor-list)))
+ '("blendcolors*"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Mix expr")
+ (LaTeX-xcolor-definecolor-list)))
+
+ ;; 2.8 Color masks and separation
+ '("maskcolors"
+ [ TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Model")
+ (LaTeX-xcolor-color-models t) ]
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Color")
+ (LaTeX-xcolor-definecolor-list)))
+
+ ;; 2.9 Color series
+ '("definecolorseries"
+ "Name"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Core model")
+ LaTeX-xcolor-core-color-models)
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Method")
+ '("step" "grad" "last"))
+ [ t ] nil [ nil ] nil)
+
+ '("resetcolorseries" [ "Div." ] "Name")
+
+ ;; 2.13 Color information
+ ;; \extractcolorspec{<color>}{<cmd>}
+ '("extractcolorspec"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Color")
+ (LaTeX-xcolor-definecolor-list))
+ (TeX-arg-define-macro "Command: \\"))
+
+ ;; \extractcolorspecs{<color>}{<model-cmd>{<color-cmd>}
+ '("extractcolorspecs"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Color")
+ (LaTeX-xcolor-definecolor-list))
+ (TeX-arg-define-macro "Model command: \\")
+ (TeX-arg-define-macro "Color command: \\"))
+
+ ;; \tracingcolors = <integer>
+ '("tracingcolors"
+ (TeX-arg-literal "="))
+
+ ;; 2.14 Color conversion
+ ;; \convertcolorspec{<model>}{<spec>}{<target model>}{cmd>}
+ '("convertcolorspec"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Model")
+ (LaTeX-xcolor-color-models))
+ (TeX-arg-eval TeX-read-string
+ (TeX-argument-prompt optional nil "Spec"))
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Model")
+ (LaTeX-xcolor-color-models t))
+ (TeX-arg-define-macro "Macro: \\")) ) ; close TeX-add-symbols
+
+ ;; 2.12 Color in tables
+ ;; These commands are available with `table' package option
+ (when (LaTeX-provided-package-options-member "xcolor" "table")
+ ;; Run style hook to colortbl.sty
+ (TeX-run-style-hooks "colortbl")
+
+ ;; Add additional commands:
+ (TeX-add-symbols
+ ;; \rowcolors[<commands>]{<row>}{<odd-row color>}{<even-row color>}
+ '("rowcolors"
+ (TeX-arg-conditional (y-or-n-p "With optional commands? ")
+ ( [ t ] )
+ (ignore))
+ "Row"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Odd-row color")
+ (LaTeX-xcolor-definecolor-list))
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Even-row color")
+ (LaTeX-xcolor-definecolor-list)))
+ '("rowcolors*"
+ (TeX-arg-conditional (y-or-n-p "With optional commands? ")
+ ( [ t ] )
+ (ignore))
+ "Row"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Odd-row color")
+ (LaTeX-xcolor-definecolor-list))
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Even-row color")
+ (LaTeX-xcolor-definecolor-list)))
+ '("showrowcolors" 0)
+ '("hiderowcolors" 0))
+ (LaTeX-add-counters "rownum"))
+
+ ;; 2.6.4 Color testing
+ (LaTeX-add-environments
+ '("testcolors" LaTeX-env-args
+ [ TeX-arg-eval mapconcat #'identity
+ (TeX-completing-read-multiple
+ (TeX-argument-prompt optional nil "Color models")
+ (LaTeX-xcolor-color-models t))
+ "," ] ))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("color" "[{")
+ ("pagecolor" "[{"))
+ 'type-declaration)
+ (font-latex-add-keywords '(("textcolor" "[{{")
+ ("colorbox" "[{{" )
+ ("fcolorbox" "[{[{{"))
+ 'type-command)
+ (font-latex-add-keywords '(("definecolor" "[{{{")
+ ("providecolor" "[{{{")
+ ("colorlet" "[{[{")
+ ("definecolorset" "[{{{{")
+ ("providecolorset" "[{{{{")
+ ("preparecolor" "[{{{")
+ ("preparecolorset" "[{{{{")
+ ("definecolors" "{")
+ ("providecolors" "{")
+ ("testcolor" "[{")
+ ("blendcolors" "*{")
+ ("maskcolors" "[{")
+ ("definecolorseries" "{{{[{[{")
+ ("resetcolorseries" "[{")
+ ("extractcolorspec" "{{")
+ ("extractcolorspecs" "{{{")
+ ("convertcolorspec" "{{{{")
+ ("rowcolors" "*[{{{"))
+ 'function)))
+ LaTeX-dialect)
+
+(defvar LaTeX-xcolor-package-options
+ '(;; options that determine the color driver
+ "dvips" "xdvi" "dvipdf" "dvipdfm" "dvipdfmx" "pdftex" "dvipsone"
+ "dviwindo" "emtex" "dviwin" "oztex" "textures" "pctexps" "pctexwin"
+ "pctexhp" "pctex32" "truetex" "tcidvi" "vtex" "xetex"
+
+ ;; options that determine the target color model
+ "natural" "rgb" "cmy" "cmyk" "hsb" "gray" "RGB" "HTML"
+ "HSB" "Gray" "monochrome"
+
+ ;; options that control predefined colors loading
+ "dvipsnames" "dvipsnames*" "svgnames" "svgnames*" "x11names" "x11names*"
+
+ ;; options that determine which other packages to load
+ "table" "fixpdftex" "hyperref"
+
+ ;; options that influence the behaviour of other commands
+ "prologue" "kernelfbox" "xcdraw" "noxcdraw" "fixinclude"
+ "showerrors" "hideerrors")
+ "Package options for the xcolor package.")
+
+;;; xcolor.el ends here
diff --git a/tests/tex/command-expansion.el b/tests/tex/command-expansion.el
index d6dfc89..ebdb6d1 100644
--- a/tests/tex/command-expansion.el
+++ b/tests/tex/command-expansion.el
@@ -33,4 +33,47 @@
'TeX-master-file))
"%% \"\\input\"")))
+(ert-deftest TeX-view-command-raw-errors ()
+ "Tests to trigger errors in `TeX-view-command-raw'."
+ ;; Viewer specification should be either a command line string or a Lisp
+ ;; function name to be executed. This test makes sure that the functions
+ ;; throws an error if the selected viewer has a wrong specification (for
+ ;; example a function call, not the function name) such that the returned
+ ;; value `command' isn't a string. This prevents an infinite loop in
+ ;; `TeX-command-expand'.
+ (should-error
+ (with-temp-buffer
+ (let ((TeX-view-program-list '(("viewer"
+ (wrong-specification))))
+ (TeX-view-program-selection
+ '((output-pdf "viewer"))))
+ (TeX-mode)
+ (TeX-view-command-raw)))
+ :type 'error)
+ ;; Signal an error when a nonexistent viewer is selected.
+ (should-error
+ (with-temp-buffer
+ (let ((TeX-view-program-selection
+ '((output-pdf "does-not-exist"))))
+ (TeX-mode)
+ (TeX-view-command-raw)))
+ :type 'error)
+ ;; Signal an error if the binary associated to the viewer cannot be found.
+ (should-error
+ (with-temp-buffer
+ (let ((TeX-view-program-list
+ '(("viewer" "viewer %o" "**this-program-does-not-exist**")))
+ (TeX-view-program-selection
+ '((output-pdf "viewer"))))
+ (TeX-mode)
+ (TeX-view-command-raw)))
+ :type 'error)
+ ;; Error if there is no selected viewer for current buffer.
+ (should-error
+ (with-temp-buffer
+ (let (TeX-view-program-selection)
+ (TeX-mode)
+ (TeX-view-command-raw)))
+ :type 'error))
+
;;; command-expansion.el ends here
diff --git a/tex-buf.el b/tex-buf.el
index 58e1602..0fe7b9d 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -432,7 +432,7 @@ to be run."
Do you want to use this engine?" (cdr (assoc engine name-alist)))))
;; More than one engine is allowed.
((> length 1)
- (if (y-or-n-p (format "%s are required to build this document.
+ (if (y-or-n-p (format "It appears %s are required to build this
document.
Do you want to select one of these engines?"
(mapconcat
(lambda (elt) (cdr (assoc elt name-alist)))
@@ -448,7 +448,12 @@ Do you want to select one of these engines?"
(mapcar
(lambda (elt) (cdr (assoc elt name-alist)))
TeX-check-engine-list))
- name-alist))))))
+ name-alist)))
+ ;; Don't keep asking. If user doesn't want to change engine,
+ ;; probably has a good reason. In order to do so, without adding
+ ;; yet another variable we just hack `TeX-check-engine-list' and
+ ;; make it nil.
+ (setq TeX-check-engine-list nil))))
(TeX-engine-set engine)
(when (and (fboundp 'add-file-local-variable)
(y-or-n-p "Do you want to remember the choice?"))
@@ -786,7 +791,7 @@ omitted) and `TeX-region-file'."
;; We should check for bst files here as well.
(if LaTeX-using-Biber TeX-command-Biber TeX-command-BibTeX))
((and
- ;; Rational: makeindex should be run when final document is almost
+ ;; Rationale: makeindex should be run when final document is almost
;; complete (see
;;
http://tex.blogoverflow.com/2012/09/dont-forget-to-run-makeindex/),
;; otherwise, after following latex runs, index pages may change due
@@ -797,10 +802,9 @@ omitted) and `TeX-region-file'."
(TeX-process-get-variable
name
'TeX-command-next
- (if (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode)
- "Dvips"
- TeX-command-Show)))
- (list "Dvips" TeX-command-Show))
+ (or (and TeX-PDF-mode (TeX-PDF-from-DVI))
+ TeX-command-Show)))
+ (list "Dvips" "Dvipdfmx" TeX-command-Show))
(cdr (assoc (expand-file-name (concat name ".idx"))
LaTeX-idx-changed-alist)))
"Index")
@@ -888,6 +892,25 @@ QUEUE is non-nil when we are checking for the printer
queue."
(goto-char (posn-point (event-start event)))
(TeX-view)))
+(defun TeX-region-update-point ()
+ "Syncs the location of point in the region file with the current file.
+
+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
+ (let ((region-buf (get-file-buffer (TeX-region-file t)))
+ (current-line (line-number-at-pos)))
+ (when region-buf
+ (with-current-buffer region-buf
+ (goto-char (point-min))
+ (when (re-search-forward "!offset(\\(-?[0-9]+\\)")
+ (let ((offset (string-to-int (match-string 1))))
+ (goto-char (point-min))
+ (forward-line (- current-line (1+ offset))))))))))
+
(defun TeX-view ()
"Start a viewer without confirmation.
The viewer is started either on region or master file,
@@ -895,7 +918,11 @@ depending on the last command issued."
(interactive)
(let ((output-file (TeX-active-master (TeX-output-extension))))
(if (file-exists-p output-file)
- (TeX-command "View" 'TeX-active-master 0)
+ (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))
(message "Output file %S does not exist." output-file))))
(defun TeX-output-style-check (styles)
@@ -1009,7 +1036,7 @@ Return the new process."
"Remember TeX command to use to NAME and set corresponding output extension."
(setq TeX-command-default name
TeX-output-extension
- (if (and (null TeX-PDF-via-dvips-ps2pdf) TeX-PDF-mode) "pdf" "dvi"))
+ (if (and (null (TeX-PDF-from-DVI)) TeX-PDF-mode) "pdf" "dvi"))
(let ((case-fold-search t)
(lst TeX-command-output-list))
(while lst
@@ -1023,7 +1050,7 @@ Return the new process."
(TeX-run-set-command name command)
(let ((buffer (TeX-process-buffer-name file))
(process (TeX-run-command name command file)))
- ;; Hook to TeX debuger.
+ ;; Hook to TeX debugger.
(with-current-buffer buffer
(TeX-parse-reset)
(setq TeX-parse-function #'TeX-parse-TeX)
@@ -1121,6 +1148,14 @@ run of `TeX-run-TeX', use
process
(TeX-synchronous-sentinel name file process))))
+(defun TeX-run-dvipdfmx (name command file)
+ "Create a process for NAME using COMMAND to convert FILE with dvipdfmx."
+ (let ((process (TeX-run-command name command file)))
+ (setq TeX-sentinel-function #'TeX-dvipdfmx-sentinel)
+ (if TeX-process-asynchronous
+ process
+ (TeX-synchronous-sentinel name file process))))
+
(defun TeX-run-ps2pdf (name command file)
"Create a process for NAME using COMMAND to convert FILE with ps2pdf."
(let ((process (TeX-run-command name command file)))
@@ -1358,13 +1393,16 @@ errors or warnings to show."
(progn
(if TeX-parse-all-errors
(TeX-parse-all-errors))
- (if (and TeX-error-overview-open-after-TeX-run TeX-error-list)
+ (if (and TeX-error-overview-open-after-TeX-run
+ (TeX-error-overview-make-entries
+ (TeX-master-directory) (TeX-active-buffer)))
(TeX-error-overview)))
(message (concat name ": formatted " (TeX-current-pages)))
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show))))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show)))))
(defun TeX-current-pages ()
"Return string indicating the number of pages formatted."
@@ -1421,10 +1459,11 @@ Return nil ifs no errors were found."
'TeX-current-master))
t))
t)
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show)))
nil))
;; This regexp should catch warnings of the type
@@ -1461,7 +1500,9 @@ Open the error overview if
errors or warnings to show."
(if TeX-parse-all-errors
(TeX-parse-all-errors))
- (if (and TeX-error-overview-open-after-TeX-run TeX-error-list)
+ (if (and TeX-error-overview-open-after-TeX-run
+ (TeX-error-overview-make-entries
+ (TeX-master-directory) (TeX-active-buffer)))
(TeX-error-overview))
(cond ((TeX-TeX-sentinel-check process name))
((and (save-excursion
@@ -1514,18 +1555,20 @@ Rerun to get outlines right" nil t)
((re-search-forward "^LaTeX Warning: Reference" nil t)
(message "%s%s%s" name ": there were unresolved references, "
(TeX-current-pages))
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show)))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show))))
((re-search-forward "^\\(?:LaTeX Warning: Citation\\|\
Package natbib Warning:.*undefined citations\\)" nil t)
(message "%s%s%s" name ": there were unresolved citations, "
(TeX-current-pages))
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show)))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show))))
((re-search-forward "Package longtable Warning: Table widths have \
changed\\. Rerun LaTeX\\." nil t)
(message
@@ -1538,7 +1581,7 @@ Rerun to get mark in right position\\." nil t)
(setq TeX-command-next TeX-command-default))
((re-search-forward
"^\\(\\*\\* \\)?J?I?p?\\(La\\|Sli\\)TeX\\(2e\\)? \
-\\(Version\\|ver\\.\\|<[0-9/]*>\\)" nil t)
+\\(Version\\|ver\\.\\|<[0-9/]*\\(?:u[^>]*\\)?>\\)" nil t)
(let* ((warnings (and TeX-debug-warnings
(TeX-LaTeX-sentinel-has-warnings)))
(bad-boxes (and TeX-debug-bad-boxes
@@ -1551,10 +1594,11 @@ Rerun to get mark in right position\\." nil t)
")"))))
(message "%s" (concat name ": successfully formatted "
(TeX-current-pages) add-info)))
- (if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
- (setq TeX-command-next "Dvips")
- (setq TeX-command-next TeX-command-Show)))
+ (let (dvi2pdf)
+ (if (with-current-buffer TeX-command-buffer
+ (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+ (setq TeX-command-next dvi2pdf)
+ (setq TeX-command-next TeX-command-Show))))
(t
(message "%s%s%s" name ": problems after " (TeX-current-pages))
(setq TeX-command-next TeX-command-default)))
@@ -1639,11 +1683,26 @@ Rerun to get mark in right position\\." nil t)
"\\<TeX-mode-map>\\[TeX-recenter-output-buffer]")))
(t
(if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
+ (and (equal (TeX-PDF-from-DVI) "Dvips") TeX-PDF-mode))
(setq TeX-output-extension "ps"
TeX-command-next "Ps2pdf"))
(message "Dvips finished successfully. "))))
+(defun TeX-dvipdfmx-sentinel (_process _name)
+ "Cleanup TeX output buffer after running dvipdfmx."
+ (goto-char (point-max))
+ (cond
+ ((search-backward "TeX Output exited abnormally" nil t)
+ (message "Dvipdfmx failed. Type `%s' to display output."
+ (substitute-command-keys
+ "\\<TeX-mode-map>\\[TeX-recenter-output-buffer]")))
+ (t
+ (if (with-current-buffer TeX-command-buffer
+ (and (equal (TeX-PDF-from-DVI) "Dvipdfmx") TeX-PDF-mode))
+ (setq TeX-output-extension "pdf"
+ TeX-command-next TeX-command-Show))
+ (message "Dvipdfmx finished successfully. "))))
+
(defun TeX-ps2pdf-sentinel (_process _name)
"Cleanup TeX output buffer after running ps2pdf."
(goto-char (point-max))
@@ -1654,7 +1713,7 @@ Rerun to get mark in right position\\." nil t)
"\\<TeX-mode-map>\\[TeX-recenter-output-buffer]")))
(t
(if (with-current-buffer TeX-command-buffer
- (and TeX-PDF-via-dvips-ps2pdf TeX-PDF-mode))
+ (and (equal (TeX-PDF-from-DVI) "Dvips") TeX-PDF-mode))
(setq TeX-command-next TeX-command-Show
TeX-output-extension "pdf"))
(message "ps2pdf finished successfully. "))))
@@ -3342,10 +3401,13 @@ please restart TeX error overview")))
(message "No more errors.")
(beep))))
-(defun TeX-error-overview-make-entries (&optional master-dir)
+(defun TeX-error-overview-make-entries (&optional master-dir active-buffer)
"Generate the list of errors to be printed using `tabulated-list-entries'.
-Write file names relative to MASTER-DIR when they are not absolute."
- (with-current-buffer TeX-error-overview-active-buffer
+Write file names relative to MASTER-DIR when they are not absolute.
+
+ACTIVE-BUFFER is used as buffer from which to extract the list of
+errors. If nil, defaults to `TeX-error-overview-active-buffer'."
+ (with-current-buffer (or active-buffer TeX-error-overview-active-buffer)
(let ((id 0)
type file line msg entries)
(mapc
@@ -3673,7 +3735,7 @@ forward, if negative)."
(let ((name (match-string 1))
(file (match-string 2)))
(with-current-buffer TeX-command-buffer
- (TeX-command name (if (string-match "_region_" file)
+ (TeX-command name (if (string-match TeX-region file)
#'TeX-region-file
#'TeX-master-file))))
(error "Unable to find what command to run")))
diff --git a/tex-jp.el b/tex-jp.el
index 9486c7a..717e1ab 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -1,6 +1,7 @@
;;; tex-jp.el --- Support for Japanese TeX. -*- coding: iso-2022-jp-unix; -*-
-;; Copyright (C) 1999, 2001-2007, 2012 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2007, 2012, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001 Hidenobu Nabetani <address@hidden>
;; Author: KOBAYASHI Shinji <address@hidden>,
;; Hidenobu Nabetani <address@hidden>
@@ -194,41 +195,19 @@ For detail, see `TeX-command-list', to which this list is
appended."
;; http://oku.edu.mie-u.ac.jp/~okumura/texwiki/?AUCTeX
;; $B$r;29M$K$7$F$_$?!#(B
((eq system-type 'windows-nt)
- '(("Dviout" ("dviout -1 "
- ((paper-a4 paper-portrait) " -y=A4 ")
- ((paper-a4 paper-landscape) " -y=A4L ")
- ((paper-a5 paper-portrait) " -y=A5 ")
- ((paper-a5 paper-landscape) " -y=A5L ")
- ((paper-b5 paper-portrait) " -y=E5 ")
- ((paper-b5 paper-landscape) " -y=E5L ")
- ((paper-b4jis paper-portrait) " -y=B4 ")
- ((paper-b4jis paper-landscape) " -y=B4L ")
- ((paper-b5jis paper-portrait) " -y=B5 ")
- ((paper-b5jis paper-landscape) " -y=B5L ")
- (paper-legal " -y=Legal ")
- (paper-letter " -y=Letter ")
- (paper-executive " -y=Exective ")
- "%o" (mode-io-correlate " \"# %n '%b'\"")))
- ("TeXworks" "TeXworks %o")
- ("SumatraPDF" "SumatraPDF -reuse-instance %o"
- (mode-io-correlate " -forward-search \"%b\" %n"))
- ("MuPDF" "mupdf %o")))
+ '(("TeXworks" "TeXworks %o" "texworks")
+ ("MuPDF" "mupdf %o" "mupdf")))
;; $B$3$l$G$$$$$N$+$I$&$+$OIT0B!#(B
((eq system-type 'darwin)
- '(("Preview" "open -a Preview.app %o")
- ("TeXShop" "open -a TeXShop.app %o")
- ("TeXworks" "open -a TeXworks.app %o")
- ("Skim" "open -a Skim.app %o")
- ("displayline" "displayline %n %o %b")
- ("PictPrinter" "open -a PictPrinter.app %d")
- ("Mxdvi" "open -a Mxdvi.app %d")
- ("open" "open %o")))
+ '(("TeXShop" "open -a TeXShop.app %o" "open")
+ ("TeXworks" "open -a TeXworks.app %o" "open")
+ ("PictPrinter" "open -a PictPrinter.app %d" "open")
+ ("Mxdvi" "open -a Mxdvi.app %d" "open")))
(t
(setcar (cadr (assoc "xdvi" TeX-view-program-list-builtin))
"%(xdvi) -unique")
- '(("TeXworks" "texworks %o")
- ("zathura" "zathura %o")
- ("MuPDF" "mupdf %o"))))))
+ '(("TeXworks" "texworks %o" "texworks")
+ ("MuPDF" "mupdf %o" "mupdf"))))))
;; $B$3$l$O(B tex.el $B$K<h$jF~$l$F$b$i$&$N$OFq$7$$$+!)(B
;; tex-jp.el $B$,address@hidden"(Bdvi viewer $B$N%G%U%)%k%H$,(B dviout
$B$K(B
@@ -238,10 +217,10 @@ For detail, see `TeX-command-list', to which this list is
appended."
(append
(cond
((eq system-type 'windows-nt)
- '((output-dvi "Dviout")
+ '((output-dvi "dviout")
(output-pdf "TeXworks")))
((eq system-type 'darwin)
- '((output-pdf "Preview")))
+ '((output-pdf "Preview.app")))
(t
nil))
TeX-view-program-selection)))
@@ -331,7 +310,10 @@ For detail, see `TeX-command-list', to which this list is
appended."
("treport")
("tbook")
("jsarticle")
- ("jsbook"))
+ ("jsbook")
+ ;; for upLaTeX
+ ("ujarticle") ("ujreport") ("ujbook")
+ ("utarticle") ("utreport") ("utbook"))
"*List of Japanese document styles."
:group 'AUCTeX-jp
:type '(repeat (group (string :format "%v"))))
@@ -421,7 +403,14 @@ Set `japanese-TeX-mode' to t, and enter
`TeX-plain-tex-mode'."
"Japanese plain-TeX specific initializations."
(when japanese-TeX-mode
; (setq TeX-command-default japanese-TeX-command-default)
- (TeX-engine-set japanese-TeX-engine-default)))
+ (TeX-engine-set japanese-TeX-engine-default)
+
+ ;; For the intent of the following lines, see the comments below
+ ;; in `japanese-latex-mode-initialization'.
+ (when enable-local-variables
+ (setq major-mode 'japanese-plain-tex-mode)
+ (add-hook 'hack-local-variables-hook 'japanese-TeX-reset-mode-name
+ nil t))))
(add-hook 'plain-TeX-mode-hook 'japanese-plain-tex-mode-initialization)
@@ -453,10 +442,42 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'."
; (setq TeX-command-BibTeX
; (if (and (eq TeX-engine 'ptex) (executable-find "pbibtex"))
; "pBibTeX" "jBibTeX"))
-))
+
+ ;; The value of `major-mode' should be `latex-mode', not
+ ;; `japanese-latex-mode', because the name `latex-mode' is hard
+ ;; coded in several places of AUCTeX like "(eq major-mode
+ ;; 'latex-mode)", "(memq major-mode '(doctex-mode latex-mode)" and
+ ;; so on. By such piece of codes, `japanese-latex-mode' should
+ ;; simply be regarded as `latex-mode'. So we'd like to leave
+ ;; `major-mode' as `latex-mode' here, but doing so confuses
+ ;; `hack-local-variables' in two ways.
+ ;; (1) It is tricked into considering that the major mode is not
+ ;; yet initialized and calls `japanese-latex-mode' again.
+ ;; (2) It does not read the directory local variables prepared for
+ ;; `japanese-latex-mode'.
+ ;; Thus we temporarily set `major-mode' to `japanese-latex-mode'
+ ;; here and plan to reset it to `latex-mode' after
+ ;; `hack-local-variables' is done.
+ (when enable-local-variables
+ (setq major-mode 'japanese-latex-mode)
+ (add-hook 'hack-local-variables-hook 'japanese-TeX-reset-mode-name
+ nil t))))
(add-hook 'LaTeX-mode-hook 'japanese-latex-mode-initialization)
+;; This function is useful only within `hack-local-variables-hook'.
+(defun japanese-TeX-reset-mode-name ()
+ (cond ((eq major-mode 'japanese-latex-mode)
+ (setq major-mode 'latex-mode))
+ ((eq major-mode 'japanese-plain-tex-mode)
+ (setq major-mode 'plain-tex-mode)))
+ (remove-hook 'hack-local-variables-hook 'japanese-TeX-reset-mode-name t))
+
+;; Make `hack-dir-local-variables' to regard `latex-mode' as parent
+;; of `japanese-latex-mode', and `plain-tex-mode' as parent of
+;; `japanese-plain-tex-mode'.
+(put 'japanese-plain-tex-mode 'derived-mode-parent 'plain-tex-mode)
+(put 'japanese-latex-mode 'derived-mode-parent 'latex-mode)
;;; Support for various self-insert-command
diff --git a/tex-site.el.in b/tex-site.el.in
index 78198f4..eb5d87c 100644
--- a/tex-site.el.in
+++ b/tex-site.el.in
@@ -87,21 +87,23 @@ shared by all users of a site."
(add-hook 'tex-site-unload-hook
(lambda ()
- (let ((list after-load-alist))
- (while list
- ;; Adapted copy of the definition of `assq-delete-all'
- ;; from Emacs 21 as substitute for
- ;; `(assq-delete-all'TeX-modes-set (car list))' which
- ;; fails on non-list elements in Emacs 21.
- (let* ((alist (car list))
- (tail alist)
- (key 'TeX-modes-set))
- (while tail
- (if (and (consp (car tail))
- (eq (car (car tail)) key))
- (setq alist (delq (car tail) alist)))
- (setq tail (cdr tail))))
- (setq list (cdr list))))
+ (if (fboundp 'advice-add)
+ (TeX-modes-set 'TeX-modes nil)
+ (let ((list after-load-alist))
+ (while list
+ ;; Adapted copy of the definition of `assq-delete-all'
+ ;; from Emacs 21 as substitute for
+ ;; `(assq-delete-all'TeX-modes-set (car list))' which
+ ;; fails on non-list elements in Emacs 21.
+ (let* ((alist (car list))
+ (tail alist)
+ (key 'TeX-modes-set))
+ (while tail
+ (if (and (consp (car tail))
+ (eq (car (car tail)) key))
+ (setq alist (delq (car tail) alist)))
+ (setq tail (cdr tail))))
+ (setq list (cdr list)))))
(setq load-path (delq TeX-lisp-directory load-path))))
(defun TeX-modes-set (var value &optional update)
diff --git a/tex.el b/tex.el
index 588848a..8ea0b45 100644
--- a/tex.el
+++ b/tex.el
@@ -151,6 +151,8 @@ If nil, none is specified."
:help "Generate PostScript file")
("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t
:help "Convert DVI file to PostScript")
+ ("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t
+ :help "Convert DVI file to PDF with dvipdfmx")
("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t
:help "Convert PostScript file to PDF")
("Index" "makeindex %s" TeX-run-index nil t
@@ -447,7 +449,7 @@ string."
("%(PDF)" (lambda ()
(if (and (eq TeX-engine 'default)
(if TeX-PDF-mode
- (not TeX-PDF-via-dvips-ps2pdf)
+ (not (TeX-PDF-from-DVI))
TeX-DVI-via-PDFTeX))
"pdf"
"")))
@@ -1269,7 +1271,7 @@ entry in `TeX-view-program-list-builtin'."
(if (and TeX-source-correlate-mode
(fboundp 'pdf-sync-forward-search))
(with-current-buffer (or (when TeX-current-process-region-p
- (get-file-buffer (TeX-region-file t)))
+ (get-file-buffer (TeX-region-file t)))
(current-buffer))
(pdf-sync-forward-search))
(let ((pdf (concat file "." (TeX-output-extension))))
@@ -1341,7 +1343,21 @@ DE is the name of the desktop environment, either
\"gnome\" or
(cond
((eq system-type 'windows-nt)
'(("Yap" ("yap -1" (mode-io-correlate " -s %n%b") " %o") "yap")
- ("dviout" ("dviout -1 %d" (mode-io-correlate "\"# %n %b\"")) "dviout")
+ ("dviout" ("dviout -1 "
+ ((paper-a4 paper-portrait) "-y=A4 ")
+ ((paper-a4 paper-landscape) "-y=A4L ")
+ ((paper-a5 paper-portrait) "-y=A5 ")
+ ((paper-a5 paper-landscape) "-y=A5L ")
+ ((paper-b5 paper-portrait) "-y=E5 ")
+ ((paper-b5 paper-landscape) "-y=E5L ")
+ ((paper-b4jis paper-portrait) "-y=B4 ")
+ ((paper-b4jis paper-landscape) "-y=B4L ")
+ ((paper-b5jis paper-portrait) "-y=B5 ")
+ ((paper-b5jis paper-landscape) "-y=B5L ")
+ (paper-legal "-y=Legal ")
+ (paper-letter "-y=Letter ")
+ (paper-executive "-y=Executive ")
+ "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout")
("SumatraPDF"
("SumatraPDF -reuse-instance"
(mode-io-correlate " -forward-search \"%b\" %n") " %o")
@@ -1584,7 +1600,11 @@ Check the `TeX-view-program-selection' variable"
viewer)))
((listp elt)
(when (TeX-view-match-predicate (car elt))
(setq command (concat command (cadr elt)))))))
- command))))
+ (if (stringp command)
+ command
+ ;; Signal an error if `command' isn't a string. This prevents an
+ ;; infinite loop in `TeX-command-expand' if `command' is nil.
+ (error "Wrong viewer specification in
`TeX-view-program-list'"))))))
;;; Engine
@@ -1818,7 +1838,9 @@ file and LINE to (+ LINE offset-of-region). Else, return
nil."
(with-current-buffer (or (find-buffer-visiting file)
(find-file-noselect file))
(goto-char 0)
- (when (re-search-forward "!offset(\\([[:digit:]]+\\))" nil t)
+ ;; Same regexp used in `preview-parse-messages'. XXX: XEmacs doesn't
+ ;; support regexp classes, so we can't use "[:digit:]" here.
+ (when (re-search-forward "!offset(\\([---0-9]+\\))" nil t)
(let ((offset (string-to-int (match-string-no-properties 1))))
(when TeX-region-orig-buffer
(list (expand-file-name (buffer-file-name TeX-region-orig-buffer))
@@ -2105,19 +2127,52 @@ already established, don't do anything."
:group 'TeX-command
:type 'boolean)
+(defcustom TeX-PDF-from-DVI nil
+ "Specify if and how to produce PDF output from a DVI file.
+
+If non-nil, the default compiler produces DVI output. The value
+should be the name of the command used to convert the DVI file to
+PDF or to an intermediate type.
+
+Possible values are
+
+* \"Dvips\": the DVI file is converted to PS with dvips. After
+ successfully running it, ps2pdf will be the default command to
+ convert the PS file to PDF
+* \"Dvipdfmx\": the PDF is produced with dvipdfmx
+
+Programs should not use this variable directly but the function
+`TeX-PDF-from-DVI' which handles now obsolete variable
+`TeX-PDF-via-dvips-ps2pdf'."
+ :group 'TeX-command
+ :type '(choice
+ (const :tag "No DVI to PDF conversion" nil)
+ (const :tag "dvips - ps2pdf sequence" "Dvips")
+ (const :tag "dvipdfmx" "Dvipdfmx")))
+;; If you plan to support new values of `TeX-PDF-from-DVI' remember to update
+;; `TeX-command-default' accordingly.
+(make-variable-buffer-local 'TeX-PDF-from-DVI)
+(put 'TeX-PDF-from-DVI 'safe-local-variable
+ (lambda (x) (or (stringp x) (null x))))
+
(defcustom TeX-PDF-via-dvips-ps2pdf nil
"Whether to produce PDF output through the (La)TeX - dvips - ps2pdf
sequence."
:group 'TeX-command
:type 'boolean)
(make-variable-buffer-local 'TeX-PDF-via-dvips-ps2pdf)
-(put 'TeX-PDF-via-dvips-ps2pdf 'safe-local-variable 'booleanp)
+(put 'TeX-PDF-via-dvips-ps2pdf 'safe-local-variable 'TeX-booleanp)
+(make-obsolete-variable 'TeX-PDF-via-dvips-ps2pdf 'TeX-PDF-from-DVI "11.90")
-(defun TeX-toggle-PDF-via-dvips-ps2pdf ()
- "Toggle `TeX-PDF-via-dvips-ps2pdf'."
- (interactive)
- (setq TeX-PDF-via-dvips-ps2pdf (not TeX-PDF-via-dvips-ps2pdf))
- (message (concat "TeX-PDF-via-dvips-ps2pdf: "
- (if TeX-PDF-via-dvips-ps2pdf "on" "off"))))
+(defun TeX-PDF-from-DVI ()
+ "Return the value of variable `TeX-PDF-from-DVI'.
+
+If `TeX-PDF-from-DVI' is not set and obsolete option
+`TeX-PDF-via-dvips-ps2pdf' is non-nil, return \"dvips-ps2pdf\"
+for backward compatibility."
+ (cond
+ (TeX-PDF-from-DVI)
+ (TeX-PDF-via-dvips-ps2pdf
+ "Dvips")))
(define-minor-mode TeX-interactive-mode
"Minor mode for interactive runs of TeX."
@@ -3466,7 +3521,7 @@ Choose `ignore' if you don't want AUCTeX to install
support for font locking."
(defvar TeX-format-list
'(("JLATEX" japanese-latex-mode
- "\\\\\\(documentstyle\\|documentclass\\)[^%\n]*{\\(j[s-]?\\|t\\)\
+ "\\\\\\(documentstyle\\|documentclass\\)[^%\n]*{u?\\(j[s-]?\\|t\\)\
\\(article\\|report\\|book\\|slides\\)")
("JTEX" japanese-plain-tex-mode
"-- string likely in Japanese TeX --")
@@ -3737,7 +3792,7 @@ The algorithm is as follows:
Optional third argument PLURAL is the plural form of TYPE.
By default just add an `s'.
-This function create a set of variables and functions to maintain a
+This macro creates a set of variables and functions to maintain a
separate type of information in the parser."
(let* ((names (or plural (concat name "s")))
(tmp (intern (concat prefix "-auto-" name)))
@@ -3935,6 +3990,7 @@ If TEX is a directory, generate style files for all files
in the directory."
LaTeX-provided-class-options))
(pkg-opts (if (boundp 'LaTeX-provided-package-options)
LaTeX-provided-package-options))
+ (tex-cmd-opts TeX-command-extra-options)
(verb-envs (when (boundp 'LaTeX-verbatim-environments-local)
LaTeX-verbatim-environments-local))
(verb-macros-delims (when (boundp
'LaTeX-verbatim-macros-with-delims-local)
@@ -3947,6 +4003,9 @@ If TEX is a directory, generate style files for all files
in the directory."
(erase-buffer)
(insert "(TeX-add-style-hook\n \""
style "\"\n (lambda ()")
+ (unless (string= tex-cmd-opts "")
+ (insert "\n (setq TeX-command-extra-options\n"
+ " " (prin1-to-string tex-cmd-opts) ")"))
(when class-opts
(insert "\n (TeX-add-to-alist 'LaTeX-provided-class-options\n"
" '" (prin1-to-string class-opts) ")"))
@@ -4804,7 +4863,7 @@ Brace insertion is only done if point is in a math
construct and
(defun TeX-newline ()
"Call the function specified by the variable `TeX-newline-function'."
- (interactive) (funcall TeX-newline-function))
+ (interactive) (call-interactively TeX-newline-function))
(defvar TeX-mode-map
(let ((map (make-sparse-keymap)))
@@ -4938,10 +4997,21 @@ Brace insertion is only done if point is in a math
construct and
:style toggle :selected TeX-PDF-mode
:active (not (eq TeX-engine 'omega))
:help "Use PDFTeX to generate PDF instead of DVI"]
- [ "PDF via dvips + ps2pdf" TeX-toggle-PDF-via-dvips-ps2pdf
- :style toggle :selected TeX-PDF-via-dvips-ps2pdf
+ ( "PDF from DVI"
:visible TeX-PDF-mode
- :help "Compile with (La)TeX and convert to PDF with dvips + ps2pdf"]
+ :help "Compile to DVI with (La)TeX and convert to PDF"
+ [ "Compile directly to PDF"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI nil))
+ :style radio :selected (null (TeX-PDF-from-DVI))
+ :help "Compile directly to PDF without intermediate conversions"]
+ [ "dvips + ps2pdf"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvips"))
+ :style radio :selected (equal (TeX-PDF-from-DVI) "Dvips")
+ :help "Convert DVI to PDF with dvips + ps2pdf sequence"]
+ [ "dvipdfmx"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvipdfmx"))
+ :style radio :selected (equal (TeX-PDF-from-DVI) "Dvipdfmx")
+ :help "Convert DVI to PDF with dvipdfmx"])
[ "Run Interactively" TeX-interactive-mode
:style toggle :selected TeX-interactive-mode :keys "C-c C-t C-i"
:help "Stop on errors in a TeX run"]
@@ -5928,7 +5998,10 @@ sign. With optional ARG, insert that many dollar signs."
(texmathp)
(boundp 'current-input-method) current-input-method
(string-match TeX-math-input-method-off-regexp current-input-method)
- (inactivate-input-method)))
+ ;; inactivate-input-method is obsolete since emacs 24.3.
+ (if (fboundp 'deactivate-input-method)
+ (deactivate-input-method)
+ (inactivate-input-method))))
;;; Simple Commands
@@ -6445,6 +6518,18 @@ NAME may be a package, a command, or a document."
(put 'TeX-newline 'delete-selection t)
(put 'TeX-insert-quote 'delete-selection t)
(put 'TeX-insert-backslash 'delete-selection t)
+;; When `TeX-electric-math' is non-nil, `TeX-insert-dollar' interferes with
+;; `delete-selection-mode', but when it's nil users may want to be able to
+;; delete active region if `delete-selection-mode' is active, see bug#23177.
We
+;; can dynamically determine the behavior of `delete-selection' with
+;; `TeX-insert-dollar' based on the value of `TeX-electric-math'. This
+;; dynamicity has been introduced in Emacs 24.3, for previous versions keep
+;; `TeX-insert-dollar' without this property.
+(if (or (> emacs-major-version 24)
+ (and (= emacs-major-version 24)
+ (>= emacs-minor-version 3)))
+ (put 'TeX-insert-dollar 'delete-selection
+ (lambda () (null TeX-electric-math))))
(defun TeX-how-many (regexp &optional rstart rend)
"Compatibily function for `how-many'.
diff --git a/texmathp.el b/texmathp.el
index e83f548..75eb2c0 100644
--- a/texmathp.el
+++ b/texmathp.el
@@ -287,7 +287,7 @@ See the variable `texmathp-tex-commands' about which
commands are checked."
(goto-char (cdr match))
(while (re-search-forward texmathp-toggle-regexp pos t)
(if (setq math-on (not math-on))
- (setq sw-match (cons (match-string 2) (match-beginning 2)))
+ (setq sw-match (cons (match-string-no-properties 2)
(match-beginning 2)))
(setq sw-match nil)))
(and math-on sw-match (setq match sw-match))))
@@ -336,7 +336,7 @@ Limit searched to BOUND. The return value is like
(\"equation\" . (point))."
(when (eq orig-comment-flag current-comment-flag)
(setq env (buffer-substring-no-properties
(match-beginning 2) (match-end 2)))
- (cond ((string= (match-string 1) "end")
+ (cond ((string= (match-string-no-properties 1) "end")
(setq end-list (cons env end-list)))
((equal env (car end-list))
(setq end-list (cdr end-list)))
- [elpa] elpa d83900b 09/51: TikZ: Make '+' and '++' prefixes apply to TikZ points, (continued)
- [elpa] elpa d83900b 09/51: TikZ: Make '+' and '++' prefixes apply to TikZ points, Tassilo Horn, 2016/05/22
- [elpa] elpa ae6cb79 26/51: Reword documentation of TeX-PDF-from-DVI, Tassilo Horn, 2016/05/22
- [elpa] elpa 1c397d5 29/51: Fix TeX-error-overview-make-entries, Tassilo Horn, 2016/05/22
- [elpa] elpa e092f72 35/51: Use commit date to determine package date, Tassilo Horn, 2016/05/22
- [elpa] elpa 7b41d77 38/51: Adapt for upLaTeX, Tassilo Horn, 2016/05/22
- [elpa] elpa d6b107e 33/51: Improve style/doc.el, Tassilo Horn, 2016/05/22
- [elpa] elpa cf54f7d 49/51: Make ChangeLog UTF-8, Tassilo Horn, 2016/05/22
- [elpa] elpa ebf4b8a 51/51: Release GNU AUCTeX 11.89.4, Tassilo Horn, 2016/05/22
- [elpa] elpa 8c6f901 48/51: Append environment indentation rules to LaTeX-indent-environment-list, Tassilo Horn, 2016/05/22
- [elpa] elpa e78a13c 03/51: * tex-buf.el: Address some compiler warnings, Tassilo Horn, 2016/05/22
- [elpa] elpa 8ed465a 50/51: Merge branch 'master' into elpa,
Tassilo Horn <=