Mosè Giordano <m...@gnu.org> writes:

Hi Mosè,

> 2015-08-24 22:49 GMT+02:00 Arash Esbati <esb...@gmx.de>:
>
> Regarding `TeX-arg-{opening,closing}-brace' values, we have
> `TeX-gr{op,cl}' variables, avoid using hardcoded "{" and "}".  In
> addition, since there is an `optional' argument you may want to bind
> `TeX-arg-{opening,closing}-brace' to `LaTeX-opt{op,cl}' when
> `optional' is non-nil, but that argument is actually always mandatory
> in real cases so this could be an overkill.

Thanks for your comments.  I went the non overkill route and used
`TeX-gr{op,cl}' straight away.

>> I will clean up the code and make a new patch this weekend.  Reg. the
>> other patches, I could also re-submit them as well.  Just give me a hint
>> how you want to proceed.
>
> It would be great if you manage to resend a full changeset, but
> working with ChangeLog conflicts is a bit tedious.

I know now ;-)  Please find them all attached and thanks for your
patience.

Best, Arash

>From 35b8d6abc249f9d4695945fa4938e2a28d2c9b7d Mon Sep 17 00:00:00 2001
From: Arash Esbati <esb...@gmx.de>
Date: Sun, 30 Aug 2015 15:00:39 +0200
Subject: [PATCH 1/5] Add fontification for `\newcolumntype'.

* style/array.el ("array"): Add fontification for
`\newcolumntype'.
---
 ChangeLog      | 5 +++++
 style/array.el | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 853d5d7..ed15097 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-30  Arash Esbati  <esb...@gmx.de>
+
+	* style/array.el ("array"): Add fontification for
+	`\newcolumntype'.
+
 2015-08-28  Tassilo Horn  <t...@gnu.org>
 
 	* tex.el (TeX-mode-syntax-table): Use punctuation syntax for
diff --git a/style/array.el b/style/array.el
index 058eb92..645371d 100644
--- a/style/array.el
+++ b/style/array.el
@@ -90,7 +90,13 @@ and make it buffer local. "
 
    ;; `array.sty' adds some new column specification letters.
    (set (make-local-variable 'LaTeX-array-column-letters)
-	(concat LaTeX-array-column-letters "m" "b")))
+	(concat LaTeX-array-column-letters "m" "b"))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+	      (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("newcolumntype" "{[{"))
+			      'function)))
  LaTeX-dialect)
 
 (defvar LaTeX-array-package-options nil
-- 
2.5.0

>From f2a87ea1070a2ed2b710ae205e9c20e5df596633 Mon Sep 17 00:00:00 2001
From: Arash Esbati <esb...@gmx.de>
Date: Sun, 30 Aug 2015 15:03:31 +0200
Subject: [PATCH 2/5] Do not indent the content of `Form' environment.

* style/hyperref.el ("hyperref"): Do not indent the content of
`Form' environment.
---
 ChangeLog         | 3 +++
 style/hyperref.el | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ed15097..df7b22a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-08-30  Arash Esbati  <esb...@gmx.de>
 
+	* style/hyperref.el ("hyperref"): Do not indent the content of
+	`Form' environment.
+
 	* style/array.el ("array"): Add fontification for
 	`\newcolumntype'.
 
diff --git a/style/hyperref.el b/style/hyperref.el
index a1eee7c..45d70a1 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, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2013--2015 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <ang...@caeruleus.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -266,6 +266,10 @@
    (LaTeX-add-environments
     '("Form"))
 
+   ;; Do not indent the content of the "Form"-env; it is odd if the
+   ;; whole document is indented.
+   (add-to-list 'LaTeX-indent-environment-list '("Form" current-indentation))
+
    (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")
-- 
2.5.0

>From 33c0061dc0b0a9c243f5f78abd0e44539fb0c1a0 Mon Sep 17 00:00:00 2001
From: Arash Esbati <esb...@gmx.de>
Date: Sun, 30 Aug 2015 15:05:42 +0200
Subject: [PATCH 3/5] Do not indent the content of `filecontents[*]' env.

* style/filecontents.el ("filecontents"): Do not indent the
content of `filecontents[*]' environment.
---
 ChangeLog             | 3 +++
 style/filecontents.el | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index df7b22a..4841e1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-08-30  Arash Esbati  <esb...@gmx.de>
 
+	* style/filecontents.el ("filecontents"): Do not indent the
+	content of `filecontents[*]' environment.
+
 	* style/hyperref.el ("hyperref"): Do not indent the content of
 	`Form' environment.
 
diff --git a/style/filecontents.el b/style/filecontents.el
index 493b6c7..20cfa98 100644
--- a/style/filecontents.el
+++ b/style/filecontents.el
@@ -1,6 +1,6 @@
 ;;; filecontents.el --- AUCTeX style for `filecontents.sty'
 
-;; Copyright (C) 2013, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2013--2015 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <m...@inducks.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -38,7 +38,12 @@
  (lambda ()
    (LaTeX-add-environments
     '("filecontents" LaTeX-env-filecontents)
-    '("filecontents*" LaTeX-env-filecontents)))
+    '("filecontents*" LaTeX-env-filecontents))
+
+   (add-to-list 'LaTeX-indent-environment-list
+		'("filecontents" current-indentation))
+   (add-to-list 'LaTeX-indent-environment-list
+		'("filecontents*" current-indentation)))
  LaTeX-dialect)
 
 (defun LaTeX-env-filecontents (environment)
-- 
2.5.0

>From 2f11467cca8bc45667d9ae1e1d6ecc38d3863516 Mon Sep 17 00:00:00 2001
From: Arash Esbati <esb...@gmx.de>
Date: Sun, 30 Aug 2015 15:08:31 +0200
Subject: [PATCH 4/5] Add new style transparent.el.

* Makefile.in (STYLESRC): Add new style.

* style/transparent.el: New file.
---
 ChangeLog            |  4 ++++
 Makefile.in          |  2 +-
 style/transparent.el | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 style/transparent.el

diff --git a/ChangeLog b/ChangeLog
index 4841e1f..6fcf165 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-08-30  Arash Esbati  <esb...@gmx.de>
 
+	* Makefile.in (STYLESRC): Add new style.
+
+	* style/transparent.el: New file.
+
 	* style/filecontents.el ("filecontents"): Do not indent the
 	content of `filecontents[*]' environment.
 
diff --git a/Makefile.in b/Makefile.in
index 853c2b3..9a3b859 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -150,7 +150,7 @@ STYLESRC = style/prosper.el \
 	   style/mn2e.el      style/colortbl.el  style/attachfile.el \
 	   style/newpxtext.el style/newpxmath.el style/pdfpages.el \
 	   style/mnras.el     style/environ.el   style/textpos.el \
-	   style/vwcol.el
+	   style/vwcol.el     style/transparent.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/style/transparent.el b/style/transparent.el
new file mode 100644
index 0000000..3a7fad5
--- /dev/null
+++ b/style/transparent.el
@@ -0,0 +1,53 @@
+;;; transparent.el --- AUCTeX style for `transparent.sty' (v1.0)
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <esbati'at'gmx.de>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2015-08-15
+;; 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 `transparent.sty' (v1.0) from 2007/01/08.
+;; `transparent.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "transparent"
+ (lambda ()
+   (TeX-add-symbols
+    '("transparent"     "Transparency value (between 0,1)")
+    '("texttransparent" "Transparency value (between 0,1)" t))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+	      (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("transparent"     "{"))
+			      'type-declaration)
+     (font-latex-add-keywords '(("texttransparent" "{{"))
+			      'type-command)))
+ LaTeX-dialect)
+
+(defvar LaTeX-transparent-package-options nil
+  "Package options for the transparent package.")
+
+;;; transparent.el ends here
-- 
2.5.0

>From 3d560317f4a00bcc356b3165b4943c8b32ab4abb Mon Sep 17 00:00:00 2001
From: Arash Esbati <esb...@gmx.de>
Date: Sun, 30 Aug 2015 15:12:26 +0200
Subject: [PATCH 5/5] Add support for undocumented macros `\captionbox[*]'.

* style/caption.el ("caption"): Add support for undocumented
macros `\captionbox[*]'.
(LaTeX-arg-caption-captionbox): New function.
---
 ChangeLog        |  4 ++++
 style/caption.el | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6fcf165..a5f6908 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-08-30  Arash Esbati  <esb...@gmx.de>
 
+	* style/caption.el ("caption"): Add support for undocumented
+	macros `\captionbox[*]'.
+	(LaTeX-arg-caption-captionbox): New function.
+
 	* Makefile.in (STYLESRC): Add new style.
 
 	* style/transparent.el: New file.
diff --git a/style/caption.el b/style/caption.el
index 0ec6c29..448f611 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -190,6 +190,51 @@ suffix of the command."
 	   format name))
     (TeX-argument-insert name optional)))
 
+;; Support for an undocumented feature of caption.sty:
+;; `\captionbox' sets the width of the caption equal to the width of
+;; the contents (a feature provided e.g. by `threeparttable.sty').
+;; The starred version typesets the caption without label and without
+;; entry to the list of figures or tables.
+
+;; The first mandatory argument {<heading>} contains the caption text
+;; and the label.  We use `TeX-insert-macro' to do the job. (Thanks to
+;; M. Giordano for his valuable comments on this!)
+
+;; Syntax:
+;; \captionbox[<list entry>]{<heading>}[<width>][<inner-pos>]{<contents>}
+;; \captionbox*{<heading>}[<width>][<inner-pos>]{<contents>}
+
+(defun LaTeX-arg-caption-captionbox (optional &optional star prompt)
+  "Query for the arguments of `\\captionbox' incl. a label and
+insert them.  If STAR is t, then do not query for a `\\label' and
+insert only a caption."
+  (let ((caption (TeX-read-string
+		  (TeX-argument-prompt optional prompt "Caption"))))
+    (LaTeX-indent-line)
+    (insert TeX-grop caption)
+    (unless star (TeX-insert-macro "label"))
+    (insert TeX-grcl))
+  (let ((width (completing-read (TeX-argument-prompt t prompt "Width")
+				(mapcar (lambda(elt) (concat TeX-esc (car elt)))
+					(LaTeX-length-list))))
+	(inpos (completing-read (TeX-argument-prompt t prompt "Inner position")
+				'("c" "l" "r" "s"))))
+    (cond (;; 2 optional args
+	   (and width (not (string-equal width ""))
+		inpos (not (string-equal inpos "")))
+	   (insert (format "[%s][%s]" width inpos)))
+	  (;; 1st empty opt. arg, 2nd opt. arg
+	   (and (string-equal width "")
+		inpos (not (string-equal inpos "")))
+	   (insert (format "[][%s]" inpos)))
+	  (;; 1st opt. arg, 2nd empty opt. arg
+	   (and width (not (string-equal width ""))
+		(string-equal inpos ""))
+	   (insert (format "[%s]" width)))
+	  (t ; Do nothing if both empty
+	   (ignore))))
+  (LaTeX-fill-paragraph))
+
 (TeX-add-style-hook
  "caption"
  (lambda ()
@@ -240,6 +285,10 @@ suffix of the command."
       (TeX-arg-eval completing-read (TeX-argument-prompt nil nil "Float type")
 		    LaTeX-caption-supported-float-types))
 
+    '("captionbox"  ["List entry"] (LaTeX-arg-caption-captionbox) t)
+
+    '("captionbox*" (LaTeX-arg-caption-captionbox t) t)
+
     '("ContinuedFloat" 0)
 
     '("DeclareCaptionFont"
@@ -286,7 +335,8 @@ suffix of the command."
 	      (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("caption"           "*[{")
 				("captionlistentry"  "[{")
-				("captionof"         "*[{"))
+				("captionof"         "*[{")
+				("captionbox"        "*[{[[{"))
 			      'textual)
      (font-latex-add-keywords '(("captionsetup"                  "*[{")
 				("clearcaptionsetup"             "*[{")
-- 
2.5.0

_______________________________________________
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to