auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] [elpa] externals/auctex a9ec6ba 01/57: Update style/minte


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex a9ec6ba 01/57: Update style/minted.el to package version 2.4.1.
Date: Wed, 11 Jan 2017 18:01:37 +0000 (UTC)

branch: externals/auctex
commit a9ec6ba8cc86b22d97da6ca4946aa6690cc059ad
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>

    Update style/minted.el to package version 2.4.1.
    
    * style/minted.el (LaTeX-minted-key-val-options): Add new key=vals
    from package version 2.4.1.
    (LaTeX-minted-key-val-options-local): New variable.
    (LaTeX-minted-language-list): Set the variable
    `LaTeX-minted-language-list' after the first call of function.
    (LaTeX-minted-style-list): New variable.
    (LaTeX-minted-style-list): New function analogous to
    `LaTeX-minted-language-list' returning styles provided by
    pymentize program.
    (LaTeX-arg-minted-style): New function to insert styles provided
    by pymentize program into buffer.
    (LaTeX-minted-update-key-vals): New function to update key=vals in
    `LaTeX-minted-key-val-options-local'.
    (LaTeX-minted-auto-cleanup): Call `LaTeX-minted-update-key-vals'.
    ("minted"): Use `LaTeX-minted-key-val-options-local' for all
    key=val queries.  Update macros incl. fontification.  Run style
    hook for `newfloat' when package option is given.
---
 style/minted.el |  197 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 175 insertions(+), 22 deletions(-)

diff --git a/style/minted.el b/style/minted.el
index b4bc572..914ee66 100644
--- a/style/minted.el
+++ b/style/minted.el
@@ -1,4 +1,4 @@
-;;; minted.el --- AUCTeX style for `minted.sty'
+;;; minted.el --- AUCTeX style for `minted.sty' (v2.4.1)
 
 ;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
 
@@ -26,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `minted.sty'.
+;; This file adds support for `minted.sty' (v2.4.1) from 2016/10/31.
 
 ;;; Code:
 
@@ -35,12 +35,31 @@
 (defvar LaTeX-minted-key-val-options
   '(("autogobble" ("true" "false"))
     ("baselinestretch" ("auto"))
+    ("breakafter")
+    ("breakaftergroup" ("true" "false"))
+    ("breakaftersymbolpre")
+    ("breakaftersymbolpost")
+    ("breakbytoken" ("true" "false"))
+    ("breakbytokenanywhere" ("true" "false"))
+    ("breakindent")
+    ("breaklines" ("true" "false"))
+    ("breaksymbol")
+    ("breaksymbolleft")
+    ("breaksymbolright")
+    ("breaksymbolindent")
+    ("breaksymbolindentleft")
+    ("breaksymbolindentright")
+    ("breaksymbolsep")
+    ("breaksymbolsepleft")
+    ("breaksymbolsepright")
     ("bgcolor")
     ("codetagify")
+    ("curlyquotes" ("true" "false"))
     ("encoding")
     ("outencoding")
+    ("escapeinside")
     ("firstline")
-    ("firstnumber" ("auto"))
+    ("firstnumber" ("auto" "last" "integer"))
     ("fontfamily" ("tt" "courier" "helvetica"))
     ("fontseries" ("auto"))
     ("fontsize" ("auto" "\tiny" "\large" "\scriptsize" "\Large"
@@ -53,12 +72,15 @@
     ("framesep")
     ("funcnamehighlighting" ("true" "false"))
     ("gobble")
+    ("highlightcolor")
+    ("highlightlines")
     ("keywordcase" ("lower" "upper" "capitalize"))
     ("label")
     ("labelposition" ("none" "topline" "bottomline" "all"))
     ("lastline")
     ("linenos" ("true" "false"))
-    ("numbers" ("left" "right"))
+    ("numberfirstline" ("true" "false"))
+    ("numbers" ("left" "right" "both" "none"))
     ("mathescape" ("true" "false"))
     ("numberblanklines" ("true" "false"))
     ("numbersep")
@@ -69,10 +91,27 @@
     ("samepage" ("true" "false"))
     ("showspaces" ("true" "false"))
     ("showtabs" ("true" "false"))
+    ("space")
+    ("spacecolor")
     ("startinline" ("true" "false"))
-    ("style")
+    ;; FIXME: It would be nice to use the function
+    ;; `LaTeX-minted-style-list' here, but with a file local var like:
+    ;;     %%% TeX-command-extra-options: "-shell-escape"
+    ;; in a .tex file, Emacs asks to apply a variable which is not
+    ;; safe and does not restore the frame; the splitted frame
+    ;; remains.  I couldn't figure out why, so for now, I add the
+    ;; styles from Pygments version 2.1.3 here.
+    ("style" ("colorful" "default" "emacs" "friendly" "fruity" "igor"
+             "lovelace" "manni" "monokai" "murphy" "native"
+             "paraiso-dark" "paraiso-light" "pastie" "perldoc"
+             "rrt" "tango" "trac" "vim" "vs" "xcode"))
     ("stepnumber")
+    ("stepnumberfromfirst")
+    ("stepnumberoffsetvalues" ("true" "false"))
+    ("stripall" ("true" "false"))
     ("stripnl")
+    ("tab")
+    ("tabcolor")
     ("tabsize")
     ("texcl" ("true" "false"))
     ("texcomments" ("true" "false"))
@@ -80,11 +119,18 @@
     ("xrightmargin"))
   "Key=value options for minted macros and environments.")
 
+(defvar LaTeX-minted-key-val-options-local nil
+  "Buffer-local key=value options for minted macros and environments.")
+(make-variable-buffer-local 'LaTeX-minted-key-val-options-local)
+
 (defvar LaTeX-minted-pygmentize-program (executable-find "pygmentize"))
 
-(defvar LaTeX-minted-language-list nil)
+(defvar LaTeX-minted-language-list nil
+  "List containing languages provided by pymentize program.")
 
 (defun LaTeX-minted-language-list (&rest _ignored)
+  "Return a list of languages provided by pymentize program.
+Update the variable `LaTeX-minted-language-list' if still nil."
   (or LaTeX-minted-language-list
       (when LaTeX-minted-pygmentize-program
        (with-temp-buffer
@@ -95,14 +141,67 @@
            (while (re-search-forward "^\*[[:space:]]\([^:]+\):" nil t)
              (dolist (lang (split-string (match-string 1) "[[:space:],]" t))
                (push lang languages)))
-           languages)))))
+           (setq LaTeX-minted-language-list languages))
+         LaTeX-minted-language-list))))
 
 (defun LaTeX-arg-minted-language (optional &optional prompt)
+    "Insert a selected pygmentize language as argument for macros from 
minted.sty.
+If OPTIONAL is non-nil, insert it as optional argument in
+brackets.  PROMPT replaces the standard one."
   (TeX-argument-insert
    (completing-read (TeX-argument-prompt optional prompt "Language")
                    (LaTeX-minted-language-list))
    optional))
 
+(defvar LaTeX-minted-style-list nil
+  "List containing styles provided by pymentize program.")
+
+(defun LaTeX-minted-style-list (&rest _ignored)
+  "Return a list of styles provided by pymentize program.
+Update the variable `LaTeX-minted-style-list' if still nil."
+  (or LaTeX-minted-style-list
+      (when LaTeX-minted-pygmentize-program
+       (with-temp-buffer
+         (shell-command (concat LaTeX-minted-pygmentize-program " -L styles")
+                        (current-buffer))
+         (goto-char (point-min))
+         (let (styles)
+           (while (re-search-forward "^\*[[:space:]]\([^:]+\):" nil t)
+             (dolist (style (split-string (match-string 1) "[[:space:],]" t))
+               (push style styles)))
+           (setq LaTeX-minted-style-list styles))
+         LaTeX-minted-style-list))))
+
+(defun LaTeX-arg-minted-style (optional &optional prompt)
+  "Insert a selected pygmentize style as argument for macros from minted.sty.
+If OPTIONAL is non-nil, insert it as optional argument in
+brackets.  PROMPT replaces the standard one."
+  (TeX-argument-insert
+   (completing-read (TeX-argument-prompt optional prompt "Style")
+                   (LaTeX-minted-style-list))
+   optional))
+
+(defun LaTeX-minted-update-key-vals ()
+  "Update color related key-vals in `LaTeX-minted-key-val-options-local'


reply via email to

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