[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 40ba5b6 37/67: Improve handling o
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 40ba5b6 37/67: Improve handling of `TeX-insert-macro-default-style' in styles |
Date: |
Fri, 8 Feb 2019 11:40:36 -0500 (EST) |
branch: externals/auctex
commit 40ba5b6ca1623bc270d14eaeb5a9f6a197a3ced2
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Improve handling of `TeX-insert-macro-default-style' in styles
* latex.el (LaTeX-check-insert-macro-default-style): Add new
macro. This macro is intended for more complex functions in style
files querying multiple optional and mandatory arguments and
obeying the values of `TeX-insert-macro-default-style' and
`current-prefix-arg'.
* tex.el (TeX-parse-arguments): Add a comment about the new macro.
* style/bicaption.el (LaTeX-arg-bicaption-bicaption):
* style/caption.el (LaTeX-arg-caption-captionbox):
* style/color.el (TeX-arg-color, TeX-arg-color-fcolorbox):
* style/floatrow.el (LaTeX-floatrow-arg-floatbox):
* style/xcolor.el (TeX-arg-xcolor-definecolor)
(TeX-arg-xcolor-definecolorset, TeX-arg-xcolor)
(TeX-arg-xcolor-fcolorbox): Use
`LaTeX-check-insert-macro-default-style'.
---
latex.el | 20 +++++
style/bicaption.el | 30 +++++---
style/caption.el | 31 ++++----
style/color.el | 218 ++++++++++++++++++++++++++++-------------------------
style/floatrow.el | 45 ++++++-----
style/xcolor.el | 64 ++++++++++------
tex.el | 3 +
7 files changed, 243 insertions(+), 168 deletions(-)
diff --git a/latex.el b/latex.el
index b1d2901..3b8cc5c 100644
--- a/latex.el
+++ b/latex.el
@@ -6620,6 +6620,26 @@ function would return non-nil and `(match-string 1)'
would return
(1+ any-col)
beg-col))))))))
+;; Utilities:
+
+(defmacro LaTeX-check-insert-macro-default-style (&rest body)
+ "Check for values of `TeX-insert-macro-default-style' and
`current-prefix-arg'.
+This is a utility macro with code taken from
+`TeX-parse-arguments'. It should be used inside more complex
+function within AUCTeX style files where optional and mandatory
+arguments are queried and inserted. For examples, check the
+functions `TeX-arg-color' (style/color.el) or
+`LaTeX-arg-bicaption-bicaption' (style/bicaption.el)."
+ `(unless (if (eq TeX-insert-macro-default-style 'show-all-optional-args)
+ (equal current-prefix-arg '(4))
+ (or
+ (and (eq TeX-insert-macro-default-style 'show-optional-args)
+ (equal current-prefix-arg '(4)))
+ (and (eq TeX-insert-macro-default-style 'mandatory-args-only)
+ (null (equal current-prefix-arg '(4))))
+ last-optional-rejected))
+ ,@body))
+
(provide 'latex)
;;; latex.el ends here
diff --git a/style/bicaption.el b/style/bicaption.el
index 47b139b..7bf4d1a 100644
--- a/style/bicaption.el
+++ b/style/bicaption.el
@@ -1,6 +1,6 @@
;;; bicaption.el --- AUCTeX style for `bicaption.sty' (v1.1-158)
-;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2018 Free Software Foundation, Inc.
;; Author: Arash Esbati <address@hidden>
;; Maintainer: address@hidden
@@ -34,6 +34,9 @@
;;; Code:
+(eval-when-compile
+ (require 'latex))
+
(defvar LaTeX-bicaption-key-val-options
'(("bi-lang" ("first" "second" "both"))
("bi-singlelinecheck" ("false" "no" "off" "0" "true" "yes" "on" "1"))
@@ -50,6 +53,9 @@ If CAP-BOX is non-nil, also query and include optional
arguments
for the box command. If LABEL-INSIDE is non-nil, insert \label
inside the first mandatory argument, otherwise after all
arguments."
+ ;; icaption [<list entry #1>]{<heading #1>}[<list entry #2>]{<heading #2>}
+ ;; icaptionbox[<list entry #1>]{<heading #1>}[<list entry #2>]{<heading #2>}
+ ;; [<width>][<inner-pos>]{<contents>}
(let* (;; isubcaption needs an environment, "minipage" will be
;; popular. If so, check next higher environment to find out
;; where we are
@@ -100,15 +106,19 @@ arguments."
(when cap-box
(let* ((TeX-arg-opening-brace "[")
(TeX-arg-closing-brace "]")
- (width (completing-read (TeX-argument-prompt t nil "Width")
- (mapcar (lambda (elt) (concat TeX-esc (car
elt)))
- (LaTeX-length-list))))
- (inpos (if (and width (not (string-equal width "")))
- (completing-read (TeX-argument-prompt t nil "Inner
position")
- '("c" "l" "r" "s"))
- "")))
- (TeX-argument-insert width t)
- (TeX-argument-insert inpos t)))
+ (last-optional-rejected nil)
+ (width (LaTeX-check-insert-macro-default-style
+ (completing-read (TeX-argument-prompt t nil "Width")
+ (mapcar (lambda (elt) (concat TeX-esc
(car elt)))
+ (LaTeX-length-list)))))
+ (last-optional-rejected (and width (string= width "")))
+ (inpos (LaTeX-check-insert-macro-default-style
+ (if (and width (not (string-equal width "")))
+ (completing-read (TeX-argument-prompt t nil "Inner
position")
+ '("c" "l" "r" "s"))
+ ""))))
+ (and width (TeX-argument-insert width t))
+ (and inpos (TeX-argument-insert inpos t))))
(LaTeX-fill-paragraph)
;; Insert label -- a new line is inserted only if label is there:
(when (and (not label-inside) (not star)
diff --git a/style/caption.el b/style/caption.el
index f23e59d..0b2cac7 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -1,6 +1,6 @@
;;; caption.el --- AUCTeX style for `caption.sty' (v3.3-111)
-;; Copyright (C) 2015--2017 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2018 Free Software Foundation, Inc.
;; Author: Arash Esbati <address@hidden>
;; Maintainer: address@hidden
@@ -35,7 +35,8 @@
;;; Code:
(eval-when-compile
- (require 'cl-lib))
+ (require 'cl-lib)
+ (require 'latex))
;; Needed for auto-parsing.
(require 'tex)
@@ -176,10 +177,10 @@ in `caption'-completions."
(when (and (string-equal key "labelformat")
(boundp 'LaTeX-subcaption-key-val-options))
(cl-pushnew (list "subrefformat"
- (TeX-delete-duplicate-strings (apply #'append
(list val) val-match)))
+ (TeX-delete-duplicate-strings (apply #'append
(list val) val-match)))
opts :test #'equal))
(cl-pushnew (list key (TeX-delete-duplicate-strings (apply
#'append (list val) val-match)))
- opts :test #'equal))
+ opts :test #'equal))
(cl-pushnew (list key (list val)) opts :test #'equal)))
(setq LaTeX-caption-key-val-options-local (copy-alist opts))))
;; Support for environments defined with newfloat.sty: These
@@ -255,15 +256,19 @@ caption, insert only a caption."
(insert TeX-grcl))
(let* ((TeX-arg-opening-brace "[")
(TeX-arg-closing-brace "]")
- (width (completing-read (TeX-argument-prompt t nil "Width")
- (mapcar (lambda (elt) (concat TeX-esc (car
elt)))
- (LaTeX-length-list))))
- (inpos (if (and width (not (string-equal width "")))
- (completing-read (TeX-argument-prompt t nil "Inner
position")
- '("c" "l" "r" "s"))
- "")))
- (TeX-argument-insert width t)
- (TeX-argument-insert inpos t))
+ (last-optional-rejected nil)
+ (width (LaTeX-check-insert-macro-default-style
+ (completing-read (TeX-argument-prompt t nil "Width")
+ (mapcar (lambda (elt) (concat TeX-esc (car
elt)))
+ (LaTeX-length-list)))))
+ (last-optional-rejected (and width (string= width "")))
+ (inpos (LaTeX-check-insert-macro-default-style
+ (if (and width (not (string-equal width "")))
+ (completing-read (TeX-argument-prompt t nil "Inner
position")
+ '("c" "l" "r" "s"))
+ ""))))
+ (and width (TeX-argument-insert width t))
+ (and inpos (TeX-argument-insert inpos t)))
;; Fill the paragraph before inserting {}. We can use
;; `LaTeX-fill-paragraph' without messing up the code since
;;
- [AUCTeX-diffs] [elpa] externals/auctex bbe53ed 53/67: Fix document, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex bbe53ed 53/67: Fix document, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 49720ce 62/67: Remove compatibility code for older emacsen, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 4cfd116 65/67: Add support for w and W column specifiers, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 253e900 25/67: Adjust autoload cookie, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 38f9d72 63/67: Remove compatibility code for older emacsen, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 34eab00 66/67: Improve indenting and filling in "Form" environments, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex f319b9f 60/67: Override some bindings in `TeX-mode-map' in Texinfo mode, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex ca16d88 59/67: Update style/enumitem.el to package version 3.6, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 9d8369a 39/67: ; Silence the compiler in styles for `font-latex-update-font-lock', Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 5147a27 48/67: Revise description about CJK support, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 40ba5b6 37/67: Improve handling of `TeX-insert-macro-default-style' in styles,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 761ffc3 27/67: Remove compatibility code for older emacsen, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex b13bebb 28/67: Remove compatibility code for older emacsen, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 235f93c 46/67: ; Silence the compiler in styles for pstricks, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 3aef308 58/67: Skip macros and environments from pythontex, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 3b5cea2 56/67: Improve completion for \url between url.el and hyperref.el, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 906ac31 55/67: Add new style/pythontex.el, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 33329c3 57/67: ; * doc/auctex.texi (Completion): Fix typo., Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 6e8aa67 41/67: ; Silence the compiler in styles for `font-latex-add-quotes', Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 4fed4a7 64/67: Remove combatibility code for older emasen, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex a4576a1 49/67: ; * tex.el (TeX-math-toggle-off-input-method): Fix doc string., Tassilo Horn, 2019/02/08