[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 8d7fef3 27/35: Improve styles enumitem.el and ca
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 8d7fef3 27/35: Improve styles enumitem.el and caption.el. |
Date: |
Sun, 22 Mar 2015 09:27:07 +0000 |
branch: externals/auctex
commit 8d7fef32c4ca2adcef822e8b12e56e66fb1a10a4
Author: Arash Esbati <address@hidden>
Commit: Tassilo Horn <address@hidden>
Improve styles enumitem.el and caption.el.
* style/enumitem.el (LaTeX-enumitem-SetEnumitemKey-regexp): Delete
match for the second argument.
(LaTeX-enumitem-SetEnumitemValue-regexp): Delete match for the
third argument.
(LaTeX-arg-SetEnumitemValue): Replace the randomly generated
number with something human-readable.
* style/caption.el (LaTeX-caption-DeclareCaption-regexp): Delete
match for the second argument.
(LaTeX-arg-caption-DeclareCaption): Replace the randomly generated
number with something human-readable.
---
ChangeLog | 14 ++++++++++++++
style/caption.el | 13 ++++++++-----
style/enumitem.el | 19 ++++++++++++-------
3 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a53574a..7e88388 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2015-03-15 Arash Esbati <address@hidden>
+
+ * style/enumitem.el (LaTeX-enumitem-SetEnumitemKey-regexp): Delete
+ match for the second argument.
+ (LaTeX-enumitem-SetEnumitemValue-regexp): Delete match for the
+ third argument.
+ (LaTeX-arg-SetEnumitemValue): Replace the randomly generated
+ number with something human-readable.
+
+ * style/caption.el (LaTeX-caption-DeclareCaption-regexp): Delete
+ match for the second argument.
+ (LaTeX-arg-caption-DeclareCaption): Replace the randomly generated
+ number with something human-readable.
+
2015-03-10 Tassilo Horn <address@hidden>
* tex.el (TeX-style-path): Replace `pushnew' with equivalent code
diff --git a/style/caption.el b/style/caption.el
index f2ea856..c79f562 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -121,14 +121,16 @@ supported by `caption.sty'.")
;; Setup for various \DeclareCaption's:
(TeX-auto-add-type "caption-DeclareCaption" "LaTeX")
+;; The 2. argument to `DeclareCaption[A-Za-z]' contains (La)TeX code.
+;; We deliberately ignore that argument in our regex since it is not
+;; needed for this style and would pollute the auto generated
+;; `docname.el' file.
(defvar LaTeX-caption-DeclareCaption-regexp
`(,(concat "\\\\DeclareCaption\\(Font\\|Format\\|Justification"
"\\|LabelFormat\\|LabelSeparator\\|ListFormat"
"\\|Option\\|Style\\|TextFormat\\)"
"\\*?"
"[ \t\n\r%]*"
- "{\\([^}]+\\)}"
- "[ \t\n\r%]*"
"{\\([^}]+\\)}")
(0 1 2) LaTeX-auto-caption-DeclareCaption)
"Matches the arguments of different `\\DeclareCaption*' from
@@ -175,14 +177,15 @@ standard one."
;; In `LaTeX-caption-DeclareCaption-regexp', we match (0 1 2). When
;; adding a new `Name', we need something unique for `0'-match until
-;; the next `C-c C-n'. We use a random number for this purpose which
-;; will then disappear.
+;; the next `C-c C-n'. We mimic that regex-match bei concat'ing the
+;; elements. It will vanish upon next `C-c C-n'.
(defun LaTeX-arg-caption-DeclareCaption (format)
"Insert various `\\DeclareCaptionFORMAT' commands. FORMAT is
the suffix of the command."
(let ((name (TeX-read-string "Name: ")))
(LaTeX-add-caption-DeclareCaptions
- `(,(number-to-string (random)) ,format ,name))
+ (list (concat "\\DeclareCaption" format "{" name "}")
+ format name))
(format "%s" name)))
(TeX-add-style-hook
diff --git a/style/enumitem.el b/style/enumitem.el
index 760a145..e2fce50 100644
--- a/style/enumitem.el
+++ b/style/enumitem.el
@@ -137,7 +137,7 @@ package.")
(TeX-auto-add-type "enumitem-SetEnumitemKey" "LaTeX")
(defvar LaTeX-enumitem-SetEnumitemKey-regexp
- '("\\\\SetEnumitemKey{\\([^}]+\\)}{\\([^}]+\\)}"
+ '("\\\\SetEnumitemKey{\\([^}]+\\)}"
1 LaTeX-auto-enumitem-SetEnumitemKey)
"Matches the arguments of `\\SetEnumitemKey' from `enumitem'
package.")
@@ -150,9 +150,12 @@ package.")
;; Upon Tassilo's recommendation, we include also `0' so that we can
;; use the function `LaTeX-enumitem-SetEnumitemValue-list' while we
;; make sure that `TeX-auto-list-information' doesn't remove multiple
-;; defined values to a specific key.
+;; defined values to a specific key. For this reason, we also ignore
+;; the 3. argument to the `\SetEnumitemValue' macro (i.e., a third
+;; {\\([^}]+\\)} in regex) so that we don't pollute the generated
+;; `docname.el' with unnecessary (La)TeX code.
(defvar LaTeX-enumitem-SetEnumitemValue-regexp
- '("\\\\SetEnumitemValue{\\([^}]+\\)}{\\([^}]+\\)}{\\([^}]+\\)}"
+ '("\\\\SetEnumitemValue{\\([^}]+\\)}{\\([^}]+\\)}"
(0 1 2) LaTeX-auto-enumitem-SetEnumitemValue)
"Matches the arguments of `\\SetEnumitemValue' from `enumitem'
package.")
@@ -229,11 +232,12 @@ key-val and the first item."
(add-to-list 'LaTeX-enumitem-key-val-options-local (list key))
(LaTeX-add-enumitem-SetEnumitemKeys key)))
-
;; In `LaTeX-enumitem-SetEnumitemValue-regexp', we match (0 1 2).
;; When adding a new `key=val', we need something unique for `0'-match
-;; until the next `C-c C-n'. We use a random number for this purpose
-;; which will then disappear.
+;; until the next `C-c C-n'. We mimic that regex-match bei concat'ing
+;; the elements and pass the result to
+;; `LaTeX-add-enumitem-SetEnumitemValues'. It will vanish upon next
+;; invocation of `C-c C-n'.
(defun LaTeX-arg-SetEnumitemValue (optional &optional prompt)
"Ask for a new value added to an existing key incl. the final
replacement of the value."
@@ -252,7 +256,8 @@ replacement of the value."
(TeX-argument-insert key optional)
(TeX-argument-insert val optional)
(LaTeX-add-enumitem-SetEnumitemValues
- `(,(number-to-string (random)) ,key ,val))))
+ (list (concat "\\SetEnumitemValue{" key "}{" val "}")
+ key val))))
(defun LaTeX-enumitem-update-key-val-options ()
"Update the buffer-local key-val options before offering them
- [elpa] externals/auctex 41c5f9a 24/35: Improve error/warning reporting when file cannot be determined., (continued)
- [elpa] externals/auctex 41c5f9a 24/35: Improve error/warning reporting when file cannot be determined., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex 59f9440 26/35: Fix void-function error occuring if cl is not loaded, Tassilo Horn, 2015/03/22
- [elpa] externals/auctex 4034de2 21/35: New style for caption.sty., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex a2a4777 25/35: Add TeX-after-TeX-LaTeX-command-finished-hook, Tassilo Horn, 2015/03/22
- [elpa] externals/auctex b853739 17/35: Add uninstall rules to Makefiles., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex d23de0a 18/35: Style for bidibeamer which delegates to beamer, Tassilo Horn, 2015/03/22
- [elpa] externals/auctex a375093 20/35: New style enumitem.el, Tassilo Horn, 2015/03/22
- [elpa] externals/auctex 69b02a0 22/35: New style for geometry.sty., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex 003f475 28/35: New style ltablex.el., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex f16c051 31/35: Fix header of style/mn2e.el., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex 8d7fef3 27/35: Improve styles enumitem.el and caption.el.,
Tassilo Horn <=
- [elpa] externals/auctex 6896a4c 32/35: Fix of the fix. Really., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex fd04166 29/35: New style ltxtable.el., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex b1e9217 30/35: Style file for mn2e.cls., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex ca40c6a 33/35: Fix a broken link in documentation., Tassilo Horn, 2015/03/22
- [elpa] externals/auctex 6620d8c 35/35: Merge from upstream master; release 11.88.3, Tassilo Horn, 2015/03/22
- [elpa] externals/auctex 17f5888 34/35: Merge branch 'master' into elpa, Tassilo Horn, 2015/03/22