[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 238dad67f9 04/60: Introduce DEFAU
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 238dad67f9 04/60: Introduce DEFAULT argument in `TeX-arg-length' |
Date: |
Fri, 8 Apr 2022 11:52:45 -0400 (EDT) |
branch: externals/auctex
commit 238dad67f937da217a75518b9fffe734830b530b
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
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.
---
latex.el | 42 ++++++++++++++++++++++++++----------------
style/ltxtable.el | 2 +-
2 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/latex.el b/latex.el
index bfd5b8c605..a5e57b0929 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 51b9b02550..b80eb07034 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
- [AUCTeX-diffs] [elpa] externals/auctex eb4e331bd6 51/60: Add news for new indent feature, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex eb4e331bd6 51/60: Add news for new indent feature, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex a2724f3677 15/60: Don't set syntax-propertize-function in defaults, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex e83ca6a072 57/60: Update style/doc.el to package version 3.0h, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex f9356664c8 23/60: Update documentation, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 78cf12b33c 18/60: ; * doc/auctex.texi: Adjust the year in @copying., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex c731038844 11/60: Improve regexp matching new environments, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 259ffc34c4 12/60: Use DEFAULT argument of `TeX-read-string' in styles, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 0ce906cfc7 32/60: Improve indentation of conditionals, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex b7d45e19c6 22/60: Discard obsolete hook, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 2b11084455 30/60: ; * style/l3doc.el (LaTeX-env-l3doc-function): Delete unused var., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 238dad67f9 04/60: Introduce DEFAULT argument in `TeX-arg-length',
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 7b0cbbb465 38/60: Document feature of []-induced indent, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 4b1c7015ae 45/60: Move contents of tex-buf.el into tex.el, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex e032df90e7 05/60: Fix simultaneity, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex a078fda16b 06/60: ; * doc/auctex.texi (Starting a Command): Delete obosolete comment., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex b1a0d5df74 36/60: ; * style/algpseudocode.el: Fix position of TeX-dialect., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 1bc2630275 20/60: Don't change syntax of ^^A comments in doctex mode (bug#35140), Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex fa8842c626 26/60: Recognize macrocode*? environments in doctex-mode, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 45aff50ff3 48/60: Support \mathcolor in style/x?color.el, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 5d2829aed4 49/60: Remove old defadvices (patch by Stefan Monnier), Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 5cf46ff8e2 52/60: Improve parsing of re-definitions, Tassilo Horn, 2022/04/08