auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 6e94ea0227aae5959b820


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 6e94ea0227aae5959b820b5021ef08973c2403eb
Date: Fri, 19 Dec 2014 21:24:59 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  6e94ea0227aae5959b820b5021ef08973c2403eb (commit)
       via  63bcbcd1f6aae29b8c53d7a703fb0e5f92be0701 (commit)
       via  0cc29f909de3f1febd9d958e96007493a2f9b69c (commit)
      from  fc9a240dccd5e328142c821fb4ed0dbe34bd76c7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6e94ea0227aae5959b820b5021ef08973c2403eb
Author: Tassilo Horn <address@hidden>
Date:   Fri Dec 19 22:24:17 2014 +0100

    Add (start of an) minted style.
    
    * style/minted.el: New style.
    
    * Makefile.in (STYLESRC): Add style/minted.el.

diff --git a/ChangeLog b/ChangeLog
index 735d8d0..402416e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-12-19  Tassilo Horn  <address@hidden>
 
+       * 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.
diff --git a/Makefile.in b/Makefile.in
index a132c1c..998e730 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -142,7 +142,7 @@ STYLESRC = style/prosper.el \
           style/XCharter.el  style/zlmtt.el     style/ifluatex.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/newtxtext.el style/newtxttt.el  style/minted.el
 STYLEELC = $(STYLESRC:.el=.elc)
 
 ifeq (@preview_enabled@,yes)
diff --git a/style/minted.el b/style/minted.el
new file mode 100644
index 0000000..b5733c3
--- /dev/null
+++ b/style/minted.el
@@ -0,0 +1,212 @@
+;;; minted.el --- AUCTeX style for `minted.sty'
+
+;; Copyright (C) 2014 Free Software Foundation, Inc.
+
+;; Author: Tassilo Horn <address@hidden>
+;; Maintainer: address@hidden
+;; 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))
+
+;; FIXME: All the \newmint-macros allow to specify the env/macro name as
+;; optional 1st arg, e.g., with \newminted[fifi]{cpp}{opts} the resulting
+;; environments are fifi and fifi* rather than cppcode and cppcode*.
+(defvar LaTeX-minted-auto-newminted nil)
+(defvar LaTeX-minted-newminted-regexp
+  '("\\\\newminted{\\([^}]+\\)}{[^}]*}" 1 LaTeX-minted-auto-newminted))
+
+(defvar LaTeX-minted-auto-newmint nil)
+(defvar LaTeX-minted-newmint-regexp
+  '("\\\\newmint{\\([^}]+\\)}{[^}]*}" 1 LaTeX-minted-auto-newmint))
+
+(defvar LaTeX-minted-auto-newmintinline nil)
+(defvar LaTeX-minted-newmintinline-regexp
+  '("\\\\newmintinline{\\([^}]+\\)}{[^}]*}" 1 LaTeX-minted-auto-newmintinline))
+
+(defvar LaTeX-minted-auto-newmintedfile nil)
+(defvar LaTeX-minted-newmintedfile-regexp
+  '("\\\\newmintedfile{\\([^}]+\\)}{[^}]*}" 1 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 ()
+  ;; (message "1: %s\n2: %s\n3: %s\n4: %s"
+  ;;      LaTeX-minted-auto-newminted
+  ;;      LaTeX-minted-auto-newmint
+  ;;      LaTeX-minted-auto-newmintinline
+  ;;      LaTeX-minted-auto-newmintedfile)
+  ;; Every \newminted{lang}{opts} defines a new langcode and a new langcode*
+  ;; env.  The starred version has mandatory args.
+  (dolist (lang LaTeX-minted-auto-newminted)
+    (let* ((env (concat 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*)))
+  (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"))
+
+   ;; 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

commit 63bcbcd1f6aae29b8c53d7a703fb0e5f92be0701
Author: Tassilo Horn <address@hidden>
Date:   Fri Dec 19 22:19:07 2014 +0100

    Obsolete LaTeX-verbatim-regexp defcustom
    
    * latex.el (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.

diff --git a/ChangeLog b/ChangeLog
index 9bd0dae..735d8d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,23 @@
 
        * 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  <address@hidden>
 
diff --git a/latex.el b/latex.el
index 1098601..8b19c8b 100644
--- a/latex.el
+++ b/latex.el
@@ -2914,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."
@@ -3045,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
@@ -3076,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.
@@ -3208,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)))
diff --git a/style/alltt.el b/style/alltt.el
index e5c5684..86b4993 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/beamer.el b/style/beamer.el
index 16c1f4b..58bef38 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -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
diff --git a/style/fancyvrb.el b/style/fancyvrb.el
index 92718b4..8334708 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/listings.el b/style/listings.el
index 534de62..ace5c97 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" "{{")

commit 0cc29f909de3f1febd9d958e96007493a2f9b69c
Author: Tassilo Horn <address@hidden>
Date:   Fri Dec 19 22:07:25 2014 +0100

    Fix void-variable error.
    
    * latex.el (LaTeX-env-args): Bind exit-mark if its not bound
    already.

diff --git a/ChangeLog b/ChangeLog
index 869e8c9..9bd0dae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-19  Tassilo Horn  <address@hidden>
+
+       * latex.el (LaTeX-env-args): Bind exit-mark if its not bound
+       already.
+
 2014-12-18  Tassilo Horn  <address@hidden>
 
        * tex.el (TeX-evince-sync-view): Don't URL-encode commas in the
diff --git a/latex.el b/latex.el
index 477ef66..1098601 100644
--- a/latex.el
+++ b/latex.el
@@ -1182,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
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   26 +++++++
 Makefile.in       |    2 +-
 latex.el          |   19 ++++-
 style/alltt.el    |    2 -
 style/beamer.el   |    4 +-
 style/fancyvrb.el |    6 +-
 style/listings.el |    4 +-
 style/minted.el   |  212 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 256 insertions(+), 19 deletions(-)
 create mode 100644 style/minted.el


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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