[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 36a6d80e1b 11/24: Improve query f
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 36a6d80e1b 11/24: Improve query for opt. arguments of \parbox and minipage |
Date: |
Mon, 21 Feb 2022 02:38:46 -0500 (EST) |
branch: externals/auctex
commit 36a6d80e1b159a7d1162a05674587daff8be951c
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Improve query for opt. arguments of \parbox and minipage
* latex.el (LaTeX-env-minipage): Support query for all optional
arguments of minipage environment. Don't use INITIAL-VALUE
argument when reading the width with `TeX-read-string', use
DEFAULT-VALUE instead and indicate the value in the prompt.
(TeX-arg-tb): Add new argument POSLIST which can be used to offer
more sides for completion.
(LaTeX-common-initialization): Use new arguments of `TeX-arg-tb'
for the "parbox" entry.
---
latex.el | 55 +++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 47 insertions(+), 8 deletions(-)
diff --git a/latex.el b/latex.el
index 97eb5b16e4..b0d920294c 100644
--- a/latex.el
+++ b/latex.el
@@ -1290,16 +1290,41 @@ Just like array and tabular."
(defun LaTeX-env-minipage (environment)
"Create new LaTeX minipage or minipage-like ENVIRONMENT."
- (let ((pos (and LaTeX-default-position ; LaTeX-default-position can
+ (let* ((pos (and LaTeX-default-position ; LaTeX-default-position can
; be nil, i.e. do not prompt
- (TeX-read-string "(Optional) Position: "
LaTeX-default-position)))
- (width (TeX-read-string "Width: " LaTeX-default-width)))
+ (completing-read
+ (TeX-argument-prompt t nil "Position")
+ '("t" "b" "c"))))
+ (height (when (and pos (not (string= pos "")))
+ (completing-read (TeX-argument-prompt t nil "Height")
+ ;; A valid length can be a macro
+ ;; or a length of the form
+ ;; <value><dimension>. Input
+ ;; starting with a `\' can be
+ ;; completed with length macros.
+ (mapcar (lambda (elt)
+ (concat TeX-esc (car elt)))
+ (LaTeX-length-list)))))
+ (inner-pos (when (and height (not (string= height "")))
+ (completing-read
+ (TeX-argument-prompt t nil "Inner position")
+ '("t" "b" "c" "s"))))
+ (width (TeX-read-string
+ (TeX-argument-prompt nil nil
+ (concat "Width (default "
+ LaTeX-default-width
+ ")"))
+ nil nil LaTeX-default-width)))
(setq LaTeX-default-position pos)
(setq LaTeX-default-width width)
(LaTeX-insert-environment environment
(concat
(unless (zerop (length pos))
(concat LaTeX-optop pos LaTeX-optcl))
+ (unless (zerop (length height))
+ (concat LaTeX-optop height LaTeX-optcl))
+ (unless (zerop (length inner-pos))
+ (concat LaTeX-optop inner-pos LaTeX-optcl))
(concat TeX-grop width TeX-grcl)))))
(defun LaTeX-env-tabular* (environment)
@@ -2697,14 +2722,24 @@ string."
nil t)
optional))
-(defun TeX-arg-tb (optional &optional prompt)
+(defun TeX-arg-tb (optional &optional prompt poslist)
"Prompt for a LaTeX side with completion.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
-string."
+string. POSLIST contains the positioning characters offered for
+completion. It can be the symbols `center', `stretch' or nil
+with the following completion list:
+ center t, b, c
+ stretch t, b, c, s
+ nil t, b"
(TeX-argument-insert
(completing-read (TeX-argument-prompt optional prompt "Position")
- '(("") ("t") ("b"))
+ (cond ((eq poslist 'center)
+ '("t" "b" "c"))
+ ((eq poslist 'stretch)
+ '("t" "b" "c" "s"))
+ (t
+ '("t" "b")))
nil t)
optional))
@@ -7238,8 +7273,12 @@ function would return non-nil and `(match-string 1)'
would return
'("hspace" TeX-arg-length)
'("mbox" t)
'("newsavebox" TeX-arg-define-savebox)
- '("parbox" [ TeX-arg-tb ] [ "Height" ] [ TeX-arg-tb "Inner position" ]
- "Width" t)
+ '("parbox"
+ [TeX-arg-tb nil center]
+ [TeX-arg-length "Height"]
+ [TeX-arg-tb "Inner position" stretch]
+ (TeX-arg-length "Width")
+ t)
'("raisebox" "Raise" [ "Height above" ] [ "Depth below" ] t)
'("rule" [ "Raise" ] "Width" "Thickness")
'("sbox" TeX-arg-savebox t)
- [AUCTeX-diffs] [elpa] externals/auctex updated (a24ec9d7cb -> 484df614d8), Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 0a2d9be447 01/24: ; Fix some documentations, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex bf03300296 09/24: Add M-RET support for smallmatrix variants, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex afd2691e56 19/24: Update style/ltxdoc.el to class version 2.1d, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 3cd7a352d3 07/24: Add support for indent for environments with alignment, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex ddb0f08ff1 10/24: Add default entries to LaTeX-indent-environment-list (bug#28405), Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 4ad82777c0 08/24: Add new test for indent, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 9073b5e117 03/24: * tex-ispell.el: Skip the arguments of stabular*? environments., Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex efb39c16c0 15/24: Add NEWS item, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 36a6d80e1b 11/24: Improve query for opt. arguments of \parbox and minipage,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 27c91a0336 14/24: Consider environments defined with newfloat package, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 2b91d0cf05 17/24: ; * style/footmisc.el: Fix year in last commit., Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 0744b687b3 02/24: Add macros to skip from caption package, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex b89b8cdd44 18/24: Update footmisc package options to v6.0b, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex c8a176ca7c 22/24: ; Release_13.1, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 497847f193 16/24: Update footmisc package options to v6.0a, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex da5bb8e28d 05/24: Re-run LaTeX when .toc|lof|lot is missing, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex b7c0380473 23/24: Merge commit 'c8a176ca' into externals/auctex, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex 484df614d8 24/24: Release GNU AUCTeX 13.1.0, Tassilo Horn, 2022/02/21
- [AUCTeX-diffs] [elpa] externals/auctex f99edced63 06/24: ; * tex-ispell.el: Fix regexp., Tassilo Horn, 2022/02/21