auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 36a6d80e1b159a7d1162a


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 36a6d80e1b159a7d1162a05674587daff8be951c
Date: Wed, 9 Feb 2022 04:52:45 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  36a6d80e1b159a7d1162a05674587daff8be951c (commit)
      from  ddb0f08ff1adb8a89f2d808dd6109ed535e552b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 36a6d80e1b159a7d1162a05674587daff8be951c
Author: Arash Esbati <arash@gnu.org>
Date:   Wed Feb 9 10:50:11 2022 +0100

    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.

diff --git a/latex.el b/latex.el
index 97eb5b16..b0d92029 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)

-----------------------------------------------------------------------

Summary of changes:
 latex.el | 55 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 47 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]