[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 48fb645 25/25: Merge remote-tracking branch 'ori
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 48fb645 25/25: Merge remote-tracking branch 'origin/master' into externals/auctex |
Date: |
Sun, 21 Mar 2021 11:44:44 -0400 (EDT) |
branch: externals/auctex
commit 48fb6458960d8bd21e13b549e29c94db0091dd87
Merge: 04d69c5 da52023
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>
Merge remote-tracking branch 'origin/master' into externals/auctex
---
Makefile.in | 3 +-
bib-cite.el | 8 +-
context-en.el | 5 +-
context-nl.el | 5 +-
doc/auctex.texi | 33 +++++++
doc/install.texi | 51 +++++++++++
doc/preview-dtxdoc.pl | 4 +-
doc/quickstart.texi | 2 +-
latex.el | 3 +-
plain-tex.el | 4 +-
preview.el | 32 ++++---
style/bigdelim.el | 72 ++++++++++++---
style/changes.el | 242 +++++++++++++++++++++++++++++++++++++++++++++++++
style/comment.el | 101 +++++++++++++++++++--
style/footmisc.el | 90 +++++++++++++-----
style/footnotehyper.el | 86 ++++++++++++++++++
style/geometry.el | 1 +
style/hologo.el | 25 +++--
style/truncate.el | 59 ++++++++++++
tex-bar.el | 8 +-
tex-buf.el | 124 ++++++++++++++-----------
tex-info.el | 1 -
tex-jp.el | 4 +-
tex.el | 143 +++++++++++++++++++++--------
24 files changed, 927 insertions(+), 179 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 9afc328..1eda319 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -173,7 +173,8 @@ STYLESRC = style/prosper.el \
style/multitoc.el style/fbox.el style/xkcdcolors.el \
style/ltxguide.el style/revtex4-2.el style/overpic.el \
style/tex-live.el style/algorithm.el style/algpseudocode.el \
- style/appendix.el style/scholax.el style/extramarks.el
+ style/appendix.el style/scholax.el style/extramarks.el \
+ style/truncate.el style/changes.el style/footnotehyper.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/bib-cite.el b/bib-cite.el
index 0799c40..4e598eb 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -1022,7 +1022,9 @@ cases, *it* is searched. This allows you to trim down a
search further
by using bib-apropos sequentially."
;;(interactive "sBibTeX apropos: ")
(interactive)
- (let* ((keylist (and (boundp 'TeX-auto-update) ;Avoid error in FRAMEPOP
+ (let* ((keylist (and (boundp 'TeX-mode-p)
+ (or TeX-mode-p
+ (eq major-mode 'bibtex-mode)) ;Avoid error in
FRAMEPOP
(fboundp 'LaTeX-bibitem-list) ;Use this if using auctex
(LaTeX-bibitem-list)))
(keyword (bib-apropos-keyword-at-point))
@@ -2166,7 +2168,7 @@ of each bib file.
Puts the buffer in text-mode such that forward-sexp works with german \"
accents embeded in bibtex entries."
(let ((bib-list (or (and (fboundp 'LaTeX-bibliography-list)
- (boundp 'TeX-auto-update)
+ (boundp 'TeX-mode-p) TeX-mode-p
(LaTeX-bibliography-list))
;; LaTeX-bibliography-list (if bound) returns an unformatted list of
;; bib files used in the document, but only if parsing is turned on
@@ -2250,7 +2252,6 @@ although BiBTeX doesn't allow it!"
(mapcar 'list the-list)))))
(defvar TeX-auto-save)
-(defvar TeX-auto-update)
(defvar TeX-auto-regexp-list)
;; BibTeX-mode key def to create AUCTeX's parsing file.
@@ -2260,7 +2261,6 @@ although BiBTeX doesn't allow it!"
(if (not (require 'latex))
(error "Sorry, This is only useful if you have AUCTeX"))
(let ((TeX-auto-save t)
- (TeX-auto-update t)
(TeX-auto-regexp-list BibTeX-auto-regexp-list))
;; TeX-auto-write
;; -> calls TeX-auto-store
diff --git a/context-en.el b/context-en.el
index 4de977a..c545eea 100644
--- a/context-en.el
+++ b/context-en.el
@@ -1,6 +1,7 @@
-;;; context-en.el --- Support for the ConTeXt english interface.
+;;; context-en.el --- Support for the ConTeXt english interface. -*-
lexical-binding: t; -*-
-;; Copyright (C) 2003-2004, 2006, 2008, 2010, 2014, 2020 Free Software
Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006, 2008
+;; 2010, 2014, 2020, 2021 Free Software Foundation, Inc.
;; Maintainer: Berend de Boer <berend@pobox.com>
;; Keywords: tex
diff --git a/context-nl.el b/context-nl.el
index debda1f..55fcb09 100644
--- a/context-nl.el
+++ b/context-nl.el
@@ -1,6 +1,7 @@
-;;; context-nl.el --- Support for the ConTeXt dutch interface.
+;;; context-nl.el --- Support for the ConTeXt dutch interface. -*-
lexical-binding: t; -*-
-;; Copyright (C) 2003, 2004, 2006, 2010, 2015, 2020 Free Software Foundation,
Inc.
+;; Copyright (C) 2003, 2004, 2006, 2010,
+;; 2015, 2020, 2021 Free Software Foundation, Inc.
;; Maintainer: Berend de Boer <berend@pobox.com>
;; Keywords: tex
diff --git a/doc/auctex.texi b/doc/auctex.texi
index fad97d6..4342b56 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -3905,6 +3905,39 @@ the current buffer, or if already there, to the file
where the current
process was started.
@end deffn
+Additionally, output files produced by @AUCTeX{} can be placed in a
+separate directory.
+
+@defopt TeX-output-dir
+Set this option to the path of a directory where output files will be
+placed. The output files include those that are produced by applications
+running under @AUCTeX{}, temporary files related to region processing and
+the @previewlatex{} files. If a relative path is specified, it is
+interpreted as being relative to the master file in a mutlifile document.
+
+This is a buffer local variable and must be set separately for all
+documents and all files in a multifile document. For example,
+
+@example
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-output-dir: "build"
+%%% End:
+@end example
+
+Alternatively, you may use @code{setq-default} to set the default value of
+this option or set it as a directory local variable (see
+@code{add-dir-local-variable}).
+
+Note that a non-nil value of @code{TeX-output-dir} might be incompatible
+with some @TeX{} commands and macros. In particular, the @LaTeX{} macro
+@samp{\include} is known to not work with this option. Some @TeX{}
+packages which produce intermediary files might also be incompatible. A
+possible workaround for those packages is to append the value of
+@code{TeX-output-dir} to the environment variables @samp{TEXINPUTS} and
+@samp{BIBINPUTS}.
+@end defopt
+
@node Cleaning
@section Cleaning intermediate and output files
@cindex Cleaning
diff --git a/doc/install.texi b/doc/install.texi
index d055e4c..a286cae 100644
--- a/doc/install.texi
+++ b/doc/install.texi
@@ -520,6 +520,57 @@ If you want others to be able to share your installation,
you should
configure it using @samp{--without-texmf-dir}, in which case things
should work as well for them as for you.
+@subsection Using @AUCTeX{} from local Git repo
+
+With the techniques described above, it is also possible to use @AUCTeX{}
+directly from a local Git repository. Let's assume you have your Git
+repositories under @samp{~/development/}.
+
+First, you have to fetch a copy of the @AUCTeX{} Git repository. In a
+shell, change directory to @samp{~/development/} and do:
+@example
+git clone https://git.savannah.gnu.org/git/auctex.git
+@end example
+
+Now change directory to @samp{~/development/auctex} and run
+@samp{./autogen.sh}. Next thing is to run @command{configure} like this:
+@example
+./configure --without-texmf-dir --with-lispdir=.
+@end example
+
+@noindent
+When finished, simply enter
+@example
+make
+@end example
+@noindent
+and you're finished. Note that the @samp{make install} step is not
+necessary.
+
+Now you have to tell Emacs about the plan. The following variables must
+be set in your init file because their normal values are only correct when
+@AUCTeX{} is installed:
+@lisp
+(setq TeX-data-directory "~/development/auctex"
+ TeX-lisp-directory TeX-data-directory)
+@end lisp
+
+@noindent
+The info files will be available with this:
+@lisp
+(eval-after-load 'info
+ '(add-to-list 'Info-additional-directory-list
+ "~/development/auctex/doc"))
+@end lisp
+
+@noindent
+Now you're ready to load @file{auctex.el} and @file{preview-latex.el} out
+of this directory:
+@lisp
+(load "~/development/auctex/auctex.el" nil t t)
+(load "~/development/auctex/preview-latex.el" nil t t)
+@end lisp
+
@ifclear rawfile
@node Installation under MS Windows
@section Installation under MS Windows
diff --git a/doc/preview-dtxdoc.pl b/doc/preview-dtxdoc.pl
index 52d28cb..8eaa33d 100755
--- a/doc/preview-dtxdoc.pl
+++ b/doc/preview-dtxdoc.pl
@@ -1,12 +1,12 @@
#!/usr/bin/perl
-# -*- coding: iso-latin-1-unix; -*-
+# -*- coding: iso-latin-1; -*-
# Autoconverter from preview.dtx to preview-dtxdoc.texi
# Author: Jan-�ke Larsson <jalar@mai.liu.se>
# Maintainer: auctex-devel@gnu.org
-# Copyright (C) 2002, 2005, 2020 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2005, 2020, 2021 Free Software Foundation, Inc.
# This file is part of AUCTeX.
diff --git a/doc/quickstart.texi b/doc/quickstart.texi
index cc9631e..0bea60d 100644
--- a/doc/quickstart.texi
+++ b/doc/quickstart.texi
@@ -168,7 +168,7 @@ Insert @i{slanted} @samp{\textsl@{@point{}@}} text.
@item C-c C-f C-r
@kindex C-c C-f C-r
@cindex @code{\textrm}
-Insert roman @r{\textrm@{@point{}@}} text.
+Insert roman @samp{\textrm@{@point{}@}} text.
@item C-c C-f C-f
@kindex C-c C-f C-f
diff --git a/latex.el b/latex.el
index b4fd7d3..d5d5621 100644
--- a/latex.el
+++ b/latex.el
@@ -1990,7 +1990,6 @@ It will setup BibTeX to store keys in an auto file."
;; add it before we enter BibTeX mode the first time.
(add-hook 'write-contents-functions #'TeX-safe-auto-write nil t)
(TeX-bibtex-set-BibTeX-dialect)
- (set (make-local-variable 'TeX-auto-update) 'BibTeX)
(set (make-local-variable 'TeX-auto-untabify) nil)
(set (make-local-variable 'TeX-auto-parse-length) 999999)
(set (make-local-variable 'TeX-auto-regexp-list) BibTeX-auto-regexp-list)
@@ -6048,7 +6047,7 @@ This happens when \\left is inserted."
(TeX-abbrev-mode-setup latex-mode)
;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.drv\\'" . latex-mode))
+(add-to-list 'auto-mode-alist '("\\.drv\\'" . latex-mode) t) ;; append to the
end of `auto-mode-alist' to give higher priority to Guix/Nix's derivation modes
;; HeVeA files (LaTeX -> HTML converter: http://hevea.inria.fr/)
;;;###autoload
diff --git a/plain-tex.el b/plain-tex.el
index f2eaea8..9fd0fad 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -1,6 +1,6 @@
-;;; plain-tex.el --- Support for plain TeX documents.
+;;; plain-tex.el --- Support for plain TeX documents. -*- lexical-binding: t;
-*-
-;; Copyright (C) 2010, 2013, 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010, 2013, 2016-2018, 2021 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Keywords: tex
diff --git a/preview.el b/preview.el
index 08ea45c..f218b06 100644
--- a/preview.el
+++ b/preview.el
@@ -552,7 +552,7 @@ if you customize this."
:type 'string)
(defcustom preview-pdf2dsc-command
- "pdf2dsc %s.pdf %m/preview.dsc"
+ "pdf2dsc %(O?pdf) %m/preview.dsc"
"Command used for generating dsc from a PDF file."
:group 'preview-latex
:type 'string)
@@ -2771,7 +2771,7 @@ list of LaTeX commands is inserted just before
\\begin{document}."
(defcustom preview-LaTeX-command '("%`%l \"\\nonstopmode\\nofiles\
\\PassOptionsToPackage{" ("," . preview-required-option-list) "}{preview}\
\\AtBeginDocument{\\ifx\\ifPreview\\undefined"
-preview-default-preamble "\\fi}\"%' \"\\detokenize{\" %t \"}\"")
+preview-default-preamble "\\fi}\"%' \"\\detokenize{\" %(t-filename-only)
\"}\"")
;; Since TeXLive 2018, the default encoding for LaTeX files has been
;; changed to UTF-8 if used with classic TeX or pdfTeX. I.e.,
;; \usepackage[utf8]{inputenc} is enabled by default in (pdf)latex.
@@ -3155,7 +3155,10 @@ later while in use."
topdir
0))
(shell-quote-argument
- (concat (file-name-as-directory (file-name-nondirectory topdir))
+ (concat (file-name-as-directory
+ ;; Don't use topdir, because %m expects the path to be
+ ;; relative to master
+ (TeX-active-master "prv" t))
(file-name-nondirectory (nth 0 TeX-active-tempdir))))))
(defun preview-parse-counters (string)
@@ -3911,8 +3914,8 @@ This is passed through `preview-do-replacements'."
;; If -kanji option exists, pick it up as the second match.
;; Discard all other options.
("\\`\\([^ ]+\\)\
-\\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|-\\(?:[^
\\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*\\(.*\\)\\'"
- . ("\\1 -ini \\2 -interaction=nonstopmode \"&\\1\" " preview-format-name
".ini \\3")))
+\\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|\\(--?output-directory[= ][^
]+\\)\\|-\\(?:[^ \\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*\\(.*\\)\\'"
+ . ("\\1 -ini \\2 \\3 -interaction=nonstopmode \"&\\1\" "
preview-format-name ".ini \\4")))
"Generate a dump command from the usual preview command."
:group 'preview-latex
:type '(repeat
@@ -3923,10 +3926,10 @@ This is passed through `preview-do-replacements'."
;; If -kanji option exists, pick it up as the second match.
;; Discard all other options.
'(("\\`\\([^ ]+\\)\
-\\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|-\\(?:[^
\\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*.*\
+\\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|\\(--?output-directory[= ][^
]+\\)\\|-\\(?:[^ \\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*.*\
\"\\\\input\" \"\\\\detokenize{\" \\(.*\\) \"}\"\\'"
- . ("\\1 \\2 -interaction=nonstopmode -file-line-error "
- preview-format-name " \"/AUCTEXINPUT{\" \\3 \"}\"")))
+ . ("\\1 \\2 \\3 -interaction=nonstopmode -file-line-error "
+ preview-format-name " \"/AUCTEXINPUT{\" \\4 \"}\"")))
;; See the ini file code below in `preview-cache-preamble' for the
;; weird /AUCTEXINPUT construct. In short, it is crafted so that
;; dumped format file can read file of non-ascii name.
@@ -3947,6 +3950,7 @@ format available.
If FORMAT-CONS is non-nil, a previous format may get reused."
(interactive)
+ (setq TeX-current-process-region-p nil)
(let* ((dump-file
(expand-file-name (preview-dump-file-name (TeX-master-file "ini"))))
(master (TeX-master-file))
@@ -3977,8 +3981,7 @@ If FORMAT-CONS is non-nil, a previous format may get
reused."
\\catcode`/ 0 %
\\def\\AUCTEXINPUT##1{\\catcode`/ 12\\relax\\catcode`\\
9\\relax\\input\\detokenize{##1}\\relax}%
\\let\\dump\\PREVIEWdump\\dump}\\input mylatex.ltx \\relax%\n" nil dump-file)
- (TeX-save-document master)
- (setq TeX-current-process-region-p nil)
+ (TeX-save-document #'TeX-master-file)
(prog1 (preview-generate-preview master command)
(add-hook 'kill-emacs-hook #'preview-cleanout-tempfiles t)
(setq TeX-sentinel-function
@@ -4065,7 +4068,7 @@ stored in `preview-dumped-alist'."
(defun preview-document ()
"Run preview on master document."
(interactive)
- (TeX-save-document (TeX-master-file))
+ (TeX-save-document #'TeX-master-file)
(setq TeX-current-process-region-p nil)
(preview-generate-preview
(TeX-master-file)
@@ -4160,7 +4163,12 @@ internal parameters, STR may be a log to insert into the
current log."
((preview-format-name (shell-quote-argument
(concat "&"
(preview-dump-file-name
- (file-name-nondirectory master)))))
+ ;; Get the filename from
+ ;; `TeX-master-file' with prv to
+ ;; get the correct path but then
+ ;; strip the extension
+ (file-name-sans-extension
+ (TeX-master-file "prv" t))))))
(process-environment (copy-sequence process-environment))
(process
(progn
diff --git a/style/bigdelim.el b/style/bigdelim.el
index 30938d3..7f0dee5 100644
--- a/style/bigdelim.el
+++ b/style/bigdelim.el
@@ -1,6 +1,6 @@
;;; bigdelim.el --- AUCTeX style for `bigdelim.sty' -*- lexical-binding: t;
-*-
-;; Copyright (C) 2011, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2011--2021 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
@@ -26,28 +26,74 @@
;;; Commentary:
-;; This file adds support for `bigdelim.sty'.
+;; This file adds support for `bigdelim.sty', v2.6 from 2021/01/02.
;;; Code:
(require 'tex)
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+ "font-latex"
+ (keywords class))
+
+(defun TeX-arg-bigdelim-brace (optional side &optional prompt)
+ "Prompt for a single brace, and do not insert the matching one.
+If OPTIONAL is non-nil, include the argument only if not empty.
+SIDE is one of the symbols `left' or `right'. PROMPT replaces the
+standard one."
+ (let* ((brace (completing-read
+ (TeX-argument-prompt optional prompt "Brace")
+ (if (eq side 'left)
+ '("(" "[" "{" "\\langle" "|" "\\|" "\\lceil" "\\lfloor")
+ '(")" "]" "}" "\\rangle" "|" "\\|" "\\rceil" "\\rfloor"))))
+ (TeX-arg-opening-brace (if (member (substring brace 0 1)
+ `("{" "}" ,TeX-esc))
+ ""
+ TeX-grop))
+ (TeX-arg-closing-brace (if (string= TeX-arg-opening-brace TeX-grop)
+ TeX-grcl
+ "")))
+ (TeX-argument-insert brace optional (when (member brace '("{" "}"))
+ TeX-esc))))
+
(TeX-add-style-hook
"bigdelim"
(lambda ()
+
+ (TeX-run-style-hooks "multirow")
+
(TeX-add-symbols
- '("ldelim" TeX-arg-bigdelim-brace "Number of rows for multirow"
- "Width in multirow" [ "Text in multirow" ])
- '("rdelim" TeX-arg-bigdelim-brace "Number of rows for multirow"
- "Width in multirow" [ "Text in multirow" ])))
- TeX-dialect)
+ '("ldelim"
+ (TeX-arg-bigdelim-brace left)
+ "Number of rows for multirow"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt nil nil "Width in multirow")
+ (append
+ '("*")
+ (mapcar (lambda (x)
+ (concat TeX-esc (car x)))
+ (LaTeX-length-list))))
+ [ "Text in multirow" ])
+ '("rdelim"
+ (TeX-arg-bigdelim-brace right)
+ "Number of rows for multirow"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt nil nil "Width in multirow")
+ (append
+ '("*")
+ (mapcar (lambda (x)
+ (concat TeX-esc (car x)))
+ (LaTeX-length-list))))
+ [ "Text in multirow" ]))
-(defun TeX-arg-bigdelim-brace (optional &optional prompt)
- "Prompt for a single brace, and do not insert the matching
- right parentheses."
- (let ((brace (read-from-minibuffer
- (TeX-argument-prompt optional prompt "Brace") nil)))
- (insert (format "%s" brace))))
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("ldelim" "|{\\{{[")
+ ("rdelim" "|{\\{{["))
+ 'function)))
+ TeX-dialect)
(defvar LaTeX-bigdelim-package-options nil
"Package options for the bigdelim package.")
diff --git a/style/changes.el b/style/changes.el
new file mode 100644
index 0000000..9c3bff5
--- /dev/null
+++ b/style/changes.el
@@ -0,0 +1,242 @@
+;;; changes.el --- AUCTeX style for `changes.sty' -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2021-01-31
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+;; MA 02110-1301 USA.
+
+;;; Commentary:
+
+;; This file adds support for `changes.sty' v4.0.0. from 2021/01/28.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+ "font-latex"
+ (keywords class))
+(defvar LaTeX-xcolor-base-colors)
+(defvar LaTeX-truncate-package-options)
+(defvar LaTeX-ulem-package-options)
+(defvar LaTeX-xcolor-package-options)
+
+(TeX-auto-add-type "changes-definechangesauthor" "LaTeX")
+
+(defvar LaTeX-changes-definechangesauthor-regexp
+ `(,(concat "\\\\definechangesauthor"
+ "[ \t\n\r%]*"
+ "\\(?:\\[[^]]*\\]\\)?"
+ "[ \t\n\r%]*"
+ "{\\([^}]+\\)}")
+ 1 LaTeX-auto-changes-definechangesauthor)
+ "Matches the id defined by \\definechangesauthor.")
+
+(defun LaTeX-changes-auto-prepare ()
+ "Reset `LaTeX-auto-changes-definechangesauthor'."
+ (setq LaTeX-auto-changes-definechangesauthor nil))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-changes-auto-prepare t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun LaTeX-arg-changes-definechangesauthor (optional)
+ "Prompt for the arguments of \\definechangesauthor macro.
+While reading the first optional argument, remove space from
+`crm-local-completion-map' and `minibuffer-local-completion-map'.
+Insert the argument in brackets if OPTIONAL is non-nil."
+ (let* ((crm-local-completion-map
+ (remove (assoc 32 crm-local-completion-map)
+ crm-local-completion-map))
+ (minibuffer-local-completion-map
+ (remove (assoc 32 minibuffer-local-completion-map)
+ minibuffer-local-completion-map))
+ (TeX-last-optional-rejected nil)
+ (keyval (LaTeX-check-insert-macro-default-style
+ (TeX-read-key-val
+ t
+ `(("name")
+ ("color"
+ ,(cond
+ ((and (member "xcolor" (TeX-style-list))
+ (fboundp 'LaTeX-xcolor-definecolor-list))
+ (mapcar #'car (LaTeX-xcolor-definecolor-list)))
+ ((and (member "color" (TeX-style-list))
+ (fboundp 'LaTeX-color-definecolor-list))
+ (mapcar #'car (LaTeX-color-definecolor-list)))
+ (t nil)))))))
+ (TeX-arg-opening-brace LaTeX-optop)
+ (TeX-arg-closing-brace LaTeX-optcl))
+ (when keyval (TeX-argument-insert keyval t)))
+ (let ((id (TeX-read-string
+ (TeX-argument-prompt optional nil "Author ID"))))
+ (LaTeX-add-changes-definechangesauthors id)
+ (TeX-argument-insert id optional)))
+
+(defun LaTeX-arg-changes-markup (optional)
+ "Prompt for the argument of various markup commands.
+Remove space from `crm-local-completion-map' and
+`minibuffer-local-completion-map' while reading user input.
+Insert the argument in brackets if OPTIONAL is non-nil."
+ (let* ((crm-local-completion-map
+ (remove (assoc 32 crm-local-completion-map)
+ crm-local-completion-map))
+ (minibuffer-local-completion-map
+ (remove (assoc 32 minibuffer-local-completion-map)
+ minibuffer-local-completion-map))
+ (keyval (TeX-read-key-val
+ optional
+ `(("id" ,(mapcar #'car
+ (LaTeX-changes-definechangesauthor-list)))
+ ("comment")))))
+ (TeX-argument-insert keyval optional)))
+
+(TeX-add-style-hook
+ "changes"
+ (lambda ()
+
+ ;; Add changes to the parser
+ (TeX-auto-add-regexp LaTeX-changes-definechangesauthor-regexp)
+
+ ;; Run AUCTeX style hooks based on given package options: This is
+ ;; more complicated since we're only looking after "ulem" or
+ ;; "xcolor" and don't really care about the given options to them:
+ (when (assoc "changes" LaTeX-provided-package-options)
+ (dolist (pkg '("ulem" "xcolor"))
+ (let ((opts (cdr (assoc "changes"
+ LaTeX-provided-package-options))))
+ (when (string-match (concat "\\<" pkg "\\>")
+ (mapconcat #'identity opts "|"))
+ (TeX-run-style-hooks pkg)))))
+
+ ;; truncate.sty is always loaded:
+ (TeX-run-style-hooks "truncate")
+
+ (TeX-add-symbols
+ ;; 4.2 Change management
+ '("added" [ LaTeX-arg-changes-markup ] 1)
+ '("deleted" [ LaTeX-arg-changes-markup ] 1)
+ '("replaced" [ LaTeX-arg-changes-markup ] 2)
+
+ ;; 4.3 Highlighting and Comments
+ '("highlight" [ LaTeX-arg-changes-markup ] 1)
+ '("comment"
+ [TeX-arg-eval
+ TeX-read-key-val t `(("id"
+ ,(mapcar #'car
+
(LaTeX-changes-definechangesauthor-list))))]
+ 1)
+
+ ;; 4.4 Overview of changes
+ '("listofchanges"
+ [TeX-arg-key-val (("style" ("list" "summary" "compactsummary"))
+ ("title")
+ ("show" ("all" "added" "deleted"
+ "replaced" "highlight" "comment")))])
+
+ ;; 4.5 Author management \definechangesauthor
+ '("definechangesauthor" LaTeX-arg-changes-definechangesauthor)
+
+ ;; 4.6 Adaption of the output:
+ '("setaddedmarkup" "Definition")
+ '("setdeletedmarkup" "Definition")
+ '("sethighlightmarkup" "Definition")
+ '("setcommentmarkup" "Definition")
+ '("setauthormarkup" "Definition")
+ '("setauthormarkupposition"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Position")
+ '("left" "right")))
+ '("setauthormarktext"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Markup")
+ '("id" "name")))
+ '("settruncatewidth" (TeX-arg-length "Width"))
+ '("setsummarywidth" (TeX-arg-length "Width"))
+ '("setsummarytowidth" "Text")
+ '("setlocextension" "Extension")
+ '("setsocextension" "Extension"))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("definechangesauthor" "[{")
+ ("setaddedmarkup" "{")
+ ("setdeletedmarkup" "{")
+ ("sethighlightmarkup" "{")
+ ("setcommentmarkup" "{")
+ ("setauthormarkup" "{")
+ ("setauthormarkupposition" "{")
+ ("setauthormarktext" "{")
+ ("settruncatewidth" "{")
+ ("setsummarywidth" "{")
+ ("setsummarytowidth" "{")
+ ("setlocextension" "{")
+ ("setsocextension" "{"))
+ 'function)
+ (font-latex-add-keywords '(("added" "[{")
+ ("deleted" "[{")
+ ("replaced" "[{{")
+ ("highlight" "[{")
+ ("comment" "[{"))
+ 'textual)
+ (font-latex-add-keywords '(("listofchanges" "["))
+ 'reference)))
+ TeX-dialect)
+
+(defun LaTeX-changes-package-options ()
+ "Prompt for package options for the changes package."
+ (TeX-load-style "xcolor")
+ (TeX-load-style "truncate")
+ (TeX-load-style "ulem")
+ (TeX-read-key-val
+ t
+ (append
+ `(("defaultcolor"
+ ,(if (and (fboundp 'LaTeX-xcolor-definecolor-list)
+ (LaTeX-xcolor-definecolor-list))
+ (mapcar #'car (LaTeX-xcolor-definecolor-list))
+ LaTeX-xcolor-base-colors)))
+ `(("draft")
+ ("final")
+ ("commandnameprefix" ("none" "ifneeded" "always"))
+ ("markup" ("default" "underlined" "bfit" "nocolor"))
+ ("addedmarkup" ("colored" "uline" "uuline" "uwave"
+ "dashuline" "dotuline"
+ "bf" "it" "sl" "em"))
+ ("deletedmarkup" ("sout" "xout" "colored"
+ "uline" "uuline" "uwave"
+ "dashuline" "dotuline"
+ "bf" "it" "sl" "em"))
+ ("highlightmarkup" ("background" "uuline" "uwave"))
+ ("commentmarkup" ("todo" "margin" "footnote" "uwave"))
+ ("authormarkup" ("superscript" "subscript" "brackets"
+ "footnote" "none"))
+ ("authormarkupposition" ("right" "left"))
+ ("authormarkuptext" ("id" "name"))
+ ("todonotes")
+ ("truncate" ,LaTeX-truncate-package-options)
+ ("ulem" ,LaTeX-ulem-package-options)
+ ("xcolor" ,LaTeX-xcolor-package-options)))))
+
+;;; changes.el ends here
diff --git a/style/comment.el b/style/comment.el
index 1e20e7e..8d0c90c 100644
--- a/style/comment.el
+++ b/style/comment.el
@@ -1,6 +1,6 @@
;;; comment.el --- AUCTeX style for `comment.sty' -*- lexical-binding: t; -*-
-;; Copyright (C) 2007, 2018, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2018--2021 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
@@ -37,24 +37,108 @@
(declare-function font-latex-add-keywords
"font-latex"
(keywords class))
-
(declare-function font-latex-set-syntactic-keywords
"font-latex")
-
(defvar font-latex-syntactic-keywords-extra)
+;; Prepare for parsing:
+(TeX-auto-add-type "comment-incl-excl" "LaTeX")
+
+(defvar LaTeX-comment-include-exclude-regexp
+ '("\\\\\\(include\\|exclude\\|special\\)comment[ \t\n\r%]*{\\([^}]+\\)}"
+ (2 1) LaTeX-auto-comment-incl-excl)
+ "Matches the name of environments defined by comment macros.")
+
+(defun LaTeX-comment-auto-prepare ()
+ "Reset the value of `LaTeX-auto-comment-incl-excl'."
+ (setq LaTeX-auto-comment-incl-excl nil))
+
+(defun LaTeX-comment-auto-cleanup ()
+ "Process parsed elements for comment package."
+ (dolist (elt (LaTeX-comment-incl-excl-list))
+ (let ((env (car elt))
+ (type (cadr elt)))
+ ;; Make the environment available for completion
+ (LaTeX-add-environments env)
+ ;; Fontification
+ (when (and (boundp 'font-latex-syntactic-keywords-extra)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ ;; For syntactic fontification.
+ (if (string= type "exclude")
+ ;; Argument of \excludecomment:
+ (progn
+ (add-to-list 'font-latex-syntactic-keywords-extra
+ ;; \begin is supposed to start at the
+ ;; beginning of a line.
+ `(,(format "^\\\\begin *{%s}.*\\(\n\\)"
+ env)
+ (1 "!" t)))
+ (add-to-list 'font-latex-syntactic-keywords-extra
+ ;; \end is supposed to start at the
+ ;; beginning of a line.
+ `(,(format "^\\(\\\\\\)end *{%s}"
+ env)
+ (1 "!" t))))
+ ;; Delete the entry from
+ ;; `font-latex-syntactic-keywords-extra' if argument of
+ ;; \includecomment or \specialcomment:
+ (setq font-latex-syntactic-keywords-extra
+ (delete `(,(format "^\\\\begin *{%s}.*\\(\n\\)"
+ env)
+ (1 "!" t))
+ font-latex-syntactic-keywords-extra))
+ (setq font-latex-syntactic-keywords-extra
+ (delete `(,(format "^\\(\\\\\\)end *{%s}"
+ env)
+ (1 "!" t))
+ font-latex-syntactic-keywords-extra))))))
+ ;; Recalculate the fontification rules once at the end:
+ (when (and (LaTeX-comment-incl-excl-list)
+ (fboundp 'font-latex-set-syntactic-keywords)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-set-syntactic-keywords)))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-comment-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-comment-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
(TeX-add-style-hook
"comment"
(lambda ()
+
+ ;; Add comment to the parser.
+ (TeX-auto-add-regexp LaTeX-comment-include-exclude-regexp)
+
;; New symbols
(TeX-add-symbols
- '("includecomment" "Name")
- '("excludecomment" "Name")
- '("specialcomment" "Name" "Before commands" "After commands")
+ '("includecomment"
+ (TeX-arg-eval let ((env (TeX-read-string
+ (TeX-argument-prompt nil nil "Name"))))
+ (LaTeX-add-comment-incl-excls `(,env "include"))
+ (LaTeX-comment-auto-cleanup)
+ (format "%s" env)))
+
+ '("excludecomment"
+ (TeX-arg-eval let ((env (TeX-read-string
+ (TeX-argument-prompt nil nil "Name"))))
+ (LaTeX-add-comment-incl-excls `(,env "exclude"))
+ (LaTeX-comment-auto-cleanup)
+ (format "%s" env)))
+
+ '("specialcomment"
+ (TeX-arg-eval let ((env (TeX-read-string
+ (TeX-argument-prompt nil nil "Name"))))
+ (LaTeX-add-comment-incl-excls `(,env "special"))
+ (LaTeX-comment-auto-cleanup)
+ (format "%s" env))
+ "Before commands" "After commands")
+
'("processcomment" "Name" "Each-line commands"
"Before commands" "After commands"))
+
;; New environments
- (mapc 'LaTeX-add-environments LaTeX-comment-env-list)
+ (mapc #'LaTeX-add-environments LaTeX-comment-env-list)
+
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
(eq TeX-install-font-lock 'font-latex-setup))
@@ -78,4 +162,7 @@
(font-latex-set-syntactic-keywords)))
TeX-dialect)
+(defvar LaTeX-comment-package-options nil
+ "Package options for the comment package.")
+
;;; comment.el ends here
diff --git a/style/footmisc.el b/style/footmisc.el
index dc3a807..7069e89 100644
--- a/style/footmisc.el
+++ b/style/footmisc.el
@@ -1,6 +1,6 @@
;;; footmisc.el --- AUCTeX style for `footmisc.sty' -*- lexical-binding: t;
-*-
-;; Copyright (C) 2011, 2018, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2018--2021 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Created: 2011-04-08
@@ -25,7 +25,7 @@
;;; Commentary:
-;; This file adds support for `footmisc.sty'.
+;; This file adds support for `footmisc.sty' (v5.5b) from 2011/06/06.
;;; Code:
@@ -40,34 +40,80 @@
"footmisc"
(lambda ()
(TeX-add-symbols
- '("DefineFNsymbols" "Name" [ "Style (text or math) " ] 1)
- '("DefineFNsymbols*" "Name" [ "Style (text or math)" ] 1)
+
+ ;; 1.4 Option ragged and \footnotelayout
+ "footnotelayout"
+
+ ;; 1.7 The \setfnsymbol and \DefineFNsymbols commands
+ '("DefineFNsymbols"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt nil nil "Name")
+ '("bringhurst" "chicago" "wiley"
+ "lamport" "lamport*"))
+ [TeX-arg-eval completing-read
+ (TeX-argument-prompt t nil "Style (text or math)")
+ '("text" "math")]
+ 1)
+ '("DefineFNsymbols*"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt nil nil "Name")
+ '("bringhurst" "chicago" "wiley"
+ "lamport" "lamport*"))
+ [TeX-arg-eval completing-read
+ (TeX-argument-prompt t nil "Style (text or math)")
+ '("text" "math")]
+ 1)
+
;; These two commands define both text and math variants of the
;; footnote symbols
- '("DefineFNsymbolsTM" "Name" 1)
- '("DefineFNsymbolsTM*" "Name" 1)
- '("setfnsymbol" "Name")
- '("mpfootnoterule" TeX-arg-size)
- "pagefootnoterule"
- "splitfootnoterule"
- ;; The following command references a label inside in a footnote
- '("footref" TeX-arg-ref)
+ '("DefineFNsymbolsTM"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt nil nil "Name")
+ '("bringhurst" "chicago" "wiley"
+ "lamport" "lamport*"))
+ 1)
+ '("DefineFNsymbolsTM*"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt nil nil "Name")
+ '("bringhurst" "chicago" "wiley"
+ "lamport" "lamport*"))
+ 1)
+ '("setfnsymbol"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt nil nil "Name")
+ '("bringhurst" "chicago" "wiley"
+ "lamport" "lamport*")))
+
+ ;; 1.11 Option hang
"hangfootparskip"
"hangfootparindent"
- "footnotehint"
- '("footnotemargin" TeX-arg-size)
- "mpfootnoterule"
+
+ ;; 1.15 The multiple option
"multiplefootnotemarker"
- "multfootsep")
+ "multfootsep"
+
+ ;; 1.16 User interface
+ ;; The following command references a label inside in a footnote
+ '("footref" TeX-arg-ref)
+ "mpfootnotemark")
+
+ ;; 1.9 Option marginal
+ (LaTeX-add-lengths "footnotemargin")
+
+ ;; 1.13 Option splitrule
+ (when (LaTeX-provided-package-options-member "footmisc" "splitrule")
+ (TeX-add-symbols "mpfootnoterule"
+ "pagefootnoterule"
+ "splitfootnoterule"))
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
- (font-latex-add-keywords '(("DefineFNsymbols" "{[{")
- ("DefineFNsymbols*" "{[{")
- ("DefineFNsymbolsTM" "{{")
- ("DefineFNsymbolsTM*" "{{")
- ("setfnsymbol" "{")) 'function)
- (font-latex-add-keywords '(("footnoteref")) 'reference)))
+ (font-latex-add-keywords '(("DefineFNsymbols" "*{[{")
+ ("DefineFNsymbolsTM" "*{{")
+ ("setfnsymbol" "{"))
+ 'function)
+ (font-latex-add-keywords '(("footref"))
+ 'reference)))
TeX-dialect)
(defvar LaTeX-footmisc-package-options '("perpage" "side" "ragged"
diff --git a/style/footnotehyper.el b/style/footnotehyper.el
new file mode 100644
index 0000000..d97e5b2
--- /dev/null
+++ b/style/footnotehyper.el
@@ -0,0 +1,86 @@
+;;; footnotehyper.el --- AUCTeX style for `footnotehyper.sty' -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2021-01-31
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+;; MA 02110-1301 USA.
+
+;;; Commentary:
+
+;; This file adds support for `footnotehyper.sty'.
+
+;;; Code:
+
+(require 'tex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+ "font-latex"
+ (keywords class))
+
+(defun LaTeX-arg-footnotehyper-savenotes (_optional)
+ "Insert the corresponding \\spewnotes macro after \\savenotes.
+OPTIONAL is ignored."
+ (just-one-space)
+ (save-excursion
+ (insert TeX-esc "spewnotes")))
+
+(TeX-add-style-hook
+ "footnotehyper"
+ (lambda ()
+
+ ;; Environment defined by the package. Query for optional footnote
+ ;; numbers depends on the value of `TeX-arg-footnote-number-p':
+ (LaTeX-add-environments
+ '("savenotes")
+ '("footnote" LaTeX-env-args
+ (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil))
+ '("footnotetext" LaTeX-env-args
+ (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)))
+
+ ;; New symbols
+ (TeX-add-symbols
+ '("savenotes" LaTeX-arg-footnotehyper-savenotes)
+ '("spewnotes" 0)
+
+ ;; The syntax is \makesavenoteenv[bar]{foo} where `bar' is a new
+ ;; environment of patched environment `foo'. This command isn't
+ ;; recommended; hence we don't add parsing capabilities to this
+ ;; style in order to extract the newly defined environments
+ ;; automatically:
+ '("makesavenoteenv"
+ [TeX-arg-environment "New environment" t]
+ (TeX-arg-environment "Patched environment")))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("savenotes" "")
+ ("spewnotes" "")
+ ("makesavenoteenv" "[{"))
+ 'function)))
+ TeX-dialect)
+
+(defvar LaTeX-footnotehyper-package-options nil
+ "Package options for the footnotehyper package.")
+
+;;; footnotehyper.el ends here
diff --git a/style/geometry.el b/style/geometry.el
index a1d1783..cc93d84 100644
--- a/style/geometry.el
+++ b/style/geometry.el
@@ -140,6 +140,7 @@ package.")
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("geometry" "{")
("newgeometry" "{")
+ ("restoregeometry" "")
("savegeometry" "{")
("loadgeometry" "{"))
'function))
diff --git a/style/hologo.el b/style/hologo.el
index 373ba9d..f714d6c 100644
--- a/style/hologo.el
+++ b/style/hologo.el
@@ -106,17 +106,26 @@
"space" "hyphen" "runtogether"))) ; plainTeX
"Local key=value options for hologo macros.")
+(defun LaTeX-hologo--arg-use-region-or-query-logo-name (optional)
+ (if (and (use-region-p)
+ (member (buffer-substring (region-beginning) (region-end))
+ LaTeX-hologo-logo-names))
+ (progn
+ (insert TeX-grop)
+ (goto-char (region-end))
+ (insert TeX-grcl))
+ (TeX-argument-insert
+ (completing-read "Logo name: " LaTeX-hologo-logo-names)
+ optional)))
+
(TeX-add-style-hook
"hologo"
(lambda ()
(TeX-add-symbols
;; Insert logo macros
- '("hologo" (TeX-arg-eval completing-read
- "Logo name: " LaTeX-hologo-logo-names))
-
- '("Hologo" (TeX-arg-eval completing-read
- "Logo name: " LaTeX-hologo-logo-names))
+ '("hologo" LaTeX-hologo--arg-use-region-or-query-logo-name)
+ '("Hologo" LaTeX-hologo--arg-use-region-or-query-logo-name)
;; Setup macros
'("hologoSetup" (TeX-arg-key-val LaTeX-hologo-key-val-options-global))
@@ -191,8 +200,7 @@
;; Additional user macros
'("hologoVariant"
- (TeX-arg-eval completing-read
- "Logo name: " LaTeX-hologo-logo-names)
+ LaTeX-hologo--arg-use-region-or-query-logo-name
(TeX-arg-eval
(lambda ()
(let ((setup (TeX-read-key-val
@@ -202,8 +210,7 @@
(format "%s" setup)))))
'("HologoVariant"
- (TeX-arg-eval completing-read
- "Logo name: " LaTeX-hologo-logo-names)
+ LaTeX-hologo--arg-use-region-or-query-logo-name
(TeX-arg-eval
(lambda ()
(let ((setup (TeX-read-key-val
diff --git a/style/truncate.el b/style/truncate.el
new file mode 100644
index 0000000..264d935
--- /dev/null
+++ b/style/truncate.el
@@ -0,0 +1,59 @@
+;;; truncate.el --- AUCTeX style for `truncate.sty' -*- lexical-binding: t;
-*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2021-01-31
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+;; MA 02110-1301 USA.
+
+;;; Commentary:
+
+;; This file adds support for `truncate.sty' v3.6 form 2001-08-20.
+
+;;; Code:
+
+(require 'tex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+ "font-latex"
+ (keywords class))
+
+(TeX-add-style-hook
+ "truncate"
+ (lambda ()
+
+ (TeX-add-symbols
+ '("truncate" [ "Marker" ] (TeX-arg-length "Width") "Text")
+ '("TruncateMarker" 0))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("truncate" "[{{"))
+ 'textual)))
+ TeX-dialect)
+
+(defvar LaTeX-truncate-package-options
+ '("breakwords" "breakall" "hyphenate" "fit")
+ "Package options for the truncate package.")
+
+;;; truncate.el ends here
diff --git a/tex-bar.el b/tex-bar.el
index 9866cc5..4f90384 100644
--- a/tex-bar.el
+++ b/tex-bar.el
@@ -136,13 +136,13 @@ the argument BUTTON-ALIST in function
`toolbarx-install-toolbar'."
(defcustom TeX-bar-TeX-button-alist
'((tex :image (lambda nil (if TeX-PDF-mode "pdftex" "tex"))
:command (progn
- (TeX-save-document (TeX-master-file))
+ (TeX-save-document #'TeX-master-file)
(TeX-command "TeX" 'TeX-master-file -1))
:help (lambda (&rest ignored)
(TeX-bar-help-from-command-list "TeX")))
(pdftex :image "pdftex"
:command (progn
- (TeX-save-document (TeX-master-file))
+ (TeX-save-document #'TeX-master-file)
(TeX-command "PDFTeX" 'TeX-master-file -1))
:help (lambda (&rest ignored)
(TeX-bar-help-from-command-list "PDFTeX")))
@@ -277,13 +277,13 @@ the argument BUTTON-ALIST in function
`toolbarx-install-toolbar'."
(defcustom TeX-bar-LaTeX-button-alist
'((latex :image (lambda nil (if TeX-PDF-mode "pdftex" "tex"))
:command (progn
- (TeX-save-document (TeX-master-file))
+ (TeX-save-document #'TeX-master-file)
(TeX-command "LaTeX" 'TeX-master-file -1))
:help (lambda (&rest ignored)
(TeX-bar-help-from-command-list "LaTeX")))
(pdflatex :image "pdftex"
:command (progn
- (TeX-save-document (TeX-master-file))
+ (TeX-save-document #'TeX-master-file)
(TeX-command "PDFLaTeX" 'TeX-master-file -1))
:help (lambda (&rest ignored)
(TeX-bar-help-from-command-list "PDFLaTeX")))
diff --git a/tex-buf.el b/tex-buf.el
index 40a2acc..9f174f0 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -75,24 +75,36 @@
;; THEN ``the'' process is the region process
;; ELSE ``the'' process is the master file (of the current buffer) process
-(defun TeX-save-document (name)
+(defun TeX-save-document (name-or-file-fn)
"Save all files belonging to the current document.
Return non-nil if document needs to be re-TeX'ed."
- (interactive (list (TeX-master-file)))
- (if (string-equal name "")
- (setq name (TeX-master-file)))
-
- (TeX-check-files (concat name "." (TeX-output-extension))
- (cons name (TeX-style-list))
+ (interactive (list #'TeX-master-file))
+ (TeX-check-files (TeX--concat-ext name-or-file-fn (TeX-output-extension))
+ (cons (TeX--concat-ext name-or-file-fn) (TeX-style-list))
TeX-file-extensions))
+(defun TeX--concat-ext (name-or-file-fn &optional extension)
+ "Append EXTENSION to a filename specified by NAME-OR-FILE-FN.
+
+If NAME-OR-FILE-FN is a string, interpret it as the filename.
+Otherwise, assume it is a callable function and call it with
+EXTENSION as an argument and return the result without
+modification. EXTENSION is a string which should not start with
+'.'."
+ (if (stringp name-or-file-fn)
+ (if extension
+ (concat name-or-file-fn "." extension)
+ name-or-file-fn)
+ (funcall name-or-file-fn extension)))
+
(defun TeX-command-master (&optional override-confirm)
"Run command on the current document.
If a prefix argument OVERRIDE-CONFIRM is given, confirmation will
depend on it being positive instead of the entry in `TeX-command-list'."
(interactive "P")
- (TeX-command (TeX-command-query (TeX-master-file nil nil t))
+ (TeX-master-file nil nil t) ;; call to ask if necessary
+ (TeX-command (TeX-command-query #'TeX-master-file)
'TeX-master-file override-confirm))
(defvar TeX-command-region-begin nil)
@@ -182,10 +194,10 @@ all text after `TeX-trailer-start'."
(interactive "P")
(TeX-region-update)
;; In the next line, `TeX-region-file' should be called with nil
- ;; `nondirectory' argument, otherwise `TeX-comand-default' called
+ ;; `nondirectory' argument, otherwise `TeX-command-default' called
;; within `TeX-command-query' won't work in included files not
;; placed in `TeX-master-directory'.
- (TeX-command (TeX-command-query (TeX-region-file)) 'TeX-region-file
+ (TeX-command (TeX-command-query #'TeX-region-file) #'TeX-region-file
override-confirm))
(defun TeX-command-buffer (&optional override-confirm)
@@ -468,7 +480,7 @@ Do you want to select one of these engines? "
FILE-FN is the symbol of a function returning a file name. The
function has one optional argument, the extension to use on the
-file.
+file. Valid choices are `TeX-master-file' and `TeX-region-file'
Use the information in `TeX-command-list' to determine how to run
the command.
@@ -569,7 +581,7 @@ without further expansion."
TeX-expand-command))
(defun TeX-active-master-with-quotes
- (&optional extension nondirectory ask extra)
+ (&optional extension nondirectory ask extra preprocess-fn)
"Return the current master or region file name with quote for shell.
Pass arguments EXTENSION NONDIRECTORY ASK to `TeX-active-master'.
If the returned file name contains space, enclose it within
@@ -581,7 +593,9 @@ the following three conditions are met:
2. \" \\input\" is supplemented
3. EXTRA is non-nil (default when expanding \"%T\")
Adjust dynamically bound variable `TeX-expand-pos' to avoid possible
-infinite loop in `TeX-command-expand'.
+infinite loop in `TeX-command-expand'. If PREPROCESS-FN is non-nil then
+it is called with the filename as an argument and the results is
+enclosed instead of the filename.
Helper function of `TeX-command-expand'. Use only within entries in
`TeX-expand-list-builtin' and `TeX-expand-list'."
@@ -608,7 +622,11 @@ Helper function of `TeX-command-expand'. Use only within
entries in
;; recognize non-ascii characters in the file name
;; when \input precedes.
"\\detokenize{ %s }" "%s")
- (concat quote-for-space raw quote-for-space)))))
+ (concat quote-for-space
+ (if preprocess-fn
+ (funcall preprocess-fn raw)
+ raw)
+ quote-for-space)))))
;; Advance past the file name in order to
;; prevent expanding any substring of it.
(setq TeX-expand-pos
@@ -743,15 +761,11 @@ omitted) and `TeX-region-file'."
(setq cmd (funcall command)
TeX-command-sequence-command command))
(t
- (setq cmd (TeX-command-default
- ;; File function should be called with nil `nondirectory'
- ;; argument, otherwise `TeX-command-sequence' won't work in
- ;; included files not placed in `TeX-master-directory'. In
- ;; addition, `TeX-master-file' is called with the third
- ;; argument (`ask') set to t, so that the master file is
- ;; properly set. This is also what `TeX-command-master'
- ;; does.
- (funcall TeX-command-sequence-file-function nil nil t))
+ ;; We first call `TeX-master-file' with the third argument
+ ;; (`ask') set to t, so that the master file is properly set.
+ ;; This is also what `TeX-command-master' does.
+ (funcall TeX-command-sequence-file-function nil nil t)
+ (setq cmd (TeX-command-default TeX-command-sequence-file-function)
TeX-command-sequence-command t)))
(TeX-command cmd TeX-command-sequence-file-function 0)
(when reset
@@ -793,25 +807,23 @@ omitted) and `TeX-region-file'."
(defvar TeX-command-history nil)
-(defun TeX-command-default (name)
+(defun TeX-command-default (name-or-file-fn)
"Guess the next command to be run on NAME."
- (let ((command-next nil))
- (cond (;; name might be absolute or relative, so expand it for
- ;; comparison.
- (if (string-equal (expand-file-name name)
- (expand-file-name (TeX-region-file)))
- (TeX-check-files (concat name "." (TeX-output-extension))
+ (let ((command-next nil)
+ (name (TeX--concat-ext name-or-file-fn)))
+ (cond ((if (eq name-or-file-fn #'TeX-region-file)
+ (TeX-check-files (TeX-region-file (TeX-output-extension))
;; Each original will be checked for all dirs
;; in `TeX-check-path' so this needs to be just
;; a filename without directory.
- (list (file-name-nondirectory name))
+ (list (file-relative-name name))
TeX-file-extensions)
- (TeX-save-document (TeX-master-file)))
+ (TeX-save-document name-or-file-fn))
TeX-command-default)
((and (memq major-mode '(doctex-mode latex-mode))
;; Want to know if bib file is newer than .bbl
;; We don't care whether the bib files are open in emacs
- (TeX-check-files (concat name ".bbl")
+ (TeX-check-files (TeX--concat-ext name-or-file-fn "bbl")
(mapcar #'car
(LaTeX-bibliography-list))
(append BibTeX-file-extensions
@@ -833,15 +845,15 @@ omitted) and `TeX-region-file'."
(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"))
+ (cdr (assoc (expand-file-name (TeX--concat-ext name-or-file-fn
"idx"))
LaTeX-idx-changed-alist)))
"Index")
(command-next)
(TeX-command-Show))))
-(defun TeX-command-query (name)
+(defun TeX-command-query (name-or-file-fn)
"Query the user for what TeX command to use."
- (let* ((default (TeX-command-default name))
+ (let* ((default (TeX-command-default name-or-file-fn))
(completion-ignore-case t)
(answer (or TeX-command-force
(completing-read
@@ -1151,7 +1163,7 @@ run of `TeX-run-TeX', use
;; Store md5 hash of the index file before running LaTeX.
(and (memq major-mode '(doctex-mode latex-mode))
(prog1 (file-exists-p
- (setq idx-file (expand-file-name (concat file ".idx"))))
+ (setq idx-file (expand-file-name (TeX-active-master "idx"))))
;; In order to avoid confusion and pollution of
;; `LaTeX-idx-md5-alist', remove from this alist all md5 hashes of
;; the current index file. Note `assq-delete-all' doesn't work with
@@ -1233,7 +1245,7 @@ run of `TeX-run-TeX', use
;; `default-directory', then we have to expand `file'
file-name
;; in the same directory of `TeX-command-buffer'.
(assoc (with-current-buffer TeX-command-buffer
- (expand-file-name (concat file ".idx")))
+ (expand-file-name (TeX-active-master "idx")))
LaTeX-idx-changed-alist))
(setq LaTeX-idx-changed-alist (delq element LaTeX-idx-changed-alist)))
(if TeX-process-asynchronous
@@ -1681,17 +1693,18 @@ Rerun to get mark in right position\\." nil t)
(setq TeX-command-next TeX-command-default)))
;; Check whether the idx file changed.
- (let ((idx-file nil) (master nil))
+ (let (idx-file)
(and (file-exists-p
(setq idx-file
- (concat
- (setq master
- (with-current-buffer TeX-command-buffer
- (expand-file-name (TeX-active-master)))) ".idx")))
+ (with-current-buffer TeX-command-buffer
+ (expand-file-name (TeX-active-master "idx")))))
;; imakeidx package automatically runs makeindex, thus, we need to be
;; sure .ind file isn't newer than .idx.
- (TeX-check-files (concat master ".ind")
- (list (file-name-nondirectory master)) '("idx"))
+ (TeX-check-files (with-current-buffer TeX-command-buffer
+ (expand-file-name (TeX-active-master "ind")))
+ (with-current-buffer TeX-command-buffer
+ (list (file-name-nondirectory
(TeX-active-master))))
+ '("idx"))
(with-temp-buffer
(insert-file-contents idx-file)
(not (equal
@@ -2017,9 +2030,8 @@ the directory.
The compatibility argument IGNORE is ignored."
;; The third argument `_ignore' is kept for symmetry with
;; `TeX-master-file's third argument `ask'. For example, it's used
- ;; in `TeX--master-or-region-file-with-extra-quotes', where we don't
- ;; know which function has to be called. Keep this in mind should
- ;; you want to use another argument here.
+ ;; in `TeX-active-master-with-quotes' for backward compatibility.
+ ;; Keep this in mind should you want to use another argument here.
;; See also the similar comment in `TeX-region-file'.
(if TeX-current-process-region-p
(TeX-region-file extension nondirectory)
@@ -2231,13 +2243,15 @@ The compatibility argument IGNORE is ignored."
;; third argument `ask'. For example, it's used in `TeX-command-sequence',
;; where we don't know which function has to be called. Keep this in mind
;; should you want to use another argument here.
- (concat (if nondirectory "" (TeX-master-directory))
- (cond ((eq extension t)
- (concat TeX-region "." TeX-default-extension))
- (extension
- (concat TeX-region "." extension))
- (t
- TeX-region))))
+ (let ((master-dir (TeX-master-directory)))
+ (concat (or (TeX--master-output-dir master-dir nondirectory)
+ (if nondirectory "" master-dir))
+ (cond ((eq extension t)
+ (concat TeX-region "." TeX-default-extension))
+ (extension
+ (concat TeX-region "." extension))
+ (t
+ TeX-region)))))
(defcustom TeX-region "_region_"
"Base name of temporary file for `TeX-command-region' and
`TeX-command-buffer'."
diff --git a/tex-info.el b/tex-info.el
index 2f6a443..c9810d2 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -686,7 +686,6 @@ value of `Texinfo-mode-hook'."
(set (make-local-variable 'TeX-esc) "@")
(set (make-local-variable 'TeX-auto-regexp-list) 'TeX-auto-empty-regexp-list)
- (set (make-local-variable 'TeX-auto-update) t)
(setq TeX-command-default "TeX")
(setq TeX-header-end "%*end")
diff --git a/tex-jp.el b/tex-jp.el
index 5b868b8..3d47a61 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -1,6 +1,6 @@
;;; tex-jp.el --- Support for Japanese TeX. -*- lexical-binding: t; -*-
-;; Copyright (C) 1999, 2001-2008, 2012-2013, 2016-2018, 2020
+;; Copyright (C) 1999, 2001-2008, 2012-2013, 2016-2018, 2020-2021
;; Free Software Foundation, Inc.
;; Author: KOBAYASHI Shinji <koba@flab.fujitsu.co.jp>,
@@ -914,7 +914,7 @@ save size
(provide 'tex-jp)
;; Local Variables:
-;; coding: iso-2022-jp-unix
+;; coding: iso-2022-jp
;; End:
;;; tex-jp.el ends here
diff --git a/tex.el b/tex.el
index b59aee0..d67b9f8 100644
--- a/tex.el
+++ b/tex.el
@@ -89,6 +89,7 @@
(defvar LaTeX-optop)
(defvar TeX-Biber-global-files)
(defvar TeX-global-input-files)
+(defvar TeX-output-dir)
;; tex-buf.el
(defvar TeX-current-process-region-p)
(defvar TeX-region)
@@ -182,18 +183,18 @@ If nil, none is specified."
;; `TeX-expand-list-builtin' for a description of the % escapes
(defcustom TeX-command-list
- '(("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts)
%S%(PDFout)%(mode)%' %t"
+ '(("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts)
%S%(PDFout)%(mode)%' %(output-dir) %t"
TeX-run-TeX nil
(plain-tex-mode ams-tex-mode texinfo-mode) :help "Run plain TeX")
("LaTeX" "%`%l%(mode)%' %T"
TeX-run-TeX nil
(latex-mode doctex-mode) :help "Run LaTeX")
;; Not part of standard TeX.
- ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
+ ("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t" TeX-run-compile nil
(texinfo-mode) :help "Run Makeinfo with Info output")
- ("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil
+ ("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) --html %t"
TeX-run-compile nil
(texinfo-mode) :help "Run Makeinfo with HTML output")
- ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %t"
+ ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %(output-dir) %t"
TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
;; support for ConTeXt --pg
;; first version of ConTeXt to support nonstopmode: 2003.2.10
@@ -202,11 +203,11 @@ If nil, none is specified."
("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t"
TeX-run-TeX nil
(context-mode) :help "Run ConTeXt until completion")
- ("BibTeX" "bibtex %s" TeX-run-BibTeX nil
+ ("BibTeX" "bibtex %(O?aux)" TeX-run-BibTeX nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode
context-mode)
:help "Run BibTeX")
- ("Biber" "biber %s" TeX-run-Biber nil
+ ("Biber" "biber %s %(output-dir)" TeX-run-Biber nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
:help "Run Biber")
("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer")
@@ -219,20 +220,20 @@ If nil, none is specified."
("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
:help "Convert DVI file to PostScript")
- ("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil
+ ("Dvipdfmx" "dvipdfmx %d -o %(O?pdf)" TeX-run-dvipdfmx nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
:help "Convert DVI file to PDF with dvipdfmx")
- ("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil
+ ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
:help "Convert PostScript file to PDF")
- ("Glossaries" "makeglossaries %s" TeX-run-command nil
+ ("Glossaries" "makeglossaries %(O?aux)" TeX-run-command nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
:help "Run makeglossaries to create glossary
file")
- ("Index" "makeindex %s" TeX-run-index nil
+ ("Index" "makeindex %(O?idx)" TeX-run-index nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
:help "Run makeindex to create index file")
- ("upMendex" "upmendex %s" TeX-run-index t
+ ("upMendex" "upmendex %(O?idx)" TeX-run-index t
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
:help "Run upmendex to create index file")
("Xindy" "texindy %s" TeX-run-command nil
@@ -393,7 +394,7 @@ The executable `latex' is LaTeX version 2e."
(defcustom LaTeX-command-style
;; They have all been combined in LaTeX 2e.
- '(("" "%(PDF)%(latex) %(file-line-error) %(extraopts) %S%(PDFout)"))
+ '(("" "%(PDF)%(latex) %(file-line-error) %(extraopts) %(output-dir)
%S%(PDFout)"))
"List of style options and LaTeX commands.
If the first element (a regular expression) matches the name of one of
@@ -420,7 +421,7 @@ string."
;; TeX-print-command.
(defcustom TeX-print-command
- "{ test -e %s.dvi && %(o?)dvips -P%p %r %s; } || lpr -P%p %o"
+ "{ test -e %d && %(o?)dvips -P%p %r %s; } || lpr -P%p %o"
"Command used to print a file.
First `%p' is expanded to the printer name, then ordinary expansion is
@@ -448,7 +449,7 @@ the printer has no corresponding command."
;; Print to the (unnamed) default printer. If there is a DVI
;; file print via Dvips. If not, pass the output file (which
;; should then be a Postscript or PDF file) directly to lpr.
- "{ test -e %s.dvi && %(o?)dvips -f %r %s | lpr; } || lpr %o"
+ "{ test -e %d && %(o?)dvips -f %r %s | lpr; } || lpr %o"
;; Show the queue for the (unnamed) default printer.
"lpq"))
"List of available printers.
@@ -563,6 +564,8 @@ string."
("%(cntxcom)" ConTeXt-expand-command)
("%(execopts)" ConTeXt-expand-options)
("%(extraopts)" (lambda () TeX-command-extra-options))
+ ("%(output-dir)" (lambda () (TeX--output-dir-arg "--output-directory=")))
+ ("%(o-dir)" (lambda () (TeX--output-dir-arg "-o ")))
("%S" TeX-source-correlate-expand-options)
("%dS" TeX-source-specials-view-expand-options)
("%cS" TeX-source-specials-view-expand-client)
@@ -583,6 +586,7 @@ string."
;; adds suitable quotes for use in shell command line.
("%s" TeX-active-master-with-quotes nil t)
("%t" TeX-active-master-with-quotes t t)
+ ("%(t-filename-only)" TeX-active-master-with-quotes t t nil nil
file-name-nondirectory)
;; If any TeX codes appear in the interval between %` and %', move
;; all of them after the interval and supplement " \input". The
;; appearance is marked by leaving the bind to `TeX-command-text'
@@ -632,6 +636,9 @@ string."
("%n" TeX-current-line)
("%d" TeX-active-master-with-quotes "dvi" t)
("%f" TeX-active-master-with-quotes "ps" t)
+ ("%(O?aux)" TeX-active-master-with-quotes "aux" t)
+ ("%(O?idx)" TeX-active-master-with-quotes "idx" t)
+ ("%(O?pdf)" TeX-active-master-with-quotes "pdf" t)
("%o" (lambda nil (TeX-active-master-with-quotes (TeX-output-extension)
t)))
;; for source specials the file name generated for the xdvi
;; command needs to be relative to the master file, just in
@@ -2210,25 +2217,20 @@ Used as a default in TeX, LaTeX and docTeX mode.")
If prefix ARG is non-nil, not only remove intermediate but also
output files."
(interactive "P")
- (let* ((mode-prefix (TeX-mode-prefix))
- (suffixes (append (symbol-value
- (intern (concat mode-prefix
- "-clean-intermediate-suffixes")))
- (when arg
- (symbol-value
- (intern (concat mode-prefix
- "-clean-output-suffixes"))))))
- (master (TeX-active-master))
+ (let* (;; Call with output extension then remove it, to make sure we
+ ;; get the correct directory in cases TeX-output-dir is
+ ;; non-nil
+ (master (file-name-sans-extension (TeX-active-master
(TeX-output-extension))))
(master-dir (file-name-directory master))
(regexp (concat "\\("
(regexp-quote (file-name-nondirectory master)) "\\|"
- (regexp-quote (TeX-region-file nil t))
+ (regexp-quote (file-name-nondirectory
(TeX-region-file nil t)))
"\\)"
"\\("
- (mapconcat 'identity suffixes "\\|")
+ (TeX--clean-extensions-regexp arg)
"\\)\\'"
- "\\|" (regexp-quote (TeX-region-file t t))))
- (files (when regexp
+ "\\|" (regexp-quote (file-name-nondirectory
(TeX-region-file t t)))))
+ (files (when (and regexp (or (not master-dir) (file-exists-p
master-dir)))
(directory-files (or master-dir ".") nil regexp))))
(if files
(when (or (not TeX-clean-confirm)
@@ -2241,6 +2243,22 @@ output files."
(delete-file (concat master-dir file))))
(message "No files to be deleted"))))
+(defun TeX--clean-extensions-regexp (&optional arg)
+ "Return a regexp to match extensions that should be cleaned by `TeX-clean'.
+If the optional argument ARG is non-nil then output files are
+also included in the regexp."
+ (let* ((mode-prefix (TeX-mode-prefix))
+ (suffixes (and mode-prefix
+ (append (symbol-value
+ (intern (concat mode-prefix
+
"-clean-intermediate-suffixes")))
+ (when arg
+ (symbol-value
+ (intern (concat mode-prefix
+
"-clean-output-suffixes"))))))))
+ (when suffixes
+ (mapconcat 'identity suffixes "\\|"))))
+
;;; Master File
(defcustom TeX-master t
@@ -2406,10 +2424,19 @@ name of master file if it cannot be determined
otherwise."
;; Otherwise drop it.
(setq name (TeX-strip-extension name))))
- ;; Remove directory if needed.
- (if nondirectory
- (setq name (file-name-nondirectory name)))
-
+ (let* ((reg (TeX--clean-extensions-regexp t))
+ (is-output-ext (and reg
+ (or (string-match-p reg (concat "."
extension))
+ (string= "prv" extension))))
+ (output-dir (and is-output-ext
+ (TeX--master-output-dir
+ (file-name-directory name)
+ nondirectory))))
+ (if output-dir
+ (setq name (concat output-dir (file-name-nondirectory name)))
+ ;; Remove directory if needed.
+ (if nondirectory
+ (setq name (file-name-nondirectory name)))))
(if extension
(concat name "." extension)
name))))
@@ -2494,6 +2521,50 @@ be relative to that."
:group 'TeX-file
:type 'string)
+(defcustom TeX-output-dir nil
+ "The path of the directory where output files should be placed.
+
+A relative path is interpreted as being relative to the master
+file in `TeX-master'. The path cannot contain a directory that
+starts with '.'. If this variable is nil, the output directory is
+assumed to be the same as the directory of `TeX-master'."
+ :group 'TeX-file
+ :safe 'string-or-null-p
+ :type '(choice (const :tag "Directory of master file" nil)
+ (string :tag "Custom" "build")))
+(make-variable-buffer-local 'TeX-output-dir)
+
+(defun TeX--master-output-dir (master-dir relative-to-master)
+ "Return the directory path where output files should be placed.
+If `TeX-output-dir' is nil, then return nil.
+
+MASTER-DIR is the directory path where the master file is
+located. If RELATIVE-TO-MASTER is non-nil, make the returned path
+relative to the directory in MASTER-DIR."
+ (when TeX-output-dir
+ (let* ((master-dir (expand-file-name (or master-dir "")))
+ (out-dir (file-name-as-directory
+ (abbreviate-file-name
+ (substitute-in-file-name
+ (expand-file-name
+ TeX-output-dir
+ master-dir))))))
+ ;; Make sure the directory exists
+ (unless (file-exists-p out-dir)
+ (make-directory (file-name-as-directory out-dir) t))
+ (if relative-to-master
+ (file-relative-name out-dir master-dir)
+ out-dir))))
+
+(defun TeX--output-dir-arg (argname)
+ "Format the output directory as a command argument.
+ARGNAME is prepended to the quoted output directory. If
+`TeX-output-dir' is nil then return an empty string."
+ (let ((out-dir (TeX--master-output-dir (TeX-master-directory) t)))
+ (if out-dir
+ (concat argname "\"" out-dir "\"")
+ "")))
+
(defcustom TeX-style-local "style"
"Directory containing hand generated TeX information.
@@ -2505,7 +2576,7 @@ be relative to that."
(defun TeX-split-string (regexp string)
"Return a list of strings.
Given REGEXP the STRING is split into sections which in string was
-seperated by REGEXP.
+separated by REGEXP.
Examples:
@@ -2989,8 +3060,7 @@ See variable `TeX-style-hook-dialect' for supported
dialects."
Only do this if it has not been done before, or if optional argument
FORCE is not nil."
- (unless (or (and (boundp 'TeX-auto-update)
- (eq TeX-auto-update 'BibTeX)) ; Not a real TeX buffer
+ (unless (or (eq major-mode 'bibtex-mode) ; Not a real TeX buffer
(and (not force)
TeX-style-hook-applied-p))
(setq TeX-style-hook-applied-p t)
@@ -3716,7 +3786,6 @@ The algorithm is as follows:
;; We want this to be early in the list, so we do not add it before
;; we enter TeX mode the first time.
(add-hook 'write-contents-functions #'TeX-safe-auto-write nil t)
- (set (make-local-variable 'TeX-auto-update) t)
(define-key TeX-mode-map "\C-xng" 'TeX-narrow-to-group)
@@ -3897,9 +3966,7 @@ Generated by `TeX-auto-add-type'.")
(defun TeX-safe-auto-write ()
"Call `TeX-auto-write' safely."
(condition-case _ignored
- (and (boundp 'TeX-auto-update)
- TeX-auto-update
- (TeX-auto-write))
+ (TeX-auto-write)
(error nil))
;; Continue with the other write file hooks.
nil)
- [elpa] externals/auctex 331b24c 21/25: Use "wrap region or query for logo" also in \[hH]ologoVariant, (continued)
- [elpa] externals/auctex 331b24c 21/25: Use "wrap region or query for logo" also in \[hH]ologoVariant, Tassilo Horn, 2021/03/21
- [elpa] externals/auctex 094c298 23/25: Implement the user option TeX-output-dir, Tassilo Horn, 2021/03/21
- [elpa] externals/auctex 6db8a1a 06/25: ; Use @subsection, Tassilo Horn, 2021/03/21
- [elpa] externals/auctex 0c90254 15/25: ; * tex-buf.el (TeX-command-region): Fix typo in comment., Tassilo Horn, 2021/03/21
- [elpa] externals/auctex f9c7245 22/25: Improve style/footmisc.el, Tassilo Horn, 2021/03/21
- [elpa] externals/auctex 159c81d 08/25: ; * style/truncate.el: Fix mail address., Tassilo Horn, 2021/03/21
- [elpa] externals/auctex e62bc9b 05/25: Remove eol format suffix from coding tag (bug#46117), Tassilo Horn, 2021/03/21
- [elpa] externals/auctex 1ad2d9e 17/25: Fix preview-cache-preamble after region typeset/preview, Tassilo Horn, 2021/03/21
- [elpa] externals/auctex dbfb016 19/25: Use active region if it is a logo name., Tassilo Horn, 2021/03/21
- [elpa] externals/auctex b9f4f36 04/25: ; * doc/quickstart.texi (Editing Facilities): Fix formatting., Tassilo Horn, 2021/03/21
- [elpa] externals/auctex 48fb645 25/25: Merge remote-tracking branch 'origin/master' into externals/auctex,
Tassilo Horn <=