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. 238dad67f937da217a755


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 238dad67f937da217a75518b9fffe734830b530b
Date: Fri, 25 Feb 2022 03:37:09 -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  238dad67f937da217a75518b9fffe734830b530b (commit)
      from  0847db39c9326914d05da82128e727d2d67efaeb (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 238dad67f937da217a75518b9fffe734830b530b
Author: Arash Esbati <arash@gnu.org>
Date:   Fri Feb 25 09:35:54 2022 +0100

    Introduce DEFAULT argument in `TeX-arg-length'
    
    * latex.el (TeX-arg-length): Add DEFAULT to argument names list
    which will be passed to `completing-read'.  Adjust how this
    argument is shown in the minibuffer when available.
    Add a default value to "enlargethispage" and "enlargethispage*".
    
    * style/ltxtable.el ("ltxtable"): Use DEFAULT argument of
    `TeX-arg-length' for the table width.

diff --git a/latex.el b/latex.el
index bfd5b8c6..a5e57b09 100644
--- a/latex.el
+++ b/latex.el
@@ -2222,25 +2222,35 @@ list of defined saveboxes."
         (LaTeX-add-saveboxes savebox))
     (TeX-argument-insert savebox optional TeX-esc)))
 
-(defun TeX-arg-length (optional &optional prompt initial-input definition)
+(defun TeX-arg-length (optional &optional prompt initial-input
+                                definition default)
   "Prompt for a LaTeX length.
 If OPTIONAL is non-nil, insert the resulting value as an optional
 argument, otherwise as a mandatory one.  Use PROMPT as the prompt
 string.  If INITIAL-INPUT is non-nil, insert it in the minibuffer
 initially, with point positioned at the end.  If DEFINITION is
-non-nil, the length is added to the list of defined length."
-  (let ((length (completing-read (TeX-argument-prompt optional prompt "Length")
-                                 ;; 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))
-                                 ;; Some macros takes as argument only a length
-                                 ;; macro (e.g., `\setlength' in its first
-                                 ;; argument, and `\newlength'), in this case 
is
-                                 ;; convenient to set `\\' as initial input.
-                                 nil nil initial-input)))
+non-nil, the length is added to the list of defined length.
+DEFAULT is passed to `completing-read', which see."
+  (let ((length
+         (completing-read
+          (TeX-argument-prompt optional
+                               ;; Cater for the case when PROMPT and
+                               ;; DEFAULT are both given:
+                               (if (and prompt default)
+                                   (concat prompt " (default " default ")")
+                                 prompt)
+                               (concat "Length"
+                                       (when (and default (not optional))
+                                         (concat " (default " default ")"))))
+          ;; 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))
+          ;; Some macros takes as argument only a length macro (e.g.,
+          ;; `\setlength' in its first argument, and `\newlength'), in
+          ;; this case is convenient to set `\\' as initial input.
+          nil nil initial-input nil default)))
     (if (and definition (not (zerop (length length))))
         ;; Strip leading TeX-esc from macro name
         (LaTeX-add-lengths (substring length 1)))
@@ -7367,8 +7377,8 @@ function would return non-nil and `(match-string 1)' 
would return
      '("filecontents*" LaTeX-env-contents))
 
     (TeX-add-symbols
-     '("enlargethispage" TeX-arg-length)
-     '("enlargethispage*" TeX-arg-length)
+     '("enlargethispage"  (TeX-arg-length nil nil nil "1.0\\baselineskip"))
+     '("enlargethispage*" (TeX-arg-length nil nil nil "1.0\\baselineskip"))
      '("tabularnewline" [ TeX-arg-length ])
      '("suppressfloats" [ TeX-arg-tb "Suppress floats position" ])
      '("ensuremath" "Math commands")
diff --git a/style/ltxtable.el b/style/ltxtable.el
index 51b9b025..b80eb070 100644
--- a/style/ltxtable.el
+++ b/style/ltxtable.el
@@ -59,7 +59,7 @@ The regexp for the 2. argument is the same as for \"input\" 
and
 
    (TeX-add-symbols
     '("LTXtable"
-      (TeX-arg-length "Width" "1.0\\linewidth")
+      (TeX-arg-length "Width" nil nil "1.0\\linewidth")
       (TeX-arg-eval
        (lambda ()
          (let ((longtable (file-relative-name

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

Summary of changes:
 latex.el          | 42 ++++++++++++++++++++++++++----------------
 style/ltxtable.el |  2 +-
 2 files changed, 27 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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