branch: main commit d9126babe3c9b9f278a1628e8722d0d2dfc71ff5 Merge: e72989a6 4b43c80d Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Fix merge commits --- ChangeLog | 233 +++++++++++++++++++++++++++++++++- Makefile.in | 5 +- bib-cite.el | 198 ++++++++++++++--------------- doc/changes.texi | 13 ++ latex.el | 49 ++++++-- style/alltt.el | 2 - style/babel.el | 10 +- style/baskervaldx.el | 73 +++++++++++ style/beamer.el | 22 ++-- style/bigstrut.el | 9 +- style/dinbrief.el | 4 +- style/emp.el | 2 +- style/epsf.el | 2 +- style/erewhon.el | 79 ++++++++++++ style/fancyref.el | 4 +- style/fancyvrb.el | 6 +- style/fbb.el | 71 +++++++++++ style/graphicx.el | 2 +- style/harvard.el | 164 ++++++++++++------------ style/hyperref.el | 81 ++++++++++-- style/inputenc.el | 2 +- style/listings.el | 4 +- style/mathtools.el | 30 ++--- style/minted.el | 241 ++++++++++++++++++++++++++++++++++++ style/multirow.el | 2 +- style/natbib.el | 2 +- style/newtxmath.el | 84 +++++++++++++ style/{bigstrut.el => newtxsf.el} | 43 ++++--- style/{bigstrut.el => newtxtext.el} | 34 ++--- style/{multirow.el => newtxttt.el} | 40 +++--- style/pdfsync.el | 4 +- style/prosper.el | 20 +-- style/psfig.el | 4 +- style/pst-node.el | 15 +-- style/pst-plot.el | 24 ++-- style/pstricks.el | 32 ++--- style/relsize.el | 69 +++++++++++ style/shortvrb.el | 9 +- style/wrapfig.el | 107 ++++++++++++++++ tex.el | 120 ++++++++++-------- 40 files changed, 1498 insertions(+), 417 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7693dcd..08b51a5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,76 @@ -2015-01-20 Tassilo Horn <t...@gnu.org> +2015-01-27 Tassilo Horn <t...@gnu.org> + + * tex.el (TeX-view-program-list-builtin): Remove "start" as + executable entry because it's no executable but a Windows system + command. + (TeX-view-program-list-builtin): Also remove "start" as executable + from the "dvips and start" entry. + +2015-01-25 Tassilo Horn <t...@gnu.org> + + * latex.el (LaTeX-section-heading): Use default parameter of + completing-read. Fixes bug#19675. + +2015-01-19 Tassilo Horn <t...@gnu.org> + + * tex.el (TeX-auto-store): Fix indentation in auto files. + +2015-01-16 Arash Esbati <esb...@gmx.de> + + * style/minted.el: Update copyright year. + (LaTeX-minted-auto-cleanup): Fix the name of the new langcode + environment. + +2014-12-30 Arash Esbati <esb...@gmx.de> + + * style/multirow.el ("multirow"): Fix a typo in the name of a + variable. + + * Makefile.in (STYLESRC): Add new styles. + + * style/relsize.el: New file. + + * style/wrapfig.el: New file. + + * style/hyperref.el ("hyperref"): Add `Form' environment needed + for PDF and HTML forms. + (LaTeX-hyperref-forms-options): New variable for key-val options + used in form related macros (`TextField', `CheckBox', + `ChoiceMenu', `PushButton', `Submit', `Reset'). + +2014-12-22 Tassilo Horn <t...@gnu.org> + + * doc/changes.texi: Document addition of LaTeX-command-section and + forward/backward search enhancements with Evince. + + * latex.el (auto-mode-alist): Add latex-mode association for HeVeA + files. + +2014-12-21 Tassilo Horn <t...@gnu.org> + + * tex.el (TeX-parse-macro): Enclose arg in + LaTeX-default-verb-delimiter if macro is in + LaTeX-verbatim-macros-with-delims and there's only one argument. + (TeX-auto-store): Check if LaTeX-verbatim-environments, + LaTeX-verbatim-macros-with-delims, and + LaTeX-verbatim-macros-with-braces are bound before using them. + + * style/minted.el (LaTeX-minted-newminted-regexp) + (LaTeX-minted-newmint-regexp, LaTeX-minted-newmintinline-regexp) + (LaTeX-minted-newmintedfile-regexp, LaTeX-minted-auto-cleanup): + Extend to recognize optional env/macro name. + ("minted"): Add \newminted, \newmint, \newmintinline, and + \newmintedfile macros. + +2014-12-20 Tassilo Horn <t...@gnu.org> + + * tex.el (TeX-auto-store): Write LaTeX-verbatim-*-local variables + to auto file to make them document-local. + + * style/minted.el (LaTeX-minted-auto-cleanup): Recognize macros + generated by \newmint, \newmintinline, and \newmintedfile, too. + + * tex.el (TeX-evince-sync-view): Encode URI with `url-encode-url'. * auctex.el: Remove byte-recompile-directory call compiling style files because package.el does that anyhow. @@ -10,6 +82,165 @@ * auctex.el (byte-recompile-directory): Refer to correct style directory on load. + * style/minted.el: New style. + + * Makefile.in (STYLESRC): Add style/minted.el. + + * latex.el (LaTeX-env-args): Bind exit-mark if its not bound + already. + (LaTeX-verbatim-regexp): Make variable obsolete. + (LaTeX-verbatim-regexp): New function which computes a regexp of + verbatim environments from LaTeX-verbatim-environments. + (LaTeX-indent-calculate, LaTeX-indent-calculate-last): Use the + function LaTeX-verbatim-regexp instead of the variable. + + * style/listings.el ("listings"): Don't modify the now obsolete + LaTeX-verbatim-regexp. + + * style/fancyvrb.el ("fancyvrb"): Don't modify the now obsolete + LaTeX-verbatim-regexp. + + * style/beamer.el ("beamer"): Don't modify the now obsolete + LaTeX-verbatim-regexp. + + * style/alltt.el ("alltt"): Don't modify the now obsolete + LaTeX-verbatim-regexp. + +2014-12-18 Tassilo Horn <t...@gnu.org> + + * tex.el (TeX-evince-sync-view): Don't URL-encode commas in the + file name (bug#19398). + +2014-12-12 Mos� Giordano <m...@gnu.org> + + * latex.el (LaTeX-environment-name-regexp): New function. + (LaTeX-modify-environment): Use it. + (LaTeX-find-matching-end): Use `TeX-grop' instead of the + hard-coded "{". Search for the closing of the environment with + `re-search-forward' instead of `search-forward' and use + `LaTeX-environment-name-regexp': this allows to consider + environments with macros in their names. (Bug#19281) + (LaTeX-find-matching-begin): Use `TeX-grop' instead of the + hard-coded "{". + +2014-12-09 Mos� Giordano <m...@gnu.org> + + * style/babel.el (LaTeX-babel-active-languages): Move `nreverse' + call inside `let'. + +2014-12-08 Stefan Monnier <monn...@iro.umontreal.ca> + + * tex.el (TeX-mode-specific-command-menu): Remove Emacs 20 + compatibility code. + + * style/shortvrb.el ("shortvrb"): Use mapcar instead of + dolist/add-to-list. + + * style/pstricks.el (LaTeX-pst-point-in-parens) + (LaTeX-pst-macro-psarc, LaTeX-pst-macro-pscircle) + (LaTeX-pst-macro-rput, LaTeX-pst-macro-uput) + (LaTeX-pst-macro-multirputps, LaTeX-pst-macro-psline) + (LaTeX-pst-macro-psdots, LaTeX-pst-macro-parabola) + (LaTeX-pst-macro-pnt-twolen, LaTeX-pst-macro-psbezier) + (LaTeX-pst-macro-pspolygon, LaTeX-pst-macro-psframe) + (LaTeX-pst-macro-psgrid, LaTeX-pst-macro-newpsobject): Rename + unused arg to silence the byte-compiler. + (LaTeX-pst-parameters-add): Remove unused var beg. + + * style/pst-plot.el (LaTeX-pst-macro-psaxes): Rename unused arg to + silence the byte-compiler and fix indentation. + ("pst-plot"): Use mapc instead of mapcar for side-effects only. + + * style/pst-node.el (LaTeX-pstnode-macro-nput) + (LaTeX-pstnode-macro-cnodeput, LaTeX-pstnode-macro-nc) + (LaTeX-pstnode-macro-pc, LaTeX-pstnode-macro-tnabcput): Rename + unused arg to silence the byte-compiler. + + * style/psfig.el (TeX-arg-psfig, LaTeX-env-psfigure): Rename + unused arg to silence the byte-compiler. + + * style/prosper.el: Fix comment style. + (LaTeX-prosper-insert-title, LaTeX-prosper-arg-pdftransition) + (LaTeX-prosper-insert-options, LaTeX-prosper-insert-slide): Rename + unused arg to silence the byte-compiler. + + * style/pdfsync.el (LaTeX-pdfsync-output-page): Remove unused + sync-line variable. + + * style/natbib.el (natbib-note-args): Rename unused arg to silence + the byte-compiler. + + * style/inputenc.el (LaTeX-arg-inputenc-inputenc): Rename unused + arg to silence the byte-compiler. + + * style/harvard.el (LaTeX-env-harvardbib): Rename unused arg to + silence the byte-compiler. + + * style/graphicx.el (LaTeX-arg-includegraphics): Rename unused arg + to silence the byte-compiler. + + * style/fancyref.el (TeX-arg-fancyref-format): Rename unused arg + to silence the byte-compiler. + + * style/epsf.el (TeX-arg-epsfsize): Rename unused arg to silence + the byte-compiler. + + * style/emp.el (LaTeX-env-empfile): Rename unused arg to silence + the byte-compiler. + + * style/dinbrief.el (LaTeX-dinbrief-sender): Add a FIXME. + + * style/bigstrut.el (TeX-arg-bigstrut): Rename unused arg to + silence the byte-compiler. + + * style/beamer.el + (LaTeX-beamer-after-insert-env, TeX-arg-beamer-overlay-spec) + (TeX-arg-beamer-frametitle, TeX-arg-beamer-note) + (LaTeX-arg-beamer-theme, LaTeX-arg-beamer-inner-theme) + (LaTeX-arg-beamer-outer-theme, LaTeX-arg-beamer-color-theme) + (LaTeX-arg-beamer-font-theme): Rename unused arg to silence the + byte-compiler. + + * style/babel.el (require): Require cl at compile-time. + (LaTeX-babel-active-languages): Use pushnew/nreverse instead of + add-to-list. + + * bib-cite.el (bib-cite--kind): New function. + (bib-display, bib-find): Use it. + (featurep): Use with-current-buffer instead of set-buffer. + (bib-cite--fontify-help): New function. + (bib-cite-fontify-help-as-bibtex, bib-cite-fontify-help-as-latex): + Use it. + (bib-highlight-mouse, bib-label-help): Make comment conform to the + commenting conventions. + (bib-label-prompt-map): Derive from + minibuffer-local-completion-map instead of copying that. + (bib-display-this-environment): Fix comment. + (bib-document-TeX-files): Don't doubly-declare the-file. + +2014-12-08 Mos� Giordano <m...@gnu.org> + + * style/mathtools.el ("mathtools"): Fix closing bracket + placement. (Bug#19301) + +2014-12-08 Arash Esbati <esb...@gmx.de> + + * Makefile.in (STYLESRC): Add new styles. + + * style/newtxttt.el: New file. + + * style/newtxtext.el: New file. + + * style/newtxsf.el: New file. + + * style/newtxmath.el: New file. + + * style/fbb.el: New file. + + * style/erewhon.el: New file. + + * style/baskervaldx.el: New file. + 2014-12-04 Mos� Giordano <m...@gnu.org> * tex.el (TeX-Omega-command): Add aleph and omega choices. diff --git a/Makefile.in b/Makefile.in index 60e21dcc..39402e78 100644 --- a/Makefile.in +++ b/Makefile.in @@ -140,7 +140,10 @@ STYLESRC = style/prosper.el \ style/eso-pic.el style/fontaxes.el style/AnonymousPro.el \ style/mdsymbol.el style/MyriadPro.el style/textcomp.el \ style/XCharter.el style/zlmtt.el style/ifluatex.el \ - style/luatextra.el + style/luatextra.el style/erewhon.el style/baskervaldx.el \ + style/fbb.el style/newtxmath.el style/newtxsf.el \ + style/newtxtext.el style/newtxttt.el style/minted.el \ + style/wrapfig.el style/relsize.el STYLEELC = $(STYLESRC:.el=.elc) ifeq (@preview_enabled@,yes) diff --git a/bib-cite.el b/bib-cite.el index 9ecbc81c..164385a8 100644 --- a/bib-cite.el +++ b/bib-cite.el @@ -1002,6 +1002,16 @@ runs bib-find, and [mouse-3] runs bib-display." "^[, \t]*[a-zA-Z]+[ \t]*=[ \t]*\\([a-zA-Z][^#%'(),={}\" \t\n]*\\)" "Regular expression for field containing a @string.") +(defun bib-cite--kind () + (save-excursion + (if (not (looking-at "\\\\")) + (search-backward "\\" nil t)) + (if (looking-at bib-ref-regexpc) + 'ref + (if (looking-at "\\\\label{") + 'label + 'cite)))) + (defun bib-display () "Display BibTeX citation or matching \\ref or \\label command under point. @@ -1023,23 +1033,15 @@ string, a second prompt for a ref will be given. A TAGS file is created and used for multi-file documents under auctex." (interactive) - (let ((cite)(ref)(label)) - (save-excursion - (if (not (looking-at "\\\\")) - (search-backward "\\" nil t)) - (if (looking-at bib-ref-regexpc) - (setq ref t) - (if (looking-at "\\\\label{") - (setq label t) - (setq cite t)))) + (let ((kind (bib-cite--kind))) (cond ;; reftex doesn't handle label->ref ((and bib-cite-use-reftex-view-crossref - (or ref cite)) + (memq kind '(ref cite))) ;;;FIXME: reftex doesn't want point on \ref or \cite part, but on keyword (require 'reftex) (reftex-view-crossref nil)) - (cite + ((eq kind 'cite) (bib-display-citation)) (t (bib-display-label))))) @@ -1064,22 +1066,14 @@ string, a second prompt for a ref will be given. A TAGS file is created and used for multi-file documents under auctex." (interactive) - (let ((cite)(ref)(label)) - (save-excursion - (if (not (looking-at "\\\\")) - (search-backward "\\" nil t)) - (if (looking-at bib-ref-regexpc) - (setq ref t) - (if (looking-at "\\\\label{") - (setq label t) - (setq cite t)))) + (let ((kind (bib-cite--kind))) (cond ;; reftex doesn't handle label->ref ((and bib-cite-use-reftex-view-crossref - (or ref cite)) + (memq kind '(ref cite))) (require 'reftex) (reftex-view-crossref t)) - (cite + ((eq kind 'cite) (bib-edit-citation)) (t (bib-find-label))))) @@ -1236,8 +1230,7 @@ to create a bibtex file containing only the references used in the document." (when (featurep 'xemacs) (defun bib-cite-fontify-help-xemacs (defaults) (if (fboundp 'font-lock-set-defaults-1) ; >= XEmacs 19.14 - (progn - (set-buffer "*Help*") + (with-current-buffer "*Help*" (setq font-lock-defaults-computed nil font-lock-keywords nil) (font-lock-set-defaults-1 @@ -1247,41 +1240,44 @@ to create a bibtex file containing only the references used in the document." font-lock-keywords nil) (font-lock-set-defaults-1))))) +(defun bib-cite--fontify-help () + ;; FIXME: This looks ugly and incorrect. + (if font-lock-mode + (font-lock-mode -1) + (if (fboundp 'font-lock-unset-defaults) (font-lock-unset-defaults)) + (font-lock-unfontify-buffer)) + (if (fboundp 'font-lock-ensure) + (font-lock-ensure) + (with-no-warnings (font-lock-fontify-buffer)))) + (defun bib-cite-fontify-help-as-bibtex () - (save-excursion - (cond - ((not (featurep 'font-lock)) - nil) ;No font-lock! Stop here. - ;; font-lock under Emacs and XEmacs - ((featurep 'xemacs) - ;; XEmacs - (bib-cite-fontify-help-xemacs 'bibtex-mode)) - (t - ;; Emacs - (set-buffer "*Help*") + (cond + ((not (featurep 'font-lock)) + nil) ;No font-lock! Stop here. + ;; font-lock under Emacs and XEmacs + ((featurep 'xemacs) + ;; XEmacs + (bib-cite-fontify-help-xemacs 'bibtex-mode)) + (t + ;; Emacs + (with-current-buffer "*Help*" (let ((font-lock-defaults - '(bib-cite-bibtex-font-lock-keywords - nil t ((?$ . "\"")(?\" . "."))))) - (if (not font-lock-mode) - (font-lock-mode 1) - (if (fboundp 'font-lock-unset-defaults) - (font-lock-unset-defaults)) - (font-lock-unfontify-buffer)) - (font-lock-fontify-buffer)))))) + '(bib-cite-bibtex-font-lock-keywords + nil t ((?$ . "\"")(?\" . "."))))) + (bib-cite--fontify-help)))))) (defun bib-cite-fontify-help-as-latex () - (save-excursion - (cond - ((not (featurep 'font-lock)) - nil) ;No font-lock! Stop here. - ;; font-lock under Emacs and XEmacs - ((featurep 'xemacs) - ;; XEmacs, not necessary to do s.th. special for font-latex, we do *not* - ;; want the buffer-local faces! - (bib-cite-fontify-help-xemacs 'latex-mode)) - (t - ;; Emacs - (set-buffer "*Help*") + (cond + ((not (featurep 'font-lock)) + nil) ;No font-lock! Stop here. + ;; font-lock under Emacs and XEmacs + ((featurep 'xemacs) + ;; XEmacs, not necessary to do s.th. special for font-latex, we do *not* + ;; want the buffer-local faces! + (bib-cite-fontify-help-xemacs 'latex-mode)) + (t + ;; Emacs + (with-current-buffer "*Help*" ;; Actually, don't want to `permanently' affect *Help* buffer... ;;(if (featurep 'font-latex) ;; (font-latex-setup) @@ -1297,12 +1293,7 @@ to create a bibtex file containing only the references used in the document." (font-lock-comment-start-regexp . "%") (font-lock-mark-block-function . mark-paragraph)) '(tex-font-lock-keywords nil nil ((?$ . "\"")))))) - (if (not font-lock-mode) - (font-lock-mode 1) - (if (fboundp 'font-lock-unset-defaults) - (font-lock-unset-defaults)) - (font-lock-unfontify-buffer)) - (font-lock-fontify-buffer)))))) + (bib-cite--fontify-help)))))) (defvar bib-document-TeX-files-warnings nil "Bib-cite internal variable.") @@ -1374,15 +1365,15 @@ See variables bib-etags-command and bib-etags-filename" (defun bib-highlight-mouse () "Make that nice green highlight when the mouse is over LaTeX commands." (interactive) -;;;Comment this out. User should be able to use bib-highlight-mouse -;;;to try it out regardless of bib-highlight-mouse-t. -;;;Check bib-highlight-mouse-t only in automated cases. -;;; -;;; (if (and bib-highlight-mouse-t -;;; ;;window-system) ;Do nothing unless under X -;;; ) -;;; *all of code was here* -;;; ) + ;;Comment this out. User should be able to use bib-highlight-mouse + ;;to try it out regardless of bib-highlight-mouse-t. + ;;Check bib-highlight-mouse-t only in automated cases. + ;; + ;; (if (and bib-highlight-mouse-t + ;; ;;window-system) ;Do nothing unless under X + ;; ) + ;; *all of code was here* + ;; ) (save-excursion (let ((s)(e)(extent)(local-extent-list bib-ext-list) (inhibit-read-only t) @@ -1427,11 +1418,11 @@ See variables bib-etags-command and bib-etags-filename" (let ((before-change-functions) (after-change-functions) ;;(this-overlay (make-overlay s e)) ) -;;; Even using overlays doens't help here. If bib-highlight-mouse-keymap -;;; does not include the AucTeX menus, then these disappear when we click -;;; onto a \cite command. Perhaps using bib-cite as a minor mode will fix -;;; this? For now, bib-cite must be loaded after these menus are built. -;;; It must therefore be loaded in a mode-hook. +;;; Even using overlays doesn't help here. If bib-highlight-mouse-keymap +;;; does not include the AucTeX menus, then these disappear when we click +;;; onto a \cite command. Perhaps using bib-cite as a minor mode will fix +;;; this? For now, bib-cite must be loaded after these menus are built. +;;; It must therefore be loaded in a mode-hook. (put-text-property s e 'local-map bib-highlight-mouse-keymap) (put-text-property s e 'mouse-face 'highlight) ;;(overlay-put this-overlay 'local-map bib-highlight-mouse-keymap) @@ -1462,8 +1453,8 @@ See variables bib-etags-command and bib-etags-filename" (if bib-label-help-echo-format (bib-label-help object bib-label-help-echo-format))) -;;; Balloon-help callback. Anders Stenman <sten...@isy.liu.se> -;;; Patched by Bruce Ravel <bruce.ra...@nist.gov> +;; Balloon-help callback. Anders Stenman <sten...@isy.liu.se> +;; Patched by Bruce Ravel <bruce.ra...@nist.gov> (defun bib-label-help (object &optional format) (or format (setq format "Use mouse button 2 to find the %s. Use mouse button 3 to display the %s.")) @@ -1655,11 +1646,11 @@ If within a multi-file document (in auctex only) (beginning-of-line) (show-entry))))) -(defvar bib-label-prompt-map nil) -(if bib-label-prompt-map - () - (setq bib-label-prompt-map (copy-keymap minibuffer-local-completion-map)) - (define-key bib-label-prompt-map " " 'self-insert-command)) +(defvar bib-label-prompt-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-completion-map) + (define-key map " " 'self-insert-command) + map)) (defun bib-guess-or-prompt-for-label () "Guess from context, or prompt the user for a label command." @@ -1788,7 +1779,7 @@ Does not save excursion." (goto-char the-point) (if (re-search-backward ;;; "\\(^\\|\^M\\)[ \t]*\\\\\\(sub\\)*section{\\([^}]*\\)}" nil t) -;;; Michael Steiner <stei...@cs.uni-sb.de> patch +;;; Michael Steiner <stei...@cs.uni-sb.de> patch "\\(^\\|\^M\\)[ \t]*\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*?\ {\\([^}]*\\)}" nil t) @@ -1808,10 +1799,10 @@ into '((\"label3\") (\"label4\") (\"label1\") (\"label2\") (\"label\"))" (mapcar 'list (bib-cite-mh-list-to-string the-list))) -;;; -;;; Following two functions from mh-utils.el (part of GNU emacs) -;;; I have changed the names in case these functions change what they do. -;;; +;; +;; Following two functions from mh-utils.el (part of GNU emacs) +;; I have changed the names in case these functions change what they do. +;; (defun bib-cite-mh-list-to-string (l) "Flattens the list L and make every element of the new list into a string." @@ -2004,7 +1995,7 @@ Return the-warnings as text." ;; Return the warnings... the-warnings)) -;;; Following contributed by Michael Steiner <stei...@cs.uni-sb.de> The +;; Following contributed by Michael Steiner <stei...@cs.uni-sb.de> The ;; @string abbreviation are not case-sensitive, so we replaced the `member' ;; test above with `member-cis' defined here: (defun member-cis (ELT LIST) @@ -2175,8 +2166,7 @@ Sets global variable bib-document-TeX-files-warnings." (let* ((masterfile (bib-master-file)) (dir (and masterfile (file-name-directory masterfile))) (tex-buffer (get-buffer-create "*tex-document*")) - (the-list (list masterfile)) - (the-file)) + (the-list (list masterfile))) (if (not masterfile) (progn (kill-buffer tex-buffer) @@ -2259,7 +2249,7 @@ Sets global variable bib-document-citekeys-obarray-warnings." (insert-file-contents auxfile)))) (goto-char 1) -;;; Patched by calva...@dis.uniroma1.it (Diego Calvanese) +;;; Patched by calva...@dis.uniroma1.it (Diego Calvanese) ;;; ;; look for \citation{gertsenshtein59} ;;; (while (re-search-forward "^\\\\citation{\\(.*\\)}$" nil t) ;;; (intern (buffer-substring (match-beginning 1)(match-end 1)) @@ -2528,19 +2518,19 @@ If FIRST-FILE is t, stop after first file is found." match)) -;;; (defun psg-checkfor-file-list (filename list) -;;; (let ((the-list list) -;;; (filespec)) -;;; (while the-list -;;; (if (not (car the-list)) ; it is nil -;;; (setq filespec (concat "~/" filename)) -;;; (setq filespec -;;; (concat (file-name-as-directory (car the-list)) filename))) -;;; (if (file-exists-p filespec) -;;; (setq the-list nil) -;;; (setq filespec nil) -;;; (setq the-list (cdr the-list)))) -;;; filespec)) +;; (defun psg-checkfor-file-list (filename list) +;; (let ((the-list list) +;; (filespec)) +;; (while the-list +;; (if (not (car the-list)) ; it is nil +;; (setq filespec (concat "~/" filename)) +;; (setq filespec +;; (concat (file-name-as-directory (car the-list)) filename))) +;; (if (file-exists-p filespec) +;; (setq the-list nil) +;; (setq filespec nil) +;; (setq the-list (cdr the-list)))) +;; filespec)) (or (fboundp 'dired-replace-in-string) ;; This code is part of GNU emacs diff --git a/doc/changes.texi b/doc/changes.texi index a4b2e76a..5483c84c 100644 --- a/doc/changes.texi +++ b/doc/changes.texi @@ -11,6 +11,19 @@ @heading News since 11.88 @itemize @bullet +@item +Commands such as LaTeX and View can now be executed conveniently on the +current section (or part, chapter, subsection, etc). See +@code{LaTeX-command-section} and +@code{LaTeX-command-section-change-level}. +@ifclear rawfile +Also see the documentation at @xref{Starting a Command}. +@end ifclear + +@item +Forward and backward search with Evince now also work when only a region +of the document is compiled/viewed. + @item New option @code{TeX-file-line-error} allows to select file:line:error style for error messages. diff --git a/latex.el b/latex.el index 0022ae24..84096902 100644 --- a/latex.el +++ b/latex.el @@ -441,11 +441,11 @@ the name of the sectioning command inserted with `\\[LaTeX-section]'." (let ((string (completing-read (concat "Level: (default " name ") ") LaTeX-section-list - nil nil nil))) - ; Update name + nil nil nil nil name))) + ;; Update name (if (not (zerop (length string))) (setq name string)) - ; Update level + ;; Update level (setq level (LaTeX-section-level name)))) (defun LaTeX-section-title () @@ -729,6 +729,15 @@ environment just inserted, the buffer position just before (run-hook-with-args 'LaTeX-after-insert-env-hooks environment env-start env-end))) +(defun LaTeX-environment-name-regexp () + "Return the regexp matching the name of a LaTeX environment. +This matches everything different from a TeX closing brace but +allowing one level of TeX group braces." + (concat "\\([^" (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\(" + (regexp-quote TeX-grop) "[^" (regexp-quote TeX-grcl) + (regexp-quote TeX-grop) "]*" (regexp-quote TeX-grcl) "\\)*[^" + (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\)")) + (defun LaTeX-modify-environment (environment) "Modify current ENVIRONMENT." (save-excursion @@ -736,7 +745,7 @@ environment just inserted, the buffer position just before (re-search-backward (concat (regexp-quote TeX-esc) "end" (regexp-quote TeX-grop) - " *\\([a-zA-Z*]*\\)" + (LaTeX-environment-name-regexp) (regexp-quote TeX-grcl)) (save-excursion (beginning-of-line 1) (point))) (replace-match (concat TeX-esc "end" TeX-grop environment TeX-grcl) t t) @@ -745,7 +754,7 @@ environment just inserted, the buffer position just before (re-search-forward (concat (regexp-quote TeX-esc) "begin" (regexp-quote TeX-grop) - " *\\([a-zA-Z*]*\\)" + (LaTeX-environment-name-regexp) (regexp-quote TeX-grcl)) (save-excursion (end-of-line 1) (point))) (replace-match (concat TeX-esc "begin" TeX-grop environment TeX-grcl) t t))) @@ -1173,7 +1182,10 @@ Just like array and tabular." (save-excursion (LaTeX-find-matching-begin) (end-of-line) - (TeX-parse-arguments args))) + (let ((exit-mark (if (boundp 'exit-mark) + exit-mark + (make-marker)))) + (TeX-parse-arguments args)))) ;;; Item hooks @@ -2902,6 +2914,8 @@ indentation level in columns." "*Regexp matching environments with indentation at col 0 for begin/end." :group 'LaTeX-indentation :type 'regexp) +(make-obsolete-variable 'LaTeX-verbatim-regexp 'LaTeX-verbatim-environments-local + "2014-12-19") (defcustom LaTeX-begin-regexp "begin\\b" "*Regexp matching macros considered begins." @@ -3033,6 +3047,10 @@ Lines starting with an item is given an extra indentation of (delete-region (line-beginning-position) (point)) (indent-to outer-indent)) +(defun LaTeX-verbatim-regexp () + "Calculate the verbatim env regex from `LaTeX-verbatim-environments'." + (regexp-opt (LaTeX-verbatim-environments))) + (defun LaTeX-indent-calculate (&optional force-type) "Return the indentation of a line of LaTeX source. FORCE-TYPE can be used to force the calculation of an inner or @@ -3064,7 +3082,7 @@ outer indentation in case of a commented line. The symbols (nth 1 entry))) ((looking-at (concat (regexp-quote TeX-esc) "\\(begin\\|end\\){\\(" - LaTeX-verbatim-regexp + (LaTeX-verbatim-regexp) "\\)}")) ;; \end{verbatim} must be flush left, otherwise an unwanted ;; empty line appears in LaTeX's output. @@ -3196,19 +3214,19 @@ outer indentation in case of a commented line. The symbols 0) ((looking-at (concat (regexp-quote TeX-esc) "begin *{\\(" - LaTeX-verbatim-regexp + (LaTeX-verbatim-regexp) "\\)}")) 0) ((looking-at (concat (regexp-quote TeX-esc) "end *{\\(" - LaTeX-verbatim-regexp + (LaTeX-verbatim-regexp) "\\)}")) ;; If I see an \end{verbatim} in the previous line I skip ;; back to the preceding \begin{verbatim}. (save-excursion (if (re-search-backward (concat (regexp-quote TeX-esc) "begin *{\\(" - LaTeX-verbatim-regexp + (LaTeX-verbatim-regexp) "\\)}") 0 t) (LaTeX-indent-calculate-last force-type) 0))) @@ -4124,7 +4142,7 @@ environment in commented regions with the same comment prefix." (comment-prefix (and in-comment (TeX-comment-prefix))) (case-fold-search nil)) (save-excursion - (skip-chars-backward "a-zA-Z \t{") + (skip-chars-backward (concat "a-zA-Z \t" (regexp-quote TeX-grop))) (unless (bolp) (backward-char 1) (and (looking-at regexp) @@ -4143,7 +4161,8 @@ environment in commented regions with the same comment prefix." (setq level (1+ level)) (setq level (1- level))))) (if (= level 0) - (search-forward "}") + (re-search-forward + (concat TeX-grop (LaTeX-environment-name-regexp) TeX-grcl)) (error "Can't locate end of current environment")))) (defun LaTeX-find-matching-begin () @@ -4158,7 +4177,7 @@ environment in commented regions with the same comment prefix." (in-comment (TeX-in-commented-line)) (comment-prefix (and in-comment (TeX-comment-prefix))) (case-fold-search nil)) - (skip-chars-backward "a-zA-Z \t{") + (skip-chars-backward (concat "a-zA-Z \t" (regexp-quote TeX-grop))) (unless (bolp) (backward-char 1) (and (looking-at regexp) @@ -5682,6 +5701,10 @@ This happens when \\left is inserted." ;;;###autoload (add-to-list 'auto-mode-alist '("\\.drv\\'" . latex-mode)) +;; HeVeA files (LaTeX -> HTML converter: http://hevea.inria.fr/) +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.hva\\'" . latex-mode)) + ;;;###autoload (defun TeX-latex-mode () "Major mode in AUCTeX for editing LaTeX files. diff --git a/style/alltt.el b/style/alltt.el index e5c56845..86b49934 100644 --- a/style/alltt.el +++ b/style/alltt.el @@ -37,8 +37,6 @@ (make-local-variable 'LaTeX-indent-environment-list) (add-to-list 'LaTeX-indent-environment-list '("alltt" current-indentation)) - (make-local-variable 'LaTeX-verbatim-regexp) - (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|alltt")) (add-to-list 'LaTeX-verbatim-environments-local "alltt") ;; Fontification (when (and (featurep 'font-latex) diff --git a/style/babel.el b/style/babel.el index 88b10b23..c1119b9b 100644 --- a/style/babel.el +++ b/style/babel.el @@ -30,6 +30,8 @@ ;;; Code: +(eval-when-compile (require 'cl)) + (defvar LaTeX-babel-language-list '("afrikaans" "bahasa" "indonesian" "indon" "bahasai" "bahasam" "malay" "meyalu" @@ -107,12 +109,12 @@ ;; Append element to `active-languages' to respect loading order. ;; `babel' package uses as default language the last loaded one, ;; except if it is set with the `main' option. - (add-to-list 'active-languages elt t)))) + (pushnew elt active-languages :test #'equal)))) (if main-language - (add-to-list 'active-languages main-language t)) - active-languages)) + (pushnew main-language active-languages :test #'equal)) + (nreverse active-languages))) -(defun TeX-arg-babel-lang (optional &optional prompt) +(defun TeX-arg-babel-lang (_optional &optional _prompt) "Prompt for a language with completion and insert it as an argument." (TeX-argument-insert (completing-read "Language: " (LaTeX-babel-active-languages)) nil)) diff --git a/style/baskervaldx.el b/style/baskervaldx.el new file mode 100644 index 00000000..692e632c --- /dev/null +++ b/style/baskervaldx.el @@ -0,0 +1,73 @@ +;;; baskervaldx.el --- AUCTeX style for `baskervaldx.sty' (v1.04) + +;; Copyright (C) 2014 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-11-18 +;; 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 `baskervaldx.sty' (v1.04) from 2014/04/27. +;; `baskervaldx.sty' is part of TeXLive. + +;;; Code: + +(TeX-add-style-hook + "baskervaldx" + (lambda () + + ;; Run style hook for various packages loaded by baskervaldx + (TeX-run-style-hooks "textcomp" "fontaxes") + + ;; New symbols + (TeX-add-symbols + + ;; Only preamble commands + '("useosf" 0) + + ;; Text commands + '("textlf" t) ; proportional lining figures + '("texttlf" t) ; tabular lining figures + '("textosf" t) ; proportional oldstyle figures + '("texttosf" t) ; tabular oldstyle figures + '("textsu" t) ; superior figures + '("swshape" -1)) ; italic shape with ligatures activated + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("textlf" "{") + ("texttlf" "{") + ("textosf" "{") + ("texttosf" "{") + ("textsu" "{")) + 'type-command) + (font-latex-add-keywords '(("swshape" "")) + 'bold-declaration))) + LaTeX-dialect) + +(defvar LaTeX-baskervaldx-package-options + '("lining" "lf" "oldstyle" "osf" "tabular" "proportional" + "scale" "scaled" "sups" "swash") + "Package options for the baskervaldx package.") + +;;; baskervaldx.el ends here diff --git a/style/beamer.el b/style/beamer.el index 9b18c07b..58bef382 100644 --- a/style/beamer.el +++ b/style/beamer.el @@ -29,7 +29,7 @@ ;;; Code: -(defun LaTeX-beamer-after-insert-env (env start end) +(defun LaTeX-beamer-after-insert-env (env start _end) "Do beamer-specific stuff after the insertion of an environment." ;; Add `fragile' as an optional argument to the frame environment if ;; a verbatim environment is inserted. @@ -137,7 +137,7 @@ '("exampleblock" 1) '("frame" (lambda (env &rest ignore) (let ((title (TeX-read-string "(Optional) Title: " nil - 'LaTeX-beamer-frametitle-history))) + 'LaTeX-beamer-frametitle-history))) (LaTeX-insert-environment env) (unless (zerop (length title)) (save-excursion @@ -172,8 +172,6 @@ (make-local-variable 'LaTeX-indent-environment-list) (add-to-list 'LaTeX-indent-environment-list '("semiverbatim" current-indentation)) - (make-local-variable 'LaTeX-verbatim-regexp) - (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|semiverbatim")) (add-to-list 'LaTeX-verbatim-environments-local "semiverbatim") ;; Fontification @@ -190,14 +188,14 @@ (font-lock-set-defaults))) LaTeX-dialect) -(defun TeX-arg-beamer-overlay-spec (optional &optional prompt) +(defun TeX-arg-beamer-overlay-spec (_optional &optional _prompt) "Prompt for overlay specification." (let ((overlay (TeX-read-string "(Optional) Overlay: "))) (unless (zerop (length overlay)) (insert "<" overlay ">")) (indent-according-to-mode))) -(defun TeX-arg-beamer-frametitle (optional &optional prompt) +(defun TeX-arg-beamer-frametitle (_optional &optional _prompt) "Prompt for the frametitle." (let ((title (TeX-read-string "Title: " nil 'LaTeX-beamer-frametitle-history))) (if (not (zerop (length title))) @@ -221,7 +219,7 @@ unconditionally." (insert " ") (indent-according-to-mode)) -(defun TeX-arg-beamer-note (optional &optional prompt) +(defun TeX-arg-beamer-note (_optional &optional _prompt) "Prompt for overlay specification and optional argument." (let ((overlay (TeX-read-string "(Optional) Overlay: ")) (options (TeX-read-string "(Optional) Options: "))) @@ -257,7 +255,7 @@ also be a string. Then the length of the string is used." (substring file chars)))) (TeX-search-files nil exts t t)))))) -(defun LaTeX-arg-beamer-theme (&rest ignore) +(defun LaTeX-arg-beamer-theme (&rest _ignore) "Prompt for beamer theme with completion." (TeX-argument-insert (completing-read @@ -276,7 +274,7 @@ also be a string. Then the length of the string is used." nil nil nil) t)) -(defun LaTeX-arg-beamer-inner-theme (&rest ignore) +(defun LaTeX-arg-beamer-inner-theme (&rest _ignore) "Prompt for beamer inner theme with completion." (TeX-argument-insert (completing-read @@ -295,7 +293,7 @@ also be a string. Then the length of the string is used." nil nil nil) t)) -(defun LaTeX-arg-beamer-outer-theme (&rest ignore) +(defun LaTeX-arg-beamer-outer-theme (&rest _ignore) "Prompt for beamer outer theme with completion." (TeX-argument-insert (completing-read @@ -314,7 +312,7 @@ also be a string. Then the length of the string is used." nil nil nil) t)) -(defun LaTeX-arg-beamer-color-theme (&rest ignore) +(defun LaTeX-arg-beamer-color-theme (&rest _ignore) "Prompt for beamer color theme with completion." (TeX-argument-insert (completing-read @@ -333,7 +331,7 @@ also be a string. Then the length of the string is used." nil nil nil) t)) -(defun LaTeX-arg-beamer-font-theme (&rest ignore) +(defun LaTeX-arg-beamer-font-theme (&rest _ignore) "Prompt for beamer font theme with completion." (TeX-argument-insert (completing-read diff --git a/style/bigstrut.el b/style/bigstrut.el index 14269db8..3ece300a 100644 --- a/style/bigstrut.el +++ b/style/bigstrut.el @@ -1,6 +1,6 @@ ;;; bigstrut.el --- AUCTeX style for `bigstrut.sty' -;; Copyright (C) 2012 Free Software Foundation, Inc. +;; Copyright (C) 2012, 2014 Free Software Foundation, Inc. ;; Author: Mads Jensen <m...@inducks.org> ;; Maintainer: auctex-devel@gnu.org @@ -37,12 +37,13 @@ '("bigstrut" [ TeX-arg-bigstrut ]))) LaTeX-dialect) -(defun TeX-arg-bigstrut (optional &optional prompt) - "Prompt for the optional argument in \\bigstrut" +(defun TeX-arg-bigstrut (optional &optional _prompt) + "Prompt for the optional argument in \\bigstrut." (TeX-argument-insert (completing-read (TeX-argument-prompt optional "Strut to top (t) or bottom (b)" nil t) - (mapcar 'list '("t" "b")) nil t) optional)) + (mapcar 'list '("t" "b")) nil t) + optional)) (defvar LaTeX-bigstrut-package-options nil "Package options for the bigstrut package.") diff --git a/style/dinbrief.el b/style/dinbrief.el index 9506d15f..6455e825 100644 --- a/style/dinbrief.el +++ b/style/dinbrief.el @@ -215,8 +215,8 @@ (progn (goto-char (point-min)) ; insert before \end{document} (if (re-search-forward ".end.document." (point-max) t) - (beginning-of-line 1)) - (previous-line 1) + (beginning-of-line 1)) + (previous-line 1) ;FIXME: Use forward-line! (LaTeX-dinbrief-insert TeX-esc "address" TeX-grop name) (if (not (zerop (length str))) (progn diff --git a/style/emp.el b/style/emp.el index 04016673..e42b23ce 100644 --- a/style/emp.el +++ b/style/emp.el @@ -64,7 +64,7 @@ Used for emp, empdef, and empgraph environments." (indent-according-to-mode) )) -(defun LaTeX-env-empfile (optional) +(defun LaTeX-env-empfile (_optional) "Ask for file. Insert empfile environment" (let ((empfile (TeX-read-string "empfile: " ""))) (if (not (zerop (length empfile))) diff --git a/style/epsf.el b/style/epsf.el index c8ac8bc3..ab5b022f 100644 --- a/style/epsf.el +++ b/style/epsf.el @@ -19,7 +19,7 @@ "epsfllx" "epsflly" "epsfury" "epsfverbosetrue")) LaTeX-dialect) -(defun TeX-arg-epsfsize (optional &optional prompt definition) +(defun TeX-arg-epsfsize (_optional &optional _prompt _definition) "Create a line that print epsf figures at a certain percentage" (interactive) (let ((scale (TeX-read-string "Scale in percent (default 75): "))) diff --git a/style/erewhon.el b/style/erewhon.el new file mode 100644 index 00000000..eaa8e671 --- /dev/null +++ b/style/erewhon.el @@ -0,0 +1,79 @@ +;;; erewhon.el --- AUCTeX style for `erewhon.sty' (v1.0) + +;; Copyright (C) 2014 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-11-18 +;; 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 `erewhon.sty' (v1.0) from 2014/09/08. +;; `erewhon.sty' is part of TeXLive. + +;;; Code: + +(TeX-add-style-hook + "erewhon" + (lambda () + + ;; Run style hook for various packages loaded by erewhon + (TeX-run-style-hooks "textcomp" "fontaxes") + + ;; New symbols + (TeX-add-symbols + + ;; Only preamble commands + '("useosf" 0) + + ;; Text commands + '("textlf" t) ; proportional lining figures + '("texttlf" t) ; tabular lining figures + '("textosf" t) ; proportional oldstyle figures + '("texttosf" t) ; tabular oldstyle figures + '("textsu" t) ; superior figures + '("textin" t) ; inferior figures + '("textnu" t) ; numerator figures + '("textde" t) ; denominator figures + '("textfrac" "Numerator" "Denominator")) + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("textlf" "{") + ("texttlf" "{") + ("textosf" "{") + ("texttosf" "{") + ("textsu" "{") + ("textin" "{") + ("textnu" "{") + ("textde" "{")) + 'type-command) + (font-latex-add-keywords '(("textfrac" "{{")) + 'textual))) + LaTeX-dialect) + +(defvar LaTeX-erewhon-package-options + '("lining" "lf" "oldstyle" "osf" "tabular" "p" "proportional" + "scale" "scaled" "scosf" "space" "sups") + "Package options for the erewhon package.") + +;;; erewhon.el ends here diff --git a/style/fancyref.el b/style/fancyref.el index 9d870e71..94b7e15e 100644 --- a/style/fancyref.el +++ b/style/fancyref.el @@ -1,6 +1,6 @@ ;;; fancyref.el --- AUCTeX style file with support for fancyref.sty -;; Copyright (C) 1999 Free Software Foundation, Inc. +;; Copyright (C) 1999, 2014 Free Software Foundation, Inc. ;; Author: Carsten Dominik <domi...@strw.leidenuniv.nl> ;; Maintainer: auctex-devel@gnu.org @@ -106,7 +106,7 @@ (defun LaTeX-fancyref-formats () LaTeX-fancyref-formats) -(defun TeX-arg-fancyref-format (optional &optional prompt definition) +(defun TeX-arg-fancyref-format (optional &optional prompt _definition) "Prompt for a fancyref format name. If the user gives an unknown name, add it to the list." (let ((format (completing-read (TeX-argument-prompt optional prompt "Format") diff --git a/style/fancyvrb.el b/style/fancyvrb.el index 92718b4c..83347087 100644 --- a/style/fancyvrb.el +++ b/style/fancyvrb.el @@ -159,10 +159,6 @@ "FancyVerbLine") ;; Filling - (set (make-local-variable 'LaTeX-verbatim-regexp) - (concat - LaTeX-verbatim-regexp - "\\|Verbatim\\|BVerbatim\\|LVerbatim\\|SaveVerbatim\\|VerbatimOut")) (add-to-list 'LaTeX-verbatim-environments-local "Verbatim") (add-to-list 'LaTeX-verbatim-environments-local "BVerbatim") (add-to-list 'LaTeX-verbatim-environments-local "LVerbatim") @@ -190,7 +186,7 @@ ("LVerbatimInput" "[{")) 'reference) (font-latex-add-keywords '(("Verb" "[")) ; The second argument should - ; actually be verbatim. + ; actually be verbatim. 'textual) (font-latex-add-keywords '(("fvset" "{")) 'variable) ;; For syntactic fontification, e.g. verbatim constructs. diff --git a/style/fbb.el b/style/fbb.el new file mode 100644 index 00000000..220da8f3 --- /dev/null +++ b/style/fbb.el @@ -0,0 +1,71 @@ +;;; fbb.el --- AUCTeX style for `fbb.sty' (v1.06) + +;; Copyright (C) 2014 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-11-19 +;; 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 `fbb.sty' (v1.06) from 2014/09/09. +;; `fbb.sty' is part of TeXLive. + +;;; Code: + +(TeX-add-style-hook + "fbb" + (lambda () + + ;; Run style hook for various packages loaded by fbb + (TeX-run-style-hooks "textcomp" "fontaxes") + + ;; New symbols + (TeX-add-symbols + + ;; Only preamble commands + '("useosf" 0) + '("usetosf" 0) + + ;; Text commands + '("textlf" t) ; proportional lining figures + '("texttlf" t) ; tabular lining figures + '("textosf" t) ; proportional oldstyle figures + '("texttosf" t) ; tabular oldstyle figures + '("textsu" t)) ; superior figures + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("textlf" "{") + ("texttlf" "{") + ("textosf" "{") + ("texttosf" "{") + ("textsu" "{")) + 'type-command))) + LaTeX-dialect) + +(defvar LaTeX-fbb-package-options + '("lining" "osf" "oldstyle" "tabular" "p" "proportional" + "scale" "scaled" "scosf" "sups") + "Package options for the fbb package.") + +;;; fbb.el ends here diff --git a/style/graphicx.el b/style/graphicx.el index 7f66e527..a894dadb 100644 --- a/style/graphicx.el +++ b/style/graphicx.el @@ -91,7 +91,7 @@ doesn't works with Emacs 21.3 or XEmacs. See (string-match (LaTeX-includegraphics-extensions) fname)))) (TeX-master-directory))) -(defun LaTeX-arg-includegraphics (prefix) +(defun LaTeX-arg-includegraphics (_prefix) "Ask for mandantory and optional arguments for the \\includegraphics command. The extent of the optional arguments is determined by the prefix argument and diff --git a/style/harvard.el b/style/harvard.el index 35892b7a..08addb46 100644 --- a/style/harvard.el +++ b/style/harvard.el @@ -1,6 +1,6 @@ ;;; harvard.el --- Support for Harvard Citation style package for AUCTeX. -;; Copyright (C) 1994, 1997, 2005, 2012 Free Software Foundation, Inc. +;; Copyright (C) 1994, 1997, 2005, 2012, 2014 Free Software Foundation, Inc. ;; Author: Berwin Turlach <sta...@nus.edu.sg> ;; Maintainer: auctex-devel@gnu.org @@ -25,89 +25,89 @@ ;;; Code: -(TeX-add-style-hook "harvard" - (function - (lambda () - - (LaTeX-add-environments - '("thebibliography" LaTeX-env-harvardbib ignore)) - - (TeX-add-symbols - "harvardand" - '("citeasnoun" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite) - '("possessivecite" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite) - '("citeaffixed" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite "Affix") - '("citeyear" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite) - '("citename" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite) - '("citationstyle" - (TeX-arg-eval completing-read "Citation style: " '(("agsm") ("dcu")))) - '("citationmode" - (TeX-arg-eval completing-read "Citation mode: " - '(("full") ("abbr") ("default")))) - '("harvardparenthesis" - (TeX-arg-eval completing-read "Harvardparenthesis: " - '(("round") ("curly") ("angle") ("square")))) - '("bibliographystyle" - (TeX-arg-eval - completing-read "Bibliography style: " - '(("agsm") ("apsr") ("dcu") ("jmr") ("jphysicsB") ("kluwer") ("nederlands") ("econometrica"))) - ignore) - '("harvarditem" [ "Short citation" ] - "Complete citation" "Year" TeX-arg-define-cite)) - - (setq TeX-complete-list - (append '(("\\\\citeasnoun\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\citeasnoun{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\possessivecite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\possessivecite{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\citename\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\citename{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\citeaffixed\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\citeaffixed{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\citeaffixed{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)" - 2 LaTeX-bibitem-list) - ("\\\\citeyear\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\citeyear{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\citeyear{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)" - 2 LaTeX-bibitem-list)) - TeX-complete-list)) - - (setq LaTeX-auto-regexp-list - (append '(("\\\\harvarditem{\\([a-zA-Z][^%#'()={}]*\\)}{\\([0-9][^, %\"#'()={}]*\\)}{\\([a-zA-Z][^, %\"#'()={}]*\\)}" 3 LaTeX-auto-bibitem) - ("\\\\harvarditem\\[[^][\n\r]+\\]{\\([a-zA-Z][^%#'()={}]*\\)}{\\([0-9][^, %\"#'()={}]*\\)}{\\([a-zA-Z][^, %\"#'()={}]*\\)}" 3 LaTeX-auto-bibitem) - ) - LaTeX-auto-regexp-list)) - - (setq LaTeX-item-list - (cons '("thebibliography" . LaTeX-item-harvardbib) - LaTeX-item-list)) - - ;; Tell RefTeX - (when (fboundp 'reftex-set-cite-format) - (reftex-set-cite-format 'harvard)))) +(TeX-add-style-hook + "harvard" + #'(lambda () + + (LaTeX-add-environments + '("thebibliography" LaTeX-env-harvardbib ignore)) + + (TeX-add-symbols + "harvardand" + '("citeasnoun" + (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) + TeX-arg-cite) + '("possessivecite" + (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) + TeX-arg-cite) + '("citeaffixed" + (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) + TeX-arg-cite "Affix") + '("citeyear" + (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) + TeX-arg-cite) + '("citename" + (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) + TeX-arg-cite) + '("citationstyle" + (TeX-arg-eval completing-read "Citation style: " '(("agsm") ("dcu")))) + '("citationmode" + (TeX-arg-eval completing-read "Citation mode: " + '(("full") ("abbr") ("default")))) + '("harvardparenthesis" + (TeX-arg-eval completing-read "Harvardparenthesis: " + '(("round") ("curly") ("angle") ("square")))) + '("bibliographystyle" + (TeX-arg-eval + completing-read "Bibliography style: " + '(("agsm") ("apsr") ("dcu") ("jmr") ("jphysicsB") ("kluwer") ("nederlands") ("econometrica"))) + ignore) + '("harvarditem" [ "Short citation" ] + "Complete citation" "Year" TeX-arg-define-cite)) + + (setq TeX-complete-list + (append '(("\\\\citeasnoun\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" + 1 LaTeX-bibitem-list "}") + ("\\\\citeasnoun{\\([^{}\n\r\\%,]*\\)" 1 + LaTeX-bibitem-list "}") + ("\\\\possessivecite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" + 1 LaTeX-bibitem-list "}") + ("\\\\possessivecite{\\([^{}\n\r\\%,]*\\)" 1 + LaTeX-bibitem-list "}") + ("\\\\citename\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" + 1 LaTeX-bibitem-list "}") + ("\\\\citename{\\([^{}\n\r\\%,]*\\)" 1 + LaTeX-bibitem-list "}") + ("\\\\citeaffixed\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" + 1 LaTeX-bibitem-list "}") + ("\\\\citeaffixed{\\([^{}\n\r\\%,]*\\)" 1 + LaTeX-bibitem-list "}") + ("\\\\citeaffixed{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)" + 2 LaTeX-bibitem-list) + ("\\\\citeyear\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" + 1 LaTeX-bibitem-list "}") + ("\\\\citeyear{\\([^{}\n\r\\%,]*\\)" 1 + LaTeX-bibitem-list "}") + ("\\\\citeyear{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)" + 2 LaTeX-bibitem-list)) + TeX-complete-list)) + + (setq LaTeX-auto-regexp-list + (append '(("\\\\harvarditem{\\([a-zA-Z][^%#'()={}]*\\)}{\\([0-9][^, %\"#'()={}]*\\)}{\\([a-zA-Z][^, %\"#'()={}]*\\)}" 3 LaTeX-auto-bibitem) + ("\\\\harvarditem\\[[^][\n\r]+\\]{\\([a-zA-Z][^%#'()={}]*\\)}{\\([0-9][^, %\"#'()={}]*\\)}{\\([a-zA-Z][^, %\"#'()={}]*\\)}" 3 LaTeX-auto-bibitem) + ) + LaTeX-auto-regexp-list)) + + (setq LaTeX-item-list + (cons '("thebibliography" . LaTeX-item-harvardbib) + LaTeX-item-list)) + + ;; Tell RefTeX + (when (fboundp 'reftex-set-cite-format) + (reftex-set-cite-format 'harvard))) LaTeX-dialect) -(defun LaTeX-env-harvardbib (environment &optional ignore) +(defun LaTeX-env-harvardbib (environment &optional _ignore) "Insert ENVIRONMENT with label for harvarditem." (LaTeX-insert-environment environment (concat TeX-grop "xx" TeX-grcl)) diff --git a/style/hyperref.el b/style/hyperref.el index ad1c628a..a1eee7cd 100644 --- a/style/hyperref.el +++ b/style/hyperref.el @@ -1,6 +1,6 @@ ;;; hyperref.el --- AUCTeX style for `hyperref.sty' v6.83m -;; Copyright (C) 2008, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2008, 2013, 2014 Free Software Foundation, Inc. ;; Author: Ralf Angeli <ang...@caeruleus.net> ;; Maintainer: auctex-devel@gnu.org @@ -153,6 +153,64 @@ ("nextactionraw")) "Key=value options for href macro of the hyperref package.") +;; See http://www.tug.org/applications/hyperref/ftp/doc/manual.html#x1-220006.2 + +(defvar LaTeX-hyperref-forms-options + '(("accesskey") + ("align" ("0" "1" "2")) + ("altname") + ("backgroundcolor") + ("bordercolor") + ("bordersep") + ("borderwidth") + ;; "borderstyle" is not mentioned in the original hyperref-doc, it + ;; can be seen in action in + ;; http://mirrors.ctan.org/macros/latex/contrib/hyperref/test/testform.tex + ;; S=Solid (default), D=Dashed, B=Beveled, I=Inset, U=Underline + ("borderstyle" ("S" "D" "B" "I" "U")) + ("calculate") + ("charsize") + ("checkboxsymbol" ("true" "false")) + ("checked") + ("color") + ("combo" ("true" "false")) + ("default") + ("disabled" ("true" "false")) + ("format") + ("height") + ("hidden" ("true" "false")) + ("keystroke") + ("mappingname") + ("maxlen") + ("menulength") + ("multiline" ("true" "false")) + ("name") + ("onblur") + ("onchange") + ("onclick") + ("ondblclick") + ("onfocus") + ("onkeydown") + ("onkeypress") + ("onkeyup") + ("onmousedown") + ("onmousemove") + ("onmouseout") + ("onmouseover") + ("onmouseup") + ("onselect") + ("password" ("true" "false")) + ("popdown" ("true" "false")) + ("radio" ("true" "false")) + ("radiosymbol") + ("readonly" ("true" "false")) + ("rotation") + ("tabkey") + ("validate") + ("value") + ("width")) + "Key=value options for Forms related macros of the hyperref package.") + (TeX-add-style-hook "hyperref" (lambda () @@ -184,12 +242,15 @@ '("texorpdfstring" "TeX string" "PDF string") '("hypercalcbp" t) '("Acrobatmenu" "Menu option" "Text") - '("TextField" ["Parameters"] "Label") - '("CheckBox" ["Parameters"] "Label") - '("ChoiceMenu" ["Parameters"] "Label" "Choices") - '("PushButton" ["Parameters"] "Label") - '("Submit" ["Parameters"] "Label") - '("Reset" ["Parameters"] "Label") + ;; The next 6 macros take Key-vals defined in + ;; "LaTeX-hyperref-forms-options". For an example, see + ;; http://mirrors.ctan.org/macros/latex/contrib/hyperref/test/testform.tex + '("TextField" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") + '("CheckBox" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") + '("ChoiceMenu" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label" "Choices") + '("PushButton" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") + '("Submit" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") + '("Reset" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") '("LayoutTextField" "Label" "Field") '("LayoutChoiceField" "Label" "Field") '("LayoutCheckField" "Label" "Field") @@ -199,6 +260,12 @@ '("MakeChoiceField" "Width" "Height") '("MakeButtonField" "Text")) + ;; Form fields must be inside a "Form"-env, one per file is allowed, cf. + ;; http://www.tug.org/applications/hyperref/ftp/doc/manual.html#x1-200006 + ;; It is up to user to insert [<options>] after \begin{Form} + (LaTeX-add-environments + '("Form")) + (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl") (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl") (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage") diff --git a/style/inputenc.el b/style/inputenc.el index e496cc66..53ba4f96 100644 --- a/style/inputenc.el +++ b/style/inputenc.el @@ -68,7 +68,7 @@ selected))) (TeX-read-string "Input encoding: "))) -(defun LaTeX-arg-inputenc-inputenc (optional) +(defun LaTeX-arg-inputenc-inputenc (_optional) "Prompt for input encoding." (TeX-argument-insert (LaTeX-inputenc-package-options) nil)) diff --git a/style/listings.el b/style/listings.el index 534de626..ace5c97d 100644 --- a/style/listings.el +++ b/style/listings.el @@ -248,8 +248,6 @@ (make-local-variable 'LaTeX-indent-environment-list) (add-to-list 'LaTeX-indent-environment-list '("lstlisting" current-indentation)) - (make-local-variable 'LaTeX-verbatim-regexp) - (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|lstlisting")) (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") @@ -260,7 +258,7 @@ (font-latex-add-keywords '(("lstnewenvironment" "{[[{{")) 'function) (font-latex-add-keywords '(("lstinputlisting" "[{")) 'reference) (font-latex-add-keywords '(("lstinline" "[{") ; The second argument should - ; actually be verbatim. + ; actually be verbatim. ("lstlistoflistings" "")) 'textual) (font-latex-add-keywords '(("lstalias" "{{") diff --git a/style/mathtools.el b/style/mathtools.el index 04ecc0dc..0890ce67 100644 --- a/style/mathtools.el +++ b/style/mathtools.el @@ -148,25 +148,25 @@ '("splitdfrac" 2)) (setq LaTeX-item-list - (append '(("multlined" . LaTeX-item-equation) - ("lgathered" . LaTeX-item-equation) - ("rgathered" . LaTeX-item-equation) + (append '(("multlined" . LaTeX-item-equation) + ("lgathered" . LaTeX-item-equation) + ("rgathered" . LaTeX-item-equation) ("spreadlines" . LaTeX-item-equation) - ("matrix*" . LaTeX-item-equation) - ("pmatrix*" . LaTeX-item-equation) - ("bmatrix*" . LaTeX-item-equation) - ("Bmatrix*" . LaTeX-item-equation) - ("vmatrix*" . LaTeX-item-equation) - ("Vmatrix*" . LaTeX-item-equation) - ("dcases" . LaTeX-item-equation) - ("dcases*" . LaTeX-item-equation)) + ("matrix*" . LaTeX-item-equation) + ("pmatrix*" . LaTeX-item-equation) + ("bmatrix*" . LaTeX-item-equation) + ("Bmatrix*" . LaTeX-item-equation) + ("vmatrix*" . LaTeX-item-equation) + ("Vmatrix*" . LaTeX-item-equation) + ("dcases" . LaTeX-item-equation) + ("dcases*" . LaTeX-item-equation)) LaTeX-item-list)) (setq LaTeX-label-alist - (append '(("lgathered" . LaTeX-amsmath-label) - ("rgathered" . LaTeX-amsmath-label) - ("multlined" . LaTeX-amsmath-label) - LaTeX-label-alist)))) + (append '(("lgathered" . LaTeX-amsmath-label) + ("rgathered" . LaTeX-amsmath-label) + ("multlined" . LaTeX-amsmath-label)) + LaTeX-label-alist))) LaTeX-dialect) (defun LaTeX-mathtools-env-matrix-starred (env) diff --git a/style/minted.el b/style/minted.el new file mode 100644 index 00000000..758a52bf --- /dev/null +++ b/style/minted.el @@ -0,0 +1,241 @@ +;;; minted.el --- AUCTeX style for `minted.sty' + +;; Copyright (C) 2014, 2015 Free Software Foundation, Inc. + +;; Author: Tassilo Horn <t...@gnu.org> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-12-19 +;; 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 `minted.sty'. + +;;; Code: + +(require 'tex) + +(defvar LaTeX-minted-key-val-options + '(("autogobble" ("true" "false")) + ("baselinestretch" ("auto")) + ("bgcolor") + ("codetagify") + ("encoding") + ("outencoding") + ("firstline") + ("firstnumber" ("auto")) + ("fontfamily" ("tt" "courier" "helvetica")) + ("fontseries" ("auto")) + ("fontsize" ("auto" "\\tiny" "\\large" "\\scriptsize" "\\Large" + "\\footnotesize" "\\LARGE" "\\small" "\\huge" + "\\normalsize" "\\Huge")) + ("fontshape" ("auto")) + ("formatcom") + ("frame" ("none" "leftline" "topline" "bottomline" "lines" "single")) + ("framerule") + ("framesep") + ("funcnamehighlighting" ("true" "false")) + ("gobble") + ("keywordcase" ("lower" "upper" "capitalize")) + ("label") + ("labelposition" ("none" "topline" "bottomline" "all")) + ("lastline") + ("linenos" ("true" "false")) + ("numbers" ("left" "right")) + ("mathescape" ("true" "false")) + ("numberblanklines" ("true" "false")) + ("numbersep") + ("obeytabs" ("true" "false")) + ("python3" ("true" "false")) + ("resetmargins" ("true" "false")) + ("rulecolor") + ("samepage" ("true" "false")) + ("showspaces" ("true" "false")) + ("showtabs" ("true" "false")) + ("startinline" ("true" "false")) + ("style") + ("stepnumber") + ("stripnl") + ("tabsize") + ("texcl" ("true" "false")) + ("texcomments" ("true" "false")) + ("xleftmargin") + ("xrightmargin")) + "Key=value options for minted macros and environments.") + +(defvar LaTeX-minted-pygmentize-program (executable-find "pygmentize")) + +(defvar LaTeX-minted-language-list nil) + +(defun LaTeX-minted-language-list (&rest _ignored) + (or LaTeX-minted-language-list + (when LaTeX-minted-pygmentize-program + (with-temp-buffer + (shell-command (concat LaTeX-minted-pygmentize-program " -L lexers") + (current-buffer)) + (goto-char (point-min)) + (let (languages) + (while (re-search-forward "^\\*[[:space:]]\\([^:]+\\):" nil t) + (dolist (lang (split-string (match-string 1) "[[:space:],]" t)) + (push lang languages))) + languages))))) + +(defun LaTeX-arg-minted-language (optional &optional prompt) + (TeX-argument-insert + (completing-read (TeX-argument-prompt optional prompt "Language") + (LaTeX-minted-language-list)) + optional)) + +(defvar LaTeX-minted-auto-newminted nil) +(defvar LaTeX-minted-newminted-regexp + '("\\\\newminted\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}" + (1 2) LaTeX-minted-auto-newminted)) + +(defvar LaTeX-minted-auto-newmint nil) +(defvar LaTeX-minted-newmint-regexp + '("\\\\newmint\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}" + (1 2) LaTeX-minted-auto-newmint)) + +(defvar LaTeX-minted-auto-newmintinline nil) +(defvar LaTeX-minted-newmintinline-regexp + '("\\\\newmintinline\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}" + (1 2) LaTeX-minted-auto-newmintinline)) + +(defvar LaTeX-minted-auto-newmintedfile nil) +(defvar LaTeX-minted-newmintedfile-regexp + '("\\\\newmintedfile\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}" + (1 2) LaTeX-minted-auto-newmintedfile)) + +(defun LaTeX-minted-auto-prepare () + (setq LaTeX-minted-auto-newminted nil + LaTeX-minted-auto-newmint nil + LaTeX-minted-auto-newmintinline nil + LaTeX-minted-auto-newmintedfile nil)) + +(defun LaTeX-minted-auto-cleanup () + ;; \newminted{lang}{opts} => new langcode and langcode* envs. + ;; \newminted[envname]{lang}{opts} => new envname/envname* envs. + (dolist (name-lang LaTeX-minted-auto-newminted) + (let* ((env (if (> (length (car name-lang)) 0) + (car name-lang) + (concat (cadr name-lang) "code"))) + (env* (concat env "*"))) + (add-to-list 'LaTeX-auto-environment (list env)) + (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-verbatim-environments-local env) + (add-to-list 'LaTeX-verbatim-environments-local env*))) + ;; \newmint{foo}{opts} => \foo|code| + ;; \newmint[macname]{foo}{opts} => \macname|code| + (dolist (name-lang LaTeX-minted-auto-newmint) + (let ((lang (if (> (length (car name-lang)) 0) + (car name-lang) + (cadr name-lang)))) + (add-to-list 'TeX-auto-symbol lang) + (add-to-list 'LaTeX-verbatim-macros-with-delims-local lang))) + ;; \newmintinline{foo}{opts} => \fooinline|code| + ;; \newmintinline[macname]{foo}{opts} => \macname|code| + (dolist (name-lang LaTeX-minted-auto-newmintinline) + (let ((lang (if (> (length (car name-lang)) 0) + (car name-lang) + (cadr name-lang)))) + (add-to-list 'TeX-auto-symbol lang) + (add-to-list 'LaTeX-verbatim-macros-with-delims-local (concat lang "inline")))) + ;; \newmintedfile{foo}{opts} => \foofile{file-name} + ;; \newmintedfile[macname]{foo}{opts} => \macname{file-name} + (dolist (name-lang LaTeX-minted-auto-newmintedfile) + (let ((lang (if (> (length (car name-lang)) 0) + (car name-lang) + (cadr name-lang)))) + (add-to-list 'TeX-auto-symbol (list lang 'TeX-arg-file)))) + (when (and (fboundp 'font-latex-add-keywords) + (fboundp 'font-latex-set-syntactic-keywords) + (eq TeX-install-font-lock 'font-latex-setup)) + ;; Refresh font-locking so that the verbatim envs take effect. + (font-latex-set-syntactic-keywords) + (setq font-lock-set-defaults nil) + (font-lock-set-defaults))) + +(add-hook 'TeX-auto-prepare-hook #'LaTeX-minted-auto-prepare t) +(add-hook 'TeX-auto-cleanup-hook #'LaTeX-minted-auto-cleanup t) + +(TeX-add-style-hook + "minted" + (lambda () + ;; New symbols + (TeX-add-symbols + '("mint" LaTeX-arg-minted-language TeX-arg-verb) + '("mintinline" LaTeX-arg-minted-language TeX-arg-verb) + '("listoflistings") + '("newminted" ["Environment Name"] LaTeX-arg-minted-language + (TeX-arg-key-val LaTeX-minted-key-val-options)) + '("newmint" ["Macro Name"] LaTeX-arg-minted-language + (TeX-arg-key-val LaTeX-minted-key-val-options)) + '("newmintinline" ["Macro Name"] LaTeX-arg-minted-language + (TeX-arg-key-val LaTeX-minted-key-val-options)) + '("newmintedfile" ["Macro Name"] LaTeX-arg-minted-language + (TeX-arg-key-val LaTeX-minted-key-val-options))) + + ;; New environments + (LaTeX-add-environments + '("minted" LaTeX-env-args [TeX-arg-key-val LaTeX-minted-key-val-options] + LaTeX-arg-minted-language) + '("listing" ["Float Position"])) + + ;; Add to the auto parser + (TeX-auto-add-regexp LaTeX-minted-newminted-regexp) + (TeX-auto-add-regexp LaTeX-minted-newmint-regexp) + (TeX-auto-add-regexp LaTeX-minted-newmintinline-regexp) + (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 'LaTeX-verbatim-environments-local "minted") + ;; FIXME: That doesn't work because \mintinline has 2 args and only the + ;; second argument is verbatim. + ;;(add-to-list 'LaTeX-verbatim-macros-with-delims-local "mintinline") + + ;; Fontification + (when (and (fboundp 'font-latex-add-keywords) + (fboundp 'font-latex-set-syntactic-keywords) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(;; FIXME: Those have the form \mint{lang}|code| + ;; so ideally the verbatim arg should be + ;; recognized. + "mint" "mintinline") + 'function) + ;; For syntactic fontification, e.g. verbatim constructs. + (font-latex-set-syntactic-keywords) + ;; Tell font-lock about the update. + (setq font-lock-set-defaults nil) + (font-lock-set-defaults))) + LaTeX-dialect) + +(defvar LaTeX-minted-package-options '("section" "chapter" "cache" + "outputdir" "cachedir" + "langlinenos") + "Package options for the minted package.") + +;;; minted.el ends here diff --git a/style/multirow.el b/style/multirow.el index 6d00d5ee..d025e1f0 100644 --- a/style/multirow.el +++ b/style/multirow.el @@ -37,7 +37,7 @@ [ "Big struts" ] "Width" [ "Fixup" ] t) "multirowsetup") - (if (not (boundp 'LaTeX-bigstruct-package-options)) + (if (not (boundp 'LaTeX-bigstrut-package-options)) (TeX-add-symbols "bigstrutjot")) ;; Fontification diff --git a/style/natbib.el b/style/natbib.el index 13cf2292..a224c5b3 100644 --- a/style/natbib.el +++ b/style/natbib.el @@ -108,7 +108,7 @@ (reftex-set-cite-format 'natbib)))) LaTeX-dialect) -(defun natbib-note-args (optional &optional prompt definition) +(defun natbib-note-args (optional &optional _prompt _definition) "Prompt for two note arguments a natbib citation command." (if TeX-arg-cite-note-p (let* ((pre (TeX-read-string diff --git a/style/newtxmath.el b/style/newtxmath.el new file mode 100644 index 00000000..b0145ca4 --- /dev/null +++ b/style/newtxmath.el @@ -0,0 +1,84 @@ +;;; newtxmath.el --- AUCTeX style for `newtxmath.sty' (v1.321) + +;; Copyright (C) 2014 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-11-22 +;; 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 `newtxmath.sty' (v1.321) from 2014/11/16. +;; `newtxmath.sty' is part of TeXLive. + +;;; Code: + +(TeX-add-style-hook + "newtxmath" + (lambda () + + ;; Run style hook for amsmath + (TeX-run-style-hooks "amsmath") + + ;; New symbols + (TeX-add-symbols + '("overgroup" t) + '("undergroup" t) + '("overgroupra" t) + '("overgroupla" t) + '("undergroupra" t) + '("undergroupla" t) + '("widering" t) + '("widearc" t) + '("wideOarc" t) + '("varnothing" 0) + '("emtysetAlt" 0) + '("forallAlt" 0) + '("existsAlt" 0) + '("nexistsAlt" 0) + '("vvmathbb" "Character"))) + LaTeX-dialect) + +(defvar LaTeX-newtxmath-package-options + '("varg" + "cmintegrals" + "uprightGreek" + "slantedGreek" + "cmbraces" + "bigdelims" + "varbb" + "vvarbb" + "nosymbolsc" + "amssymbols" + "noamssymbols" + "libaltvw" + "liby" + "timesmathacc" + "libertine" + "minion" + "garamondx" + "baskervaldx" + "utopia" "heuristica" + "erewhon" + "xcharter") + "Package options for the newtxmath package.") + +;;; newtxmath.el ends here diff --git a/style/bigstrut.el b/style/newtxsf.el similarity index 57% copy from style/bigstrut.el copy to style/newtxsf.el index 14269db8..979a1554 100644 --- a/style/bigstrut.el +++ b/style/newtxsf.el @@ -1,9 +1,10 @@ -;;; bigstrut.el --- AUCTeX style for `bigstrut.sty' +;;; newtxsf.el --- AUCTeX style for `newtxsf.sty' (v1.0) -;; Copyright (C) 2012 Free Software Foundation, Inc. +;; Copyright (C) 2014 Free Software Foundation, Inc. -;; Author: Mads Jensen <m...@inducks.org> +;; Author: Arash Esbati <esbati'at'gmx.de> ;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-11-22 ;; Keywords: tex ;; This file is part of AUCTeX. @@ -25,26 +26,32 @@ ;;; Commentary: -;; This file adds support for `bigstrut.sty'. +;; This file adds support for `newtxsf.sty' (v1.0) from 2014/11/14. +;; `newtxsf.sty' is part of TeXLive. ;;; Code: (TeX-add-style-hook - "bigstrut" + "newtxsf" (lambda () + ;; Run style hook for amsmath + (TeX-run-style-hooks "amsmath") + + ;; New symbols (TeX-add-symbols - "bigstrutsetup" - '("bigstrut" [ TeX-arg-bigstrut ]))) + '("upimath" 0) + '("upjmath" 0))) LaTeX-dialect) -(defun TeX-arg-bigstrut (optional &optional prompt) - "Prompt for the optional argument in \\bigstrut" - (TeX-argument-insert - (completing-read (TeX-argument-prompt - optional "Strut to top (t) or bottom (b)" nil t) - (mapcar 'list '("t" "b")) nil t) optional)) - -(defvar LaTeX-bigstrut-package-options nil - "Package options for the bigstrut package.") - -;;; bigstrut.el ends here +(defvar LaTeX-newtxsf-package-options + '("scaled" + "nosymbolsc" + "cmintegrals" + "amssymbols" + "noamssymbols" + "uprightGreek" + "slantedGreek" + "frenchmath") + "Package options for the newtxsf package.") + +;;; newtxsf.el ends here diff --git a/style/bigstrut.el b/style/newtxtext.el similarity index 57% copy from style/bigstrut.el copy to style/newtxtext.el index 14269db8..801c3f07 100644 --- a/style/bigstrut.el +++ b/style/newtxtext.el @@ -1,9 +1,10 @@ -;;; bigstrut.el --- AUCTeX style for `bigstrut.sty' +;;; newtxtext.el --- AUCTeX style for `newtxtext.sty' (v1.321) -;; Copyright (C) 2012 Free Software Foundation, Inc. +;; Copyright (C) 2014 Free Software Foundation, Inc. -;; Author: Mads Jensen <m...@inducks.org> +;; Author: Arash Esbati <esbati'at'gmx.de> ;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-11-19 ;; Keywords: tex ;; This file is part of AUCTeX. @@ -25,26 +26,25 @@ ;;; Commentary: -;; This file adds support for `bigstrut.sty'. +;; This file adds support for `newtxtext.sty' (v1.321) from 2014/11/16. +;; `newtxtext.sty' is part of TeXLive. ;;; Code: (TeX-add-style-hook - "bigstrut" + "newtxtext" (lambda () + + ;; Run style hook for various packages loaded by newtxtext + (TeX-run-style-hooks "textcomp" "fontaxes") + + ;; New symbols (TeX-add-symbols - "bigstrutsetup" - '("bigstrut" [ TeX-arg-bigstrut ]))) + '("useosf" 0))) ; Only preamble command LaTeX-dialect) -(defun TeX-arg-bigstrut (optional &optional prompt) - "Prompt for the optional argument in \\bigstrut" - (TeX-argument-insert - (completing-read (TeX-argument-prompt - optional "Strut to top (t) or bottom (b)" nil t) - (mapcar 'list '("t" "b")) nil t) optional)) - -(defvar LaTeX-bigstrut-package-options nil - "Package options for the bigstrut package.") +(defvar LaTeX-newtxtext-package-options + '("defaultsups" "helvratio" "osf" "scaled" "scosf") + "Package options for the newtxtext package.") -;;; bigstrut.el ends here +;;; newtxtext.el ends here diff --git a/style/multirow.el b/style/newtxttt.el similarity index 54% copy from style/multirow.el copy to style/newtxttt.el index 6d00d5ee..74f852a4 100644 --- a/style/multirow.el +++ b/style/newtxttt.el @@ -1,9 +1,10 @@ -;;; multirow.el --- AUCTeX style for `multirow.sty' +;;; newtxtt.el --- AUCTeX style for `newtxtt.sty' (v1.05) -;; Copyright (C) 2011 Free Software Foundation, Inc. +;; Copyright (C) 2014 Free Software Foundation, Inc. -;; Author: Mads Jensen <m...@inducks.org> +;; Author: Arash Esbati <esbati'at'gmx.de> ;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-11-22 ;; Keywords: tex ;; This file is part of AUCTeX. @@ -25,28 +26,37 @@ ;;; Commentary: -;; This file adds support for `multirow.sty'. +;; This file adds support for `newtxtt.sty' (v1.05) from 2014/11/18. +;; `newtxtt.sty' is part of TeXLive. ;;; Code: (TeX-add-style-hook - "multirow" + "newtxtt" (lambda () - (TeX-add-symbols - '("multirow" "Number of rows" - [ "Big struts" ] "Width" [ "Fixup" ] t) - "multirowsetup") - (if (not (boundp 'LaTeX-bigstruct-package-options)) - (TeX-add-symbols "bigstrutjot")) + ;; Run style hook for newtxtt + (TeX-run-style-hooks "textcomp") + + ;; New symbols + (TeX-add-symbols + '("textttz" t) + '("ttz" -1) + '("ttzdefault" -1)) ;; Fontification (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("multirow" "{[{")) 'function))) + (font-latex-add-keywords '(("textttz" "{")) + 'type-command) + (font-latex-add-keywords '(("ttzfamily" "") + ("ttz" "")) + 'type-declaration))) LaTeX-dialect) -(defvar LaTeX-multirow-package-options nil - "Package options for the multirow package.") +(defvar LaTeX-newtxtt-package-options + '("scaled" "zerostyle" "nomono" "straightquotes" + "ttdefault" "ttzdefault") + "Package options for the newtxtt package.") -;;; multirow.el ends here +;;; newtxtt.el ends here diff --git a/style/pdfsync.el b/style/pdfsync.el index 39345f40..d2076fd4 100644 --- a/style/pdfsync.el +++ b/style/pdfsync.el @@ -1,6 +1,6 @@ ;;; pdfsync.el --- AUCTeX style for `pdfsync.sty' -;; Copyright (C) 2005, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2005, 2008, 2014 Free Software Foundation, Inc. ;; Author: Ralf Angeli <ang...@iwi.uni-sb.de> ;; Maintainer: auctex-devel@gnu.org @@ -40,7 +40,6 @@ (pdfsync-file (concat master ".pdfsync")) (buf-live-p (get-file-buffer pdfsync-file)) (sync-record "0") - (sync-line "-1") (sync-page "1") last-match) (when (file-exists-p pdfsync-file) @@ -65,7 +64,6 @@ (throw 'break nil)) (t (setq sync-record (match-string 1) - sync-line (match-string 2) last-match (match-beginning 0)))))) ;; Look for the page number. (goto-char (or last-match (point-min))) diff --git a/style/prosper.el b/style/prosper.el index 8974cecc..5e0c6d8f 100644 --- a/style/prosper.el +++ b/style/prosper.el @@ -52,12 +52,12 @@ ;; Constants: -;;;; This is partly working now, and it a little neater than it -;;;; was. The main problem is that the redefinition of "documentclass" -;;;; does not happen until its all too late, so that stuff never -;;;; happens correctly. This is easy enough to fix by fiddling with -;;;; auctex. I shall have to download the latest version, and see if -;;;; its already been fixed. +;; This is partly working now, and it a little neater than it +;; was. The main problem is that the redefinition of "documentclass" +;; does not happen until its all too late, so that stuff never +;; happens correctly. This is easy enough to fix by fiddling with +;; auctex. I shall have to download the latest version, and see if +;; its already been fixed. @@ -80,7 +80,7 @@ "alcatel" "gyom" "pascal" "rico" )) -(defun LaTeX-prosper-insert-title (optional) +(defun LaTeX-prosper-insert-title (_optional) (newline) (mapc (lambda(f) (TeX-insert-macro f) @@ -92,7 +92,7 @@ ;; Utility functions -(defun LaTeX-prosper-arg-pdftransition (environment) +(defun LaTeX-prosper-arg-pdftransition (_environment) (let ((default (if (boundp 'LaTeX-prosper-transition-history) (car LaTeX-prosper-transition-history) @@ -117,7 +117,7 @@ nil nil nil nil "default" )) -(defun LaTeX-prosper-insert-options(environment) +(defun LaTeX-prosper-insert-options(_environment) (insert "[" ) (insert (LaTeX-prosper-slide-style-prompt) " ") (mapc (lambda(f) @@ -131,7 +131,7 @@ (delete-char -1) (insert "]")) -(defun LaTeX-prosper-insert-slide (environment) +(defun LaTeX-prosper-insert-slide (_environment) (if (y-or-n-p "Surround with overlay ?") (progn (TeX-insert-macro "overlays") (if (search-backward "{" 0 t) diff --git a/style/psfig.el b/style/psfig.el index 637065ab..3d44a650 100644 --- a/style/psfig.el +++ b/style/psfig.el @@ -25,7 +25,7 @@ )) LaTeX-dialect) -(defun TeX-arg-psfig (optional) +(defun TeX-arg-psfig (_optional) "Ask for file, width and length. Insert psfig macro" (let ((psfile (read-file-name "PS-file: " "" "" nil)) (figwidth (TeX-read-string "Figure width: ")) @@ -42,7 +42,7 @@ ) -(defun LaTeX-env-psfigure (environment) +(defun LaTeX-env-psfigure (_environment) "Create with \\label and \\caption and \\psfig commands." (let ((float (TeX-read-string "Float to: " LaTeX-float)) (caption (TeX-read-string "Caption: ")) diff --git a/style/pst-node.el b/style/pst-node.el index 5da0553b..cc6b151b 100644 --- a/style/pst-node.el +++ b/style/pst-node.el @@ -1,6 +1,6 @@ ;;; pst-node.el --- AUCTeX style for `pst-node.sty' -;; Copyright (C) 2007, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2007, 2013, 2014 Free Software Foundation, Inc. ;; Author: Holger Sparr <holger.sp...@gmx.net> ;; Created: 21 Jun 2007 @@ -87,34 +87,35 @@ (LaTeX-package-parameters optional "pstnode" preparam param)) ;;; Macros -(defun LaTeX-pstnode-macro-nput (optional &optional arg) +(defun LaTeX-pstnode-macro-nput (_optional &optional _arg) "Return \\nput arguments after querying." (insert "[rot=" (LaTeX-pst-angle) "]{" (LaTeX-pst-angle) "}{" (LaTeX-pst-node) "}")) -(defun LaTeX-pstnode-macro-cnodeput (optional &optional arg) +(defun LaTeX-pstnode-macro-cnodeput (_optional &optional _arg) "Return \\cnodeput arguments after querying." (let ((rotation (if current-prefix-arg (LaTeX-pst-angle) nil)) (pnt (if current-prefix-arg (LaTeX-pst-point) nil))) (insert (if rotation (format "{%s}" rotation) "") (if pnt (format "(%s)" pnt) "") "{" (LaTeX-pst-node) "}"))) -(defun LaTeX-pstnode-macro-nc (optional &optional arg) +(defun LaTeX-pstnode-macro-nc (_optional &optional _arg) "Return \\nc* arguments after querying." (let ((arrows (LaTeX-pst-arrows))) (insert (if arrows (format "{%s}" arrows) "") "{" (LaTeX-pst-node) "}{" (LaTeX-pst-node) "}"))) -(defun LaTeX-pstnode-macro-pc (optional &optional arg) +(defun LaTeX-pstnode-macro-pc (_optional &optional _arg) "Return \\pc* arguments after querying." (let ((arrows (LaTeX-pst-arrows))) (insert (if arrows (format "{%s}" arrows) "") "(" (LaTeX-pst-point) ")(" (LaTeX-pst-point) ")"))) -(defun LaTeX-pstnode-macro-tnabcput (optional &optional arg) +(defun LaTeX-pstnode-macro-tnabcput (optional &optional _arg) "Return \\t?put or \\n?put arguments after querying." (TeX-argument-insert (LaTeX-pstnode-parameters-pref-and-chosen - '("nrot" "npos")) optional)) + '("nrot" "npos")) + optional)) ;;; Environments (defun LaTeX-pstnode-env-psmatrix (env) diff --git a/style/pst-plot.el b/style/pst-plot.el index 74a29464..5cb3404a 100644 --- a/style/pst-plot.el +++ b/style/pst-plot.el @@ -1,6 +1,6 @@ ;;; pst-plot.el --- AUCTeX style for `pst-plot.sty' -;; Copyright (C) 2007 Free Software Foundation, Inc. +;; Copyright (C) 2007, 2014 Free Software Foundation, Inc. ;; Author: Holger Sparr <holger.sp...@gmx.net> ;; Created: 21 Jun 2007 @@ -85,17 +85,17 @@ "A list of values for axesstyles in pst-plot.") ;;; Macros -(defun LaTeX-pst-macro-psaxes (optional &optional arg) +(defun LaTeX-pst-macro-psaxes (_optional &optional _arg) "Return \\psaxes arguments after querying." -(let* ((cpref (if current-prefix-arg (car current-prefix-arg) 0)) - (arrows (LaTeX-pst-arrows)) - (pnt1 (if (> cpref 4) (LaTeX-pst-point) nil)) - (pnt2 (if (> cpref 0) (LaTeX-pst-point) nil)) - (pnt3 (LaTeX-pst-point))) - ;; insert \psaxes arguments - (insert (if arrows (format "{%s}" arrows) "") - (if pnt1 (format "(%s)" pnt1) "") - (if pnt2 (format "(%s)" pnt2) "") "(" pnt3 ")"))) + (let* ((cpref (if current-prefix-arg (car current-prefix-arg) 0)) + (arrows (LaTeX-pst-arrows)) + (pnt1 (if (> cpref 4) (LaTeX-pst-point) nil)) + (pnt2 (if (> cpref 0) (LaTeX-pst-point) nil)) + (pnt3 (LaTeX-pst-point))) + ;; Insert \psaxes arguments. + (insert (if arrows (format "{%s}" arrows) "") + (if pnt1 (format "(%s)" pnt1) "") + (if pnt2 (format "(%s)" pnt2) "") "(" pnt3 ")"))) ;;; Derived defuns (defun LaTeX-pstplot-datasets-read () @@ -106,7 +106,7 @@ "pst-plot" (function (lambda () - (mapcar 'TeX-auto-add-regexp LaTeX-auto-pstplot-regexp-list) + (mapc #'TeX-auto-add-regexp LaTeX-auto-pstplot-regexp-list) (TeX-add-symbols '("readdata" "Macro Name" TeX-arg-file) '("savedata" "Macro Name" ["Values"]) diff --git a/style/pstricks.el b/style/pstricks.el index d5adbdae..f6b3d921 100644 --- a/style/pstricks.el +++ b/style/pstricks.el @@ -226,7 +226,7 @@ package PNAME" (concat "Point (default " (car LaTeX-pst-point-history) ")") (car LaTeX-pst-point-history))) -(defun LaTeX-pst-point-in-parens (optional) +(defun LaTeX-pst-point-in-parens (_optional) "Enclose point in parentheses." (LaTeX-pst-enclose-obj 'LaTeX-pst-point ?( ?))) @@ -517,7 +517,7 @@ package PNAME" (TeX-arg-key-val optional LaTeX-pst-basic-parameters-list)) ;;; Macros -(defun LaTeX-pst-macro-psarc (optional &optional arg) +(defun LaTeX-pst-macro-psarc (_optional &optional _arg) "Return \\psarc arguments after querying." (let ((arrows (LaTeX-pst-arrows)) (pnt (if current-prefix-arg nil (LaTeX-pst-point)))) @@ -526,11 +526,11 @@ package PNAME" "{" (LaTeX-pst-extdir "Radius") "}{" (LaTeX-pst-angle) "}{" (LaTeX-pst-angle) "}"))) -(defun LaTeX-pst-macro-pscircle (optional &optional arg) +(defun LaTeX-pst-macro-pscircle (_optional &optional _arg) "Return \\pscircle arguments after querying." (insert "(" (LaTeX-pst-point) "){" (LaTeX-pst-extdir "Radius") "}")) -(defun LaTeX-pst-macro-rput (optional &optional arg) +(defun LaTeX-pst-macro-rput (_optional &optional _arg) "Return \\rput arguments after querying." (let ((refpoint (LaTeX-pst-refpoint)) (rotation (if current-prefix-arg (LaTeX-pst-angle) nil))) @@ -539,7 +539,7 @@ package PNAME" (concat "{" rotation "}") "") "(" (LaTeX-pst-point) ")"))) -(defun LaTeX-pst-macro-uput (optional &optional arg) +(defun LaTeX-pst-macro-uput (_optional &optional _arg) "Return \\uput arguments after querying." (let ((dist (LaTeX-pst-extdir "Distance")) (refpoint (LaTeX-pst-refpoint))) @@ -549,7 +549,7 @@ package PNAME" "[]") "{" (LaTeX-pst-angle) "}(" (LaTeX-pst-point) ")"))) -(defun LaTeX-pst-macro-multirputps (optional &optional arg) +(defun LaTeX-pst-macro-multirputps (_optional &optional _arg) "Return \\multirput or \\multips arguments after querying." (let ((refpoint (LaTeX-pst-refpoint)) (rotation (if current-prefix-arg (LaTeX-pst-angle) nil)) @@ -560,7 +560,7 @@ package PNAME" (if rotation (format "{%s}" rotation) "") "(" pnt ")(" dpnt "){" repi "}"))) -(defun LaTeX-pst-macro-psline (optional &optional arg) +(defun LaTeX-pst-macro-psline (_optional &optional _arg) "Return \\psline or \\ps[ce]?curve[*] arguments after querying." (let ((arrows (LaTeX-pst-arrows)) (pnt1 (LaTeX-pst-point)) @@ -571,7 +571,7 @@ package PNAME" (setq pnt1 pnt2) (setq pnt2 (LaTeX-pst-point))))) -(defun LaTeX-pst-macro-psdots (optional single) +(defun LaTeX-pst-macro-psdots (_optional single) "Return \\psdot[s]? arguments after querying." (let* ((pnt1 (LaTeX-pst-point)) (pnt2 (if single pnt1 (LaTeX-pst-point)))) @@ -581,13 +581,13 @@ package PNAME" (insert "(" pnt1 ")") (setq pnt2 (LaTeX-pst-point))))) -(defun LaTeX-pst-macro-parabola (optional &optional arg) +(defun LaTeX-pst-macro-parabola (_optional &optional _arg) "Return \\parabola arguments after querying." (let ((arrows (LaTeX-pst-arrows))) (insert (if arrows (format "{%s}" arrows) "") "(" (LaTeX-pst-point) ")(" (LaTeX-pst-point) ")"))) -(defun LaTeX-pst-macro-pnt-twolen (optional prompt1 prompt2) +(defun LaTeX-pst-macro-pnt-twolen (_optional prompt1 prompt2) "Return point and 2 paired lengths in separate parens as arguments." ;; insert \psellipse[*]?, \psdiamond or \pstriangle arguments (let ((pnt (if current-prefix-arg nil (LaTeX-pst-point)))) @@ -595,7 +595,7 @@ package PNAME" "(" (LaTeX-pst-extdir prompt1) "," (LaTeX-pst-extdir prompt2) ")"))) -(defun LaTeX-pst-macro-psbezier (optional &optional arg) +(defun LaTeX-pst-macro-psbezier (_optional &optional _arg) "Return \\psbezier arguments after querying." (let ((arrows (LaTeX-pst-arrows)) (pnt1 (LaTeX-pst-point)) @@ -608,7 +608,7 @@ package PNAME" (setq pnt2 pnt3) (setq pnt3 (LaTeX-pst-point))))) -(defun LaTeX-pst-macro-pspolygon (optional &optional arg) +(defun LaTeX-pst-macro-pspolygon (_optional &optional _arg) "Return \\pspolygon arguments after querying." (let ((pnt1 (LaTeX-pst-point)) (pnt2 (LaTeX-pst-point)) @@ -619,13 +619,13 @@ package PNAME" (setq pnt2 pnt3) (setq pnt3 (LaTeX-pst-point))))) -(defun LaTeX-pst-macro-psframe (optional &optional arg) +(defun LaTeX-pst-macro-psframe (_optional &optional _arg) "Return \\psframe arguments after querying." (let ((pnt1 (if current-prefix-arg nil (LaTeX-pst-point))) (pnt2 (LaTeX-pst-point))) (insert (if pnt1 (format "(%s)" pnt1) "") "(" pnt2 ")"))) -(defun LaTeX-pst-macro-psgrid (optional &optional arg) +(defun LaTeX-pst-macro-psgrid (_optional &optional _arg) "Return \\psgrid arguments after querying." (let* ((cpref (if current-prefix-arg (car current-prefix-arg) 0)) (pnt1 (if (> cpref 4) (LaTeX-pst-point) nil)) @@ -634,7 +634,7 @@ package PNAME" (insert (if pnt1 (format "(%s)" pnt1) "") (if pnt2 (format "(%s)(%s)" pnt2 pnt3) "")))) -(defun LaTeX-pst-macro-newpsobject (&optional arg) +(defun LaTeX-pst-macro-newpsobject (&optional _arg) "Return \\newpsobject arguments after querying." (insert "{" (TeX-read-string "New PSObject Name: ") "}" ;; FIXME: It would be better to use something more confined @@ -712,7 +712,7 @@ parameter\(s\) to the already existing ones at the end of the comma separated list. Point has to be within the sexp to modify." (interactive "P") (let ((newpara (LaTeX-pst-parameters-pref-and-chosen nil t)) - (regexp "\\(") beg end check) + (regexp "\\(") end check) (if arg (progn (re-search-backward "\\\\\\([a-zA-Z]\\)") diff --git a/style/relsize.el b/style/relsize.el new file mode 100644 index 00000000..20dc9755 --- /dev/null +++ b/style/relsize.el @@ -0,0 +1,69 @@ +;;; relsize.el --- AUCTeX style for `relsize.sty' version v4.1 + +;; Copyright (C) 2014 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-12-14 +;; 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 `relsize.sty' version v4.1 from +;; 2013/03/29. `relsize.sty' is part of TeXLive. + +;;; Code: + +(TeX-add-style-hook + "relsize" + (lambda () + (TeX-add-symbols + ;; Declarations and commands + '("relsize" "Steps" ) + '("relscale" "Scale factor" ) + '("larger" [ "Steps (default: 1)" ] -1) + '("smaller" [ "Steps (default: 1)" ] -1) + '("textlarger" [ "Steps" ] t) + '("textsmaller" [ "Steps" ] t) + '("textscale" "Scale factor" t) + '("mathlarger" t) + '("mathsmaller" t)) + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + ;; This is not easy, are the first 2 'variable oder rather + ;; 'type-declaration? I start with 'type-declaration, let the + ;; users decide + (font-latex-add-keywords '(("relsize" "") + ("relscale" "") + ("larger" "") + ("smaller" "")) + 'type-declaration) + (font-latex-add-keywords '(("textlarger" "[{") + ("textsmaller" "[{") + ("textscale" "{{")) + 'type-command))) + LaTeX-dialect) + +(defvar LaTeX-relsize-package-options nil + "Package options for the relsize package.") + +;;; relsize.el ends here diff --git a/style/shortvrb.el b/style/shortvrb.el index 0bc3ffbe..49143f3f 100644 --- a/style/shortvrb.el +++ b/style/shortvrb.el @@ -1,6 +1,6 @@ ;;; shortvrb.el --- AUCTeX style for `shortvrb.sty' -;; Copyright (C) 2009 Free Software Foundation, Inc. +;; Copyright (C) 2009, 2014 Free Software Foundation, Inc. ;; Author: Ralf Angeli <ang...@caeruleus.net> ;; Maintainer: auctex-devel@gnu.org @@ -71,10 +71,9 @@ your document actually defines shortvrb chars using (when (and LaTeX-shortvrb-chars (fboundp 'font-latex-set-syntactic-keywords) (eq TeX-install-font-lock 'font-latex-setup)) - (let (syntax-alist) - (dolist (char LaTeX-shortvrb-chars) - (add-to-list 'syntax-alist (cons char "|"))) - (font-latex-add-to-syntax-alist syntax-alist)))) + (font-latex-add-to-syntax-alist + (mapcar (lambda (char) (cons char "|")) + LaTeX-shortvrb-chars)))) LaTeX-dialect) ;; Don't look for file-local variables before this line, so that the example in diff --git a/style/wrapfig.el b/style/wrapfig.el new file mode 100644 index 00000000..bcb90c20 --- /dev/null +++ b/style/wrapfig.el @@ -0,0 +1,107 @@ +;;; wrapfig.el --- AUCTeX style for `wrapfig.sty' version v3.6 + +;; Copyright (C) 2014 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2014-12-13 +;; 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 `wrapfig.sty' version v3.6 from +;; 2003/01/31. `wrapfig.sty' is part of TeXLive. + +;;; Code: + +(TeX-add-style-hook + "wrapfig" + (lambda () + (LaTeX-add-environments + ;; \begin{wrapfigure}[No.lines]{Placement}[Overhang]{Width} ... \end{wrapfigure} + '("wrapfigure" + (lambda (env &rest ignore) + (LaTeX-insert-environment + env + (let ((narrow (read-string "(Optional) Number of narrow lines: ")) + (placement (completing-read + "Placement: " '(("r") ("R") + ("l") ("L") + ("i") ("I") + ("o") ("O")))) + (overhang (read-string "(Optional) Overhang: ")) + (width (read-string "Width: "))) + (concat + (unless (string= narrow "") + (format "[%s]" narrow)) + (format "{%s}" placement) + (unless (string= overhang "") + (format "[%s]" overhang)) + (format "{%s}" width)))))) + ;; + ;; \begin{wraptable}[No.lines]{Placement}[Overhang]{Width} ... \end{wraptable} + '("wraptable" + (lambda (env &rest ignore) + (LaTeX-insert-environment + env + (let ((narrow (read-string "(Optional) Number of narrow lines: ")) + (placement (completing-read + "Placement: " '(("r") ("R") + ("l") ("L") + ("i") ("I") + ("o") ("O")))) + (overhang (read-string "(Optional) Overhang: ")) + (width (read-string "Width: "))) + (concat + (unless (string= narrow "") + (format "[%s]" narrow)) + (format "{%s}" placement) + (unless (string= overhang "") + (format "[%s]" overhang)) + (format "{%s}" width)))))) + ;; + ;; \begin{wrapfloat}{<Type>}[No.lines]{Placement}[Overhang]{Width} ... \end{wrapfloat} + '("wrapfloat" + (lambda (env &rest ignore) + (LaTeX-insert-environment + env + (let ((floattype (read-string "Float type: ")) + (narrow (read-string "(Optional) Number of narrow lines: ")) + (placement (completing-read + "Placement: " '(("r") ("R") + ("l") ("L") + ("i") ("I") + ("o") ("O")))) + (overhang (read-string "(Optional) Overhang: ")) + (width (read-string "Width: "))) + (concat + (format "{%s}" floattype) + (unless (string= narrow "") + (format "[%s]" narrow)) + (format "{%s}" placement) + (unless (string= overhang "") + (format "[%s]" overhang)) + (format "{%s}" width)))))))) + LaTeX-dialect) + +(defvar LaTeX-wrapfig-package-options '("verbose") + "Package options for the wrapfig package.") + +;;; wrapfig.el ends here diff --git a/tex.el b/tex.el index a81b7d0f..a17b8b40 100644 --- a/tex.el +++ b/tex.el @@ -1104,10 +1104,9 @@ of point in emacs by using Evince's DBUS API. Used by default for the Evince viewer entry in `TeX-view-program-list-builtin' if the requirements are met." (require 'url-util) - (let* ((uri (concat "file://" (let ((url-unreserved-chars (cons ?/ url-unreserved-chars))) - (url-hexify-string - (expand-file-name - (concat file "." (TeX-output-extension))))))) + (let* ((uri (concat "file://" (url-encode-url + (expand-file-name + (concat file "." (TeX-output-extension)))))) (owner (dbus-call-method :session "org.gnome.evince.Daemon" "/org/gnome/evince/Daemon" @@ -1133,8 +1132,8 @@ the requirements are met." (cond ((eq system-type 'windows-nt) '(("Yap" ("yap -1" (mode-io-correlate " -s %n%b") " %o") "yap") - ("dvips and start" "dvips %d -o && start \"\" %f" ,(list "dvips" "start")) - ("start" "start \"\" %o" "start"))) + ("dvips and start" "dvips %d -o && start \"\" %f" "dvips") + ("start" "start \"\" %o"))) ((eq system-type 'darwin) '(("Preview.app" "open -a Preview.app %o" "open") ("Skim" "open -a Skim.app %o" "open") @@ -3032,42 +3031,51 @@ type of ARGS: parse it as a list, otherwise parse the only element as above. Use square brackets instead of curly braces, and is not inserted on empty user input." - - (if (and (TeX-active-mark) - (> (point) (mark))) - (exchange-point-and-mark)) - (insert TeX-esc symbol) - (let ((exit-mark (make-marker)) - (position (point))) - (TeX-parse-arguments args) - (cond ((marker-position exit-mark) - (goto-char (marker-position exit-mark)) - (set-marker exit-mark nil)) - ((let ((element (assoc symbol TeX-insert-braces-alist))) - ;; If in `TeX-insert-braces-alist' there is an element associated - ;; to the current macro, use its value to decide whether inserting - ;; a pair of braces, otherwise use the standard criterion. - (if element - (cdr element) - (and TeX-insert-braces - ;; Do not add braces if the argument is 0 or -1. - (not (and (= (safe-length args) 1) - (numberp (car args)) - (<= (car args) 0))) - (equal position (point)) - (string-match "[a-zA-Z]+" symbol)))) - (if (texmathp) - (when (TeX-active-mark) - (insert TeX-grop) - (exchange-point-and-mark) - (insert TeX-grcl)) - (insert TeX-grop) - (if (TeX-active-mark) - (progn + (let ((TeX-grop (if (and (or (atom args) (= (length args) 1)) + (fboundp 'LaTeX-verbatim-macros-with-delims) + (member symbol (LaTeX-verbatim-macros-with-delims))) + LaTeX-default-verb-delimiter + TeX-grop)) + (TeX-grcl (if (and (or (atom args) (= (length args) 1)) + (fboundp 'LaTeX-verbatim-macros-with-delims) + (member symbol (LaTeX-verbatim-macros-with-delims))) + LaTeX-default-verb-delimiter + TeX-grcl))) + (if (and (TeX-active-mark) + (> (point) (mark))) + (exchange-point-and-mark)) + (insert TeX-esc symbol) + (let ((exit-mark (make-marker)) + (position (point))) + (TeX-parse-arguments args) + (cond ((marker-position exit-mark) + (goto-char (marker-position exit-mark)) + (set-marker exit-mark nil)) + ((let ((element (assoc symbol TeX-insert-braces-alist))) + ;; If in `TeX-insert-braces-alist' there is an element associated + ;; to the current macro, use its value to decide whether inserting + ;; a pair of braces, otherwise use the standard criterion. + (if element + (cdr element) + (and TeX-insert-braces + ;; Do not add braces if the argument is 0 or -1. + (not (and (= (safe-length args) 1) + (numberp (car args)) + (<= (car args) 0))) + (equal position (point)) + (string-match "[a-zA-Z]+" symbol)))) + (if (texmathp) + (when (TeX-active-mark) + (insert TeX-grop) (exchange-point-and-mark) (insert TeX-grcl)) - (insert TeX-grcl) - (backward-char))))))) + (insert TeX-grop) + (if (TeX-active-mark) + (progn + (exchange-point-and-mark) + (insert TeX-grcl)) + (insert TeX-grcl) + (backward-char)))))))) (defun TeX-arg-string (optional &optional prompt initial-input) "Prompt for a string. @@ -3700,7 +3708,13 @@ If TEX is a directory, generate style files for all files in the directory." (class-opts (if (boundp 'LaTeX-provided-class-options) LaTeX-provided-class-options)) (pkg-opts (if (boundp 'LaTeX-provided-package-options) - LaTeX-provided-package-options))) + LaTeX-provided-package-options)) + (verb-envs (when (boundp 'LaTeX-verbatim-environments-local) + LaTeX-verbatim-environments-local)) + (verb-macros-delims (when (boundp 'LaTeX-verbatim-macros-with-delims-local) + LaTeX-verbatim-macros-with-delims-local)) + (verb-macros-braces (when (boundp 'LaTeX-verbatim-macros-with-braces-local) + LaTeX-verbatim-macros-with-braces-local))) (TeX-unload-style style) (with-current-buffer (generate-new-buffer file) (erase-buffer) @@ -3712,6 +3726,18 @@ If TEX is a directory, generate style files for all files in the directory." (when pkg-opts (insert "\n (TeX-add-to-alist 'LaTeX-provided-package-options\n" " '" (prin1-to-string pkg-opts) ")")) + (dolist (env verb-envs) + (insert + (format "\n (add-to-list 'LaTeX-verbatim-environments-local \"%s\")" + env))) + (dolist (env verb-macros-braces) + (insert + (format "\n (add-to-list 'LaTeX-verbatim-macros-with-braces-local \"%s\")" + env))) + (dolist (env verb-macros-delims) + (insert + (format "\n (add-to-list 'LaTeX-verbatim-macros-with-delims-local \"%s\")" + env))) (mapc (lambda (el) (TeX-auto-insert el style)) TeX-auto-parser) (insert "))\n\n") @@ -4617,14 +4643,10 @@ Brace insertion is only done if point is in a math construct and (defun TeX-mode-specific-command-menu (mode) "Return a Command menu specific to the major MODE." ;; COMPATIBILITY for Emacs < 21 - (if (and (not (featurep 'xemacs)) - (= emacs-major-version 20)) - (cons TeX-command-menu-name - (TeX-mode-specific-command-menu-entries mode)) - (list TeX-command-menu-name - :filter `(lambda (&rest ignored) - (TeX-mode-specific-command-menu-entries ',mode)) - "Bug."))) + (list TeX-command-menu-name + :filter `(lambda (&rest ignored) + (TeX-mode-specific-command-menu-entries ',mode)) + "Bug.")) (defun TeX-mode-specific-command-menu-entries (mode) "Return the entries for a Command menu specific to the major MODE."