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. 5ee567c8043f462ecf995


From: Mosè Giordano
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 5ee567c8043f462ecf995eef424dd5d93b51f167
Date: Mon, 28 Sep 2015 10:23:40 +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  5ee567c8043f462ecf995eef424dd5d93b51f167 (commit)
       via  f9a792823d641f0e587231c329c6bd1cd5800be9 (commit)
       via  48093faaf5ae972728d19ff0a36019bf8b0f983a (commit)
      from  0ac0fa8ed3da67b02c7d8d5bf8ae6ac1a16cffd9 (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 5ee567c8043f462ecf995eef424dd5d93b51f167
Author: Mosè Giordano <address@hidden>
Date:   Mon Sep 28 11:09:00 2015 +0200

    Append entries to LaTeX-label-alist in newfloat.el.
    
    * style/newfloat.el: Do not require cl at loading time.
    (LaTeX-newfloat-auto-cleanup): Append elements to
    `LaTeX-label-alist' in order not to override possible custom
    values.

diff --git a/ChangeLog b/ChangeLog
index dd1660b..8c677a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-28  Mosè Giordano  <address@hidden>
+
+       * style/newfloat.el: Do not require cl at loading time.
+       (LaTeX-newfloat-auto-cleanup): Append elements to
+       `LaTeX-label-alist' in order not to override possible custom
+       values.
+
 2015-09-27  Arash Esbati  <address@hidden>
 
        * Makefile.in (STYLESRC): Add new style.
diff --git a/style/newfloat.el b/style/newfloat.el
index 7aef15d..356fcec 100644
--- a/style/newfloat.el
+++ b/style/newfloat.el
@@ -54,9 +54,6 @@
 
 ;;; Code:
 
-;; Needed for compiling `pushnew':
-(eval-when-compile (require 'cl))
-
 ;; Needed for auto-parsing.
 (require 'tex)
 
@@ -106,15 +103,13 @@ Also define the macros \"listofENVs\" and 
\"listofENVes\"."
          (type (cadr flt-type)))
       (cond ((string-equal type "figure")
             (LaTeX-add-environments `(,flt LaTeX-env-figure))
-            (pushnew `(,flt . LaTeX-figure-label)
-                     LaTeX-label-alist :test #'equal)
+            (add-to-list 'LaTeX-label-alist `(,flt . LaTeX-figure-label) t)
             (when (fboundp 'reftex-add-label-environments)
               (reftex-add-label-environments
                `((,flt ?f ,LaTeX-figure-label "~\\ref{%s}" caption nil nil)))))
            ((string-equal type "table")
             (LaTeX-add-environments `(,flt LaTeX-env-figure))
-            (pushnew `(,flt . LaTeX-table-label)
-                     LaTeX-label-alist :test #'equal)
+            (add-to-list 'LaTeX-label-alist `(,flt . LaTeX-table-label) t)
             (when (fboundp 'reftex-add-label-environments)
               (reftex-add-label-environments
                `((,flt ?t ,LaTeX-table-label "~\\ref{%s}" caption nil nil)))))

commit f9a792823d641f0e587231c329c6bd1cd5800be9
Author: Arash Esbati <address@hidden>
Date:   Sun Sep 27 10:17:18 2015 +0200

    Add new style newfloat.el.
    
    * Makefile.in (STYLESRC): Add new style.
    
    * style/newfloat.el: New file.
    
    Signed-off-by: Mosè Giordano <address@hidden>

diff --git a/ChangeLog b/ChangeLog
index 91c6bc5..dd1660b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-09-27  Arash Esbati  <address@hidden>
 
+       * Makefile.in (STYLESRC): Add new style.
+
+       * style/newfloat.el: New file.
+
        * style/longtable.el ("longtable"): Make package lengths available
        through `LaTeX-add-lengths' and not `TeX-add-symbol'.
 
diff --git a/Makefile.in b/Makefile.in
index 9846055..ba31c43 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -152,7 +152,7 @@ STYLESRC = style/prosper.el \
           style/mnras.el     style/environ.el   style/polyglossia.el \
           style/vwcol.el     style/textpos.el   style/transparent.el \
           style/fontenc.el   style/Alegreya.el  style/gloss-italian.el \
-          style/subcaption.el style/AlegreyaSans.el
+          style/newfloat.el  style/subcaption.el style/AlegreyaSans.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/style/newfloat.el b/style/newfloat.el
new file mode 100644
index 0000000..7aef15d
--- /dev/null
+++ b/style/newfloat.el
@@ -0,0 +1,225 @@
+;;; newfloat.el --- AUCTeX style for `newfloat.sty' (v1.1-109)
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <esbati'at'gmx.de>
+;; Maintainer: address@hidden
+;; Created: 2015-09-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 `newfloat.sty' (v1.1-109) from 2015/09/17.
+;; `newfloat.sty' is part of TeXLive.
+
+;; This style has some facilities to process the newly defined
+;; floating environments within AUCTeX, e.g. indentation, label
+;; addition etc.  Currently it makes provision for `figure', `table'
+;; and `verbatim' floating types.  To make things work, the style
+;; needs some help from the user.  When a new floating environment is
+;; defined, the user should pass the floating type as a comment to
+;; AUCTeX, e.g.
+;;
+;;     \DeclareFloatingEnvironment[
+;;       name=Code,
+;;       listname={List of Codes},
+;;       fileext=lol]{code}  %  {verbatim}
+;;
+;; Note the `{verbatim}' as a comment after the name of the float env.
+;; Due to parsing reasons, this key-word must be in the same line as
+;; the name of the float and enclosed in braces `{}'.
+;;
+;; Before the opening brace, only spaces and comment chars `%' are
+;; allowed.  Anything following the closing brace `}' is ignored.
+
+;; If things do not work or when in doubt, press `C-c C-n'.  Comments
+;; for improvement are welcome.
+
+;;; Code:
+
+;; Needed for compiling `pushnew':
+(eval-when-compile (require 'cl))
+
+;; Needed for auto-parsing.
+(require 'tex)
+
+(defvar LaTeX-newfloat-key-val-options
+  '(("fileext")
+    ("listname")
+    ("name")
+    ("placement" ("t" "b" "p" "tbp" "htbp"))
+    ("chapterlistsgaps" ("on" "off")))
+  "Key=value options for newfloat macros.")
+
+(defvar LaTeX-newfloat-key-val-options-local nil
+  "Buffer-local Key=value options for newfloat macros.")
+(make-variable-buffer-local 'LaTeX-newfloat-key-val-options-local)
+
+;; Setup parsing for \DeclareFloatingEnvironment:
+(TeX-auto-add-type "newfloat-DeclareFloatingEnvironment" "LaTeX")
+
+(defvar LaTeX-newfloat-DeclareFloatingEnvironment-regex
+  `(,(concat "\\\\DeclareFloatingEnvironment"
+            "[ \t\n\r%]*"
+            "\\["
+            "[ \t\n\r%{}a-zA-Z0-9=,-]*"
+            "\\]"
+            "[ \t\n\r%]*"
+            "{\\([^}]+\\)}"
+            "\\(?:[ %]*{\\([^}]*\\)}\\)?")
+    (1 2) LaTeX-auto-newfloat-DeclareFloatingEnvironment)
+  "Matches the argument of `\\DeclareFloatingEnvironment' from
+`newfloat.sty'.")
+
+(defun LaTeX-newfloat-auto-prepare ()
+  "Clear `LaTeX-auto-newfloat-DeclareFloatingEnvironment' before parsing."
+  (setq        LaTeX-auto-newfloat-DeclareFloatingEnvironment nil))
+
+(defun LaTeX-newfloat-auto-cleanup ()
+  "Process definded floats with \\DeclareFloatingEnvironment.
+Depending on floating type passed as a comment to
+AUCTeX (\"figure\", \"table\" or \"verbatim\"), update
+`LaTeX-figure-label' and `LaTeX-table-label'.  If RefTeX is
+loaded, add the new floating environment via
+`reftex-add-label-environments'.  For \"verbatim\" environments,
+update `LaTeX-indent-environment-list' to suppress indentation.
+Also define the macros \"listofENVs\" and \"listofENVes\"."
+  (dolist (flt-type (LaTeX-newfloat-DeclareFloatingEnvironment-list))
+    (let ((flt  (car  flt-type))
+         (type (cadr flt-type)))
+      (cond ((string-equal type "figure")
+            (LaTeX-add-environments `(,flt LaTeX-env-figure))
+            (pushnew `(,flt . LaTeX-figure-label)
+                     LaTeX-label-alist :test #'equal)
+            (when (fboundp 'reftex-add-label-environments)
+              (reftex-add-label-environments
+               `((,flt ?f ,LaTeX-figure-label "~\\ref{%s}" caption nil nil)))))
+           ((string-equal type "table")
+            (LaTeX-add-environments `(,flt LaTeX-env-figure))
+            (pushnew `(,flt . LaTeX-table-label)
+                     LaTeX-label-alist :test #'equal)
+            (when (fboundp 'reftex-add-label-environments)
+              (reftex-add-label-environments
+               `((,flt ?t ,LaTeX-table-label "~\\ref{%s}" caption nil nil)))))
+           ((string-equal type "verbatim")
+            (LaTeX-add-environments flt)
+            (make-local-variable 'LaTeX-indent-environment-list)
+            (pushnew `(,flt current-indentation)
+                     LaTeX-indent-environment-list :test #'equal)
+            (when (fboundp 'reftex-add-label-environments)
+              (reftex-add-label-environments
+               `((,flt ?l "lst:" "~\\ref{%s}" caption nil nil)))))
+           (t
+            (LaTeX-add-environments flt)))
+      (if (string-equal "e" (substring flt -1))
+         (TeX-add-symbols (concat "listof" flt "s"))
+       (TeX-add-symbols
+        (concat "listof" flt "s")
+        (concat "listof" flt "es"))))))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-newfloat-auto-prepare t)
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-newfloat-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(TeX-add-style-hook
+ "newfloat"
+ (lambda ()
+
+   ;; Add newfloat to the parser.
+   (TeX-auto-add-regexp LaTeX-newfloat-DeclareFloatingEnvironment-regex)
+
+   ;; Depending on class, add "within" key to the local options list
+   ;; and use it.
+   (setq LaTeX-newfloat-key-val-options-local
+        (copy-alist LaTeX-newfloat-key-val-options))
+
+   (if (= (LaTeX-largest-level) 1)
+       (add-to-list 'LaTeX-newfloat-key-val-options-local
+                   '("within" ("chapter" "section" "none")))
+     (add-to-list 'LaTeX-newfloat-key-val-options-local
+                 '("within" ("section" "none"))))
+
+   ;; Commands:
+   (TeX-add-symbols
+    '("DeclareFloatingEnvironment"
+      [TeX-arg-key-val LaTeX-newfloat-key-val-options-local]
+      (TeX-arg-eval
+       (lambda ()
+        (let ((newfloat (TeX-read-string
+                        (TeX-argument-prompt nil nil "Floating environment"))))
+          (LaTeX-add-newfloat-DeclareFloatingEnvironments newfloat)
+          (format "%s" newfloat)))))
+
+    '("SetupFloatingEnvironment"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt nil nil "Floating environment")
+                   (mapcar 'car 
(LaTeX-newfloat-DeclareFloatingEnvironment-list)))
+      (TeX-arg-eval
+       (lambda ()
+        (let ((keyvals (TeX-read-key-val
+                        nil
+                        (append (if (= (LaTeX-largest-level) 1)
+                                    '(("within" ("chapter" "section" "none")))
+                                  '(("within" ("section" "none"))))
+                                LaTeX-newfloat-key-val-options))))
+          (format "%s" keyvals)))))
+
+    '("ForEachFloatingEnvironment" t)
+    '("ForEachFloatingEnvironment*" t)
+
+    '("PrepareListOf"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt nil nil "Floating environment")
+                   (mapcar 'car 
(LaTeX-newfloat-DeclareFloatingEnvironment-list)))
+      t)
+
+    '("newfloatsetup"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((keyvals (TeX-read-key-val
+                        nil
+                        (append '(("chapterlistsgap"))
+                                (if (= (LaTeX-largest-level) 1)
+                                    '(("within" ("chapter" "section" "none")))
+                                  '(("within" ("section" "none"))))))))
+          (format "%s" keyvals))))))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("DeclareFloatingEnvironment"  "[{")
+                               ("SetupFloatingEnvironment"    "{{")
+                               ("ForEachFloatingEnvironment"  "*{")
+                               ("PrepareListOf"               "{{")
+                               ("newfloatsetup"               "{"))
+                             'function)))
+ LaTeX-dialect)
+
+(defun LaTeX-newfloat-package-options ()
+  "Prompt for package options for the newfloat package."
+  (TeX-read-key-val
+   t
+   (append
+    '(("chapterlistsgap"))
+    (if (= (LaTeX-largest-level) 1)
+       '(("within" ("chapter" "section" "none")))
+      '(("within" ("section" "none")))))))
+
+;;; newfloat.el ends here

commit 48093faaf5ae972728d19ff0a36019bf8b0f983a
Author: Arash Esbati <address@hidden>
Date:   Sun Sep 27 10:13:53 2015 +0200

    Use LaTeX-add-lengths for LaTeX-lengths.
    
    * style/longtable.el ("longtable"): Make package lengths available
    through `LaTeX-add-lengths' and not `TeX-add-symbol'.
    
    Signed-off-by: Mosè Giordano <address@hidden>

diff --git a/ChangeLog b/ChangeLog
index aaa44d9..91c6bc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-27  Arash Esbati  <address@hidden>
+
+       * style/longtable.el ("longtable"): Make package lengths available
+       through `LaTeX-add-lengths' and not `TeX-add-symbol'.
+
 2015-09-26  Mosè Giordano  <address@hidden>
 
        * tex.el (TeX-search-files-kpathsea): Remove duplicates
diff --git a/style/longtable.el b/style/longtable.el
index 353336d..3363119 100644
--- a/style/longtable.el
+++ b/style/longtable.el
@@ -1,6 +1,6 @@
 ;;; longtable.el --- AUCTeX style for `longtable.sty'.
 
-;; Copyright (C) 2013, 2014  Free Software Foundation, Inc.
+;; Copyright (C) 2013--2015  Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mosè Giordano <address@hidden>
@@ -58,12 +58,7 @@
                          (LaTeX-newline)
                          (indent-according-to-mode)))))))
    (TeX-add-symbols
-    ;; Parameters
-    '("LTleft" 0)
-    '("LTright" 0)
-    '("LTpre" 0)
-    '("LTpost" 0)
-    '("LTcapwidth" 0)
+    ;; Parameter
     '("LTchunksize" 0)
     ;; Commands to end table rows
     '("endhead" 0)
@@ -73,6 +68,10 @@
     ;; Caption commands
     '("caption*" 1))
 
+   ;; These parameters are set with \setlength
+   (LaTeX-add-lengths
+    "LTleft" "LTright" "LTpre" "LTpost" "LTcapwidth")
+
    ;; Use the enhanced table formatting
    (add-to-list 'LaTeX-indent-environment-list
                '("longtable" LaTeX-indent-tabular))

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

Summary of changes:
 ChangeLog          |   16 ++++
 Makefile.in        |    2 +-
 style/longtable.el |   13 ++--
 style/newfloat.el  |  220 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 243 insertions(+), 8 deletions(-)
 create mode 100644 style/newfloat.el


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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