branch: externals/auctex
commit 52e0dace561924265ecc2bd11e05001ea062bd85
Author: Arash Esbati <[email protected]>
Commit: Arash Esbati <[email protected]>
Improve detecting of rejected optional arguments
* style/bicaption.el (LaTeX-arg-bicaption-bicaption):
* style/caption.el (LaTeX-arg-caption-captionbox):
* style/floatrow.el (LaTeX-floatrow-arg-floatbox):
* style/xcolor.el (TeX-arg-xcolor-fcolorbox): Add an additional
check for detecting if last optional argument was rejected.
---
style/bicaption.el | 3 ++-
style/caption.el | 3 ++-
style/floatrow.el | 10 ++++++----
style/xcolor.el | 3 ++-
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/style/bicaption.el b/style/bicaption.el
index 4281bd1..7bc0a35 100644
--- a/style/bicaption.el
+++ b/style/bicaption.el
@@ -122,7 +122,8 @@ arguments."
(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 "")))
+ (last-optional-rejected (or (not width)
+ (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")
diff --git a/style/caption.el b/style/caption.el
index c8f118d..60e6e5a 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -273,7 +273,8 @@ caption, insert only a caption."
(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 "")))
+ (last-optional-rejected (or (not width)
+ (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")
diff --git a/style/floatrow.el b/style/floatrow.el
index d26ca29..57f58c7 100644
--- a/style/floatrow.el
+++ b/style/floatrow.el
@@ -355,13 +355,15 @@ If OPTIONAL is non-nil, indicate optional argument during
query."
(TeX-argument-prompt t nil "Width")
(mapcar (lambda (x) (concat TeX-esc (car x)))
(LaTeX-length-list)))))
- (last-optional-rejected (and width (string= width "")))
+ (last-optional-rejected (or (not width)
+ (and width (string= width ""))))
(height (LaTeX-check-insert-macro-default-style
(completing-read
(TeX-argument-prompt t nil "Height")
(mapcar (lambda (x) (concat TeX-esc (car x)))
(LaTeX-length-list)))))
- (last-optional-rejected (and height (string= height "")))
+ (last-optional-rejected (or (not height)
+ (and height (string= height ""))))
(vertpos (LaTeX-check-insert-macro-default-style
(if (string= height "")
""
@@ -374,8 +376,8 @@ If OPTIONAL is non-nil, indicate optional argument during
query."
(when (and width (string= width "")
height (not (string= height "")))
(insert "[]"))
- (and (TeX-argument-insert height t))
- (and (TeX-argument-insert vertpos t)))
+ (and height (TeX-argument-insert height t))
+ (and vertpos (TeX-argument-insert vertpos t)))
;; Now query for the (short-)caption. Also check for the
;; float-type; if we're inside (sub)?floatrow*?, then check for the
;; next outer environment:
diff --git a/style/xcolor.el b/style/xcolor.el
index 2d6b3c5..43c5637 100644
--- a/style/xcolor.el
+++ b/style/xcolor.el
@@ -350,7 +350,8 @@ xcolor package.")
(TeX-argument-prompt t nil "(Frame) Color model")
LaTeX-xcolor-color-models)))
;; Set `last-optional-rejected' acc. to `xfrmodel'
- (last-optional-rejected (and xfrmodel (string= xfrmodel "")))
+ (last-optional-rejected (or (not xfrmodel)
+ (and xfrmodel (string= xfrmodel ""))))
(xfrspec (if (or (null xfrmodel)
(string= xfrmodel "")
(string= xfrmodel "named"))