emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 118/299: Add new style files fancyvrb.el and xparse.el.


From: Stefan Monnier
Subject: [elpa] 118/299: Add new style files fancyvrb.el and xparse.el.
Date: Sun, 02 Nov 2014 03:10:46 +0000

monnier pushed a commit to branch externals/auctex
in repository elpa.

commit 239fce1a6a1478c5ec71306cdba7d8de41bb7a78
Author: Mosè Giordano <address@hidden>
Date:   Mon May 13 13:59:04 2013 +0200

    Add new style files fancyvrb.el and xparse.el.
    
    * style/fancyvrb.el: New style.
    
    * style/xparse.el: Ditto.
    
    * Makefile.in (STYLESRC): Add style/fancyvrb.el and
    style/xparse.el.
---
 ChangeLog         |    9 +++
 Makefile.in       |    2 +-
 style/fancyvrb.el |  205 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 style/xparse.el   |  113 +++++++++++++++++++++++++++++
 4 files changed, 328 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6e09034..22169e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-05-13  Mos� Giordano  <address@hidden>
+
+       * style/fancyvrb.el: New style.
+
+       * style/xparse.el: Ditto.
+
+       * Makefile.in (STYLESRC): Add style/fancyvrb.el and
+       style/xparse.el.
+
 2013-05-12  Mos� Giordano  <address@hidden>
 
        * tex.el (TeX-insert-dollar): Insert just a single dollar when the
diff --git a/Makefile.in b/Makefile.in
index 4944b42..8b4f410 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -131,7 +131,7 @@ STYLESRC = style/prosper.el \
           style/memoir.el    style/placeins.el  style/nameref.el \
           style/fancynum.el  style/fancyhdr.el  style/filecontents.el \
           style/array.el     style/kpfonts.el   style/acro.el \
-          style/acronym.el
+          style/acronym.el   style/xparse.el    style/fancyvrb.el
 STYLEELC = $(STYLESRC:.el=.elc)
 
 CLEANFILES = $(AUCELC) $(STYLEELC) $(MULEELC)
diff --git a/style/fancyvrb.el b/style/fancyvrb.el
new file mode 100644
index 0000000..3723ea8
--- /dev/null
+++ b/style/fancyvrb.el
@@ -0,0 +1,205 @@
+;;; fancyvrb.el --- AUCTeX style for `fancyvrb.sty' version 2.8.
+
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+
+;; Maintainer: address@hidden
+;; Author: Mosè Giordano <address@hidden>
+;; 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 `fancyvrb.sty' version 2.8.
+
+;;; Code:
+
+(defvar LaTeX-fancyvrb-macro-regexp
+  (concat "\\\\\\(?:Re\\|\\)CustomVerbatimCommand"
+         "[ \t\n\r]*{?[ \t\n\r]*\\\\\\([A-Za-z]+\\)[ \t\n\r]*}?")
+  "Matches macros by fancyvrb package.")
+
+(defvar LaTeX-fancyvrb-environment-regexp
+  (concat "\\\\\\(?:Define\\|Custom\\|Recustom\\)VerbatimEnvironment"
+         "[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z]+\\)[ \t\n\r]*}")
+  "Matches environments by fancyvrb package.")
+
+(defvar LaTeX-fancyvrb-key-val-options
+  '(("commentchar")
+    ("gobble")
+    ("formatcom")
+    ("fontfamily" ("tt" "courier" "helvetica"))
+    ("fontsize")
+    ("fontshape")
+    ("fontseries")
+    ("frame" ("none" "leftline" "topline" "bottomline" "lines" "single"))
+    ("framerule")
+    ("framesep")
+    ("rulecolor")
+    ("fillcolor")
+    ("label")
+    ("labelposition" ("none" "topline" "bottomline" "all"))
+    ("numbers" ("none" "left" "right"))
+    ("numbersep")
+    ("firstnumber" ("auto" "last" "integer"))
+    ("stepnumber")
+    ("numberblanklines" ("true" "false"))
+    ("firstline")
+    ("lastline")
+    ("showspaces" ("true" "false"))
+    ("showtabs" ("true" "false"))
+    ("obeytabs" ("true" "false"))
+    ("tabsize")
+    ("baselinestretch" ("auto" "dimension"))
+    ("commandchars")
+    ("xleftmargin")
+    ("xrightmargin")
+    ("resetmargins" ("true" "false"))
+    ("hfuzz")
+    ("samepage" ("true" "false"))
+    ("codes")
+    ("defineactive")
+    ;; Actually, the following options are used only by the `BVerbatim'
+    ;; environment.
+    ("boxwidth" ("auto" "dimension"))
+    ("baseline" ("b" "c" "t")))
+  "Key=value options for fancyvrb macros and environments.")
+
+(TeX-add-style-hook
+ "fancyvrb"
+ (lambda ()
+   (TeX-auto-add-regexp `(,LaTeX-fancyvrb-macro-regexp 1 TeX-auto-symbol))
+   (TeX-auto-add-regexp
+    `(,LaTeX-fancyvrb-environment-regexp 1 LaTeX-auto-environment))
+   (TeX-run-style-hooks
+    "keyval")
+   (TeX-add-symbols
+    ;;; Verbatim material in footnotes
+    "VerbatimFootnotes"
+    ;;; Improved verbatim commands
+    '("Verb" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options] TeX-arg-verb)
+    "DefineShortVerb"
+    "UndefineShortVerb"
+    ;;; Verbatim environments
+    '("fvset" (TeX-arg-key-val LaTeX-fancyvrb-key-val-options))
+    ;; Changing individual line formatting
+    "FancyVerbFormatLine"
+    ;; Line numbering
+    "theFancyVerbLine"
+    ;; Selection of lines to print
+    "FancyVerbStartString"
+    "FancyVerbStopString"
+    ;; Personalized environments
+    '("CustomVerbatimEnvironment"
+      (TeX-arg-define-environment "New verbatim environment")
+      (TeX-arg-environment "Basend on environment")
+      (TeX-arg-key-val LaTeX-fancyvrb-key-val-options))
+    '("RecustomVerbatimEnvironment"
+      (TeX-arg-environment "New verbatim environment")
+      (TeX-arg-environment "Basend on environment")
+      (TeX-arg-key-val LaTeX-fancyvrb-key-val-options))
+    '("DefineVerbatimEnvironment"
+      (TeX-arg-define-environment "New verbatim environment")
+      (TeX-arg-environment "Basend on environment")
+      (TeX-arg-key-val LaTeX-fancyvrb-key-val-options))
+    '("CustomVerbatimCommand" (TeX-arg-define-macro "New verbatim macro: ")
+      (TeX-arg-eval completing-read "Based on macro: " (TeX-symbol-list))
+      (TeX-arg-key-val LaTeX-fancyvrb-key-val-options))
+    '("RecustomVerbatimCommand" (TeX-arg-macro "New verbatim macro: ")
+      (TeX-arg-eval completing-read "Based on macro: " (TeX-symbol-list))
+      (TeX-arg-key-val LaTeX-fancyvrb-key-val-options))
+    ;;; Saving and restoring verbatim text and environments
+    "SaveVerb"
+    "UseVerb"
+    "SaveVerbatim"
+    "UseVerbatim"
+    "LUseVerbatim"
+    "BUseVerbatim"
+    ;;; Writing and reading verbatim files
+    '("VerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options]
+      (TeX-arg-file))
+    '("BVerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options]
+      (TeX-arg-file))
+    '("LVerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options]
+      (TeX-arg-file)))
+   (LaTeX-add-environments
+    '("Verbatim" LaTeX-env-args
+      [TeX-arg-key-val LaTeX-fancyvrb-key-val-options])
+    '("BVerbatim" LaTeX-env-args
+      [TeX-arg-key-val LaTeX-fancyvrb-key-val-options])
+    '("LVerbatim" LaTeX-env-args
+      [TeX-arg-key-val LaTeX-fancyvrb-key-val-options])
+    '("SaveVerbatim" LaTeX-env-args
+      [TeX-arg-key-val LaTeX-fancyvrb-key-val-options])
+    '("VerbatimOut"
+      (lambda (env)
+       (let ((options (TeX-read-key-val t LaTeX-fancyvrb-key-val-options))
+             (file (TeX-read-string "Output file: ")))
+         (LaTeX-insert-environment
+          env
+          (concat (unless (zerop (length options))
+                    (concat LaTeX-optop options LaTeX-optcl))
+                  (concat TeX-grop file TeX-grcl)))))))
+   (LaTeX-add-counters
+    "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")
+   (add-to-list 'LaTeX-verbatim-environments-local "SaveVerbatim")
+   (add-to-list 'LaTeX-verbatim-environments-local "VerbatimOut")
+   (make-local-variable 'LaTeX-indent-environment-list)
+   (add-to-list 'LaTeX-indent-environment-list '("Verbatim" 
current-indentation))
+   (add-to-list 'LaTeX-indent-environment-list '("BVerbatim" 
current-indentation))
+   (add-to-list 'LaTeX-indent-environment-list '("LVerbatim" 
current-indentation))
+   (add-to-list 'LaTeX-indent-environment-list '("SaveVerbatim" 
current-indentation))
+   (add-to-list 'LaTeX-indent-environment-list '("VerbatimOut" 
current-indentation))
+   (add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb")
+   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "Verb")
+
+   ;; 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 '(("DefineVerbatimEnvironment" "{{{")
+                               ("CustomVerbatimEnvironment" "{{{")
+                               ("RecustomVerbatimEnvironment" "{{{"))
+                             'function)
+     (font-latex-add-keywords '(("VerbatimInput" "[{")
+                               ("BVerbatimInput" "[{")
+                               ("LVerbatimInput" "[{"))
+                             'reference)
+     (font-latex-add-keywords '(("Verb" "[")) ; The second argument should
+                                             ; actually be verbatim.
+                             'textual)
+     (font-latex-add-keywords '(("fvset" "{")) 'variable)
+     ;; 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))))
+
+(defvar LaTeX-fancyvrb-package-options nil
+  "Package options for the fancyvrb package.")
+
+;;; fancyvrb.el ends here
diff --git a/style/xparse.el b/style/xparse.el
new file mode 100644
index 0000000..7b57108
--- /dev/null
+++ b/style/xparse.el
@@ -0,0 +1,113 @@
+;;; xparse.el --- AUCTeX style for `xparse.sty' version 4467.
+
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+
+;; Maintainer: address@hidden
+;; Author: Mosè Giordano <address@hidden>
+;; 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 basic support for `xparse.sty' version 4467.  It
+;; doesn't parse argument specification of macros and environments.
+
+;;; Code:
+
+(defvar LaTeX-xparse-macro-regexp
+  (concat "\\\\\\(?:Declare\\|New\\|Renew\\|Provide\\|DeclareExpandable\\)"
+         "DocumentCommand[ \t\n\r]*{?[ \t\n\r]*\\\\\\([A-Za-z]+\\)[ \t\n\r]*}?"
+         ;; The following is the opening brace of argument specification and is
+         ;; needed to skip internal macros containing `:' or `_'.
+         "[ \t\n\r]*{")
+  "Matches macros by xparse package.")
+
+(defvar LaTeX-xparse-environment-regexp
+  (concat "\\\\\\(?:Declare\\|New\\|Renew\\|Provide\\)DocumentEnvironment"
+         "[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z]+\\)[ \t\n\r]*}")
+  "Matches environments by xparse package.")
+
+(TeX-add-style-hook
+ "xparse"
+ (lambda ()
+   (TeX-auto-add-regexp `(,LaTeX-xparse-macro-regexp 1 TeX-auto-symbol))
+   (TeX-auto-add-regexp
+    `(,LaTeX-xparse-environment-regexp 1 LaTeX-auto-environment))
+   (TeX-run-style-hooks
+    "expl3")
+   (TeX-add-symbols
+    ;; Declaring commands and environments
+    '("DeclareDocumentCommand" TeX-arg-define-macro "Argument specification" t)
+    '("NewDocumentCommand" TeX-arg-define-macro "Argument specification" t)
+    '("RenewDocumentCommand" TeX-arg-macro "Argument specification" t)
+    '("ProvideDocumentCommand" TeX-arg-define-macro "Argument specification" t)
+    '("DeclareDocumentEnvironment" TeX-arg-define-environment
+      "Argument specification" t t)
+    '("NewDocumentEnvironment" TeX-arg-define-environment
+      "Argument specification" t t)
+    '("RenewDocumentEnvironment" TeX-arg-environment
+      "Argument specification" t t)
+    '("ProvideDocumentEnvironment" TeX-arg-define-environment
+      "Argument specification" t t)
+    ;; Fully-expandable document commands
+    '("DeclareExpandableDocumentCommand"
+      TeX-arg-define-macro "Argument specification" t)
+    ;; Testing special values
+    '("IfBooleanTF" 3)
+    '("IfBooleanT" 3)
+    '("IfBooleanF" 3)
+    '("IfNoValueTF" 3)
+    '("IfNoValueT" 3)
+    '("IfNoValueF" 3)
+    '("IfValueTF" 3)
+    '("IfValueT" 3)
+    '("IfValueF" 3)
+    "BooleanTrue"
+    "BooleanFalse"
+    ;; Argument processors
+    "ProcessedArgument"
+    "ReverseBoolean"
+    '("SplitArgument" "Number" "Token")
+    "SplitList"
+    "TrimSpaces"
+    '("ProcessList" "List" "Functiom")
+    ;; Access to the argument specification
+    '("GetDocumentCommandArgSpec" TeX-arg-macro)
+    '("GetDocumentEnvironmmentArgSpec" TeX-arg-environment)
+    '("ShowDocumentCommandArgSpec" TeX-arg-macro)
+    '("ShowDocumentEnvironmentArgSpec" TeX-arg-environment))
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("DeclareDocumentCommand" "|{{{")
+                               ("NewDocumentCommand" "|{{{")
+                               ("RenewDocumentCommand" "|{{{")
+                               ("ProvideDocumentCommand" "|{{{")
+                               ("DeclareExpandableDocumentCommand" "|{{{")
+                               ("DeclareDocumentEnvironment" "{{{{")
+                               ("NewDocumentEnvironment" "{{{{")
+                               ("RenewDocumentEnvironment" "{{{{")
+                               ("ProvideDocumentEnvironment" "{{{{"))
+                             'function))))
+
+(defun LaTeX-xparse-package-options ()
+  "Read the xparse package options from the user."
+  (TeX-read-key-val t '(("log-declarations" ("true" "false")))))
+
+;;; xparse.el ends here



reply via email to

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