branch: elpa
commit 09cc5d1e170e4a7f85bcacd93b22526e4c425cf1
Author: Arash Esbati <[email protected]>
Commit: Mosè Giordano <[email protected]>
Improve font related queries
* style/amsthm.el (LaTeX-amsthm-fontdecl): Do not prefix the
elements with `TeX-esc'.
(LaTeX-arg-amsthm-fontdecl): New function.
("amsthm"): Use `LaTeX-arg-amsthm-fontdecl' for font related
queries.
Signed-off-by: Mosè Giordano <[email protected]>
---
style/amsthm.el | 50 ++++++++++++++++++++++++++++----------------------
1 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/style/amsthm.el b/style/amsthm.el
index a01cfe3..5c83724 100644
--- a/style/amsthm.el
+++ b/style/amsthm.el
@@ -40,21 +40,34 @@
defined with \"\\newtheoremstyle\".")
(defvar LaTeX-amsthm-fontdecl
- (mapcar (lambda (elt) (concat TeX-esc elt))
- '(;; family
- "rmfamily" "sffamily" "ttfamily"
- ;; series
- "mdseries" "bfseries"
- ;; shape
- "upshape" "itshape" "slshape" "scshape"
- ;; size
- "tiny" "scriptsize" "footnotesize"
- "small" "normalsize" "large"
- "Large" "LARGE" "huge" "Huge"
- ;; reset macro
- "normalfont"))
+ '(;; family
+ "rmfamily" "sffamily" "ttfamily"
+ ;; series
+ "mdseries" "bfseries"
+ ;; shape
+ "upshape" "itshape" "slshape" "scshape"
+ ;; size
+ "tiny" "scriptsize" "footnotesize"
+ "small" "normalsize" "large"
+ "Large" "LARGE" "huge" "Huge"
+ ;; reset macro
+ "normalfont")
"List of font declaration commands for \"\\newtheoremstyle\".")
+(defun LaTeX-arg-amsthm-fontdecl (optional &optional prompt)
+ "Prompt for font declaration commands in \"\\newtheoremstyle\".
+If OPTIONAL is non-nil, insert the resulting value as an optional
+argument. Use PROMPT as the prompt string."
+ ;; `INITIAL-INPUT' (5th argument to `TeX-completing-read-multiple')
+ ;; is hard-coded to `TeX-esc'.
+ (let* ((crm-separator (regexp-quote TeX-esc))
+ (fontdecl (mapconcat 'identity
+ (TeX-completing-read-multiple
+ (TeX-argument-prompt optional prompt "Font")
+ LaTeX-amsthm-fontdecl nil nil TeX-esc)
+ TeX-esc)))
+ (TeX-argument-insert fontdecl optional)))
+
(defun LaTeX-amsthm-env-label (environment)
"Insert ENVIRONMENT, query for an optional argument and prompt
for label. AUCTeX users should add ENVIRONMENT to
@@ -161,16 +174,9 @@ make them available as new environments. Update
(format "%s" nthmstyle))))
(TeX-arg-length "Space above")
(TeX-arg-length "Space below")
- (TeX-arg-eval mapconcat 'identity
- (TeX-completing-read-multiple
- "Body font: "
- LaTeX-amsthm-fontdecl) "")
+ (LaTeX-arg-amsthm-fontdecl "Body font")
"Indent amount"
- (TeX-arg-eval mapconcat 'identity
- (TeX-completing-read-multiple
- "Theorem head font: "
- LaTeX-amsthm-fontdecl) "")
-
+ (LaTeX-arg-amsthm-fontdecl "Theorem head font")
"Punctuation after head"
(TeX-arg-length "Space after head")
"Theorem head spec"))