branch: elpa
commit 58386b9b16a17a486342cb272f46acbee44af5de
Author: Arash Esbati <[email protected]>
Commit: Mosè Giordano <[email protected]>
Improve font related queries
* style/ntheorem.el (LaTeX-ntheorem-fontdecl): Do not prefix the
elements with `TeX-esc'.
(LaTeX-arg-ntheorem-fontdecl): New function.
("ntheorem"): Use `LaTeX-arg-ntheorem-fontdecl' for font related
queries.
Signed-off-by: Mosè Giordano <[email protected]>
---
style/ntheorem.el | 49 ++++++++++++++++++++++++++++---------------------
1 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/style/ntheorem.el b/style/ntheorem.el
index cedc5a8..630c09b 100644
--- a/style/ntheorem.el
+++ b/style/ntheorem.el
@@ -49,21 +49,34 @@ defined with \"\\newtheoremstyle\".")
defined with \"\\newtheoremlisttype\".")
(defvar LaTeX-ntheorem-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-ntheorem-fontdecl (optional &optional prompt)
+ "Prompt for font declaration commands in \"\\theorem(body\|header)font\".
+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
declaration")
+ LaTeX-ntheorem-fontdecl nil nil TeX-esc)
+ TeX-esc)))
+ (TeX-argument-insert fontdecl optional)))
+
(defun LaTeX-ntheorem-env-label (environment)
"Insert ENVIRONMENT, query for an optional argument and prompt
for label. AUCTeX users should add ENVIRONMENT to
@@ -190,16 +203,10 @@ make them available as new environments. Update
LaTeX-ntheorem-theoremstyle-list))
'("theorembodyfont"
- (TeX-arg-eval mapconcat 'identity
- (TeX-completing-read-multiple
- "Body font: "
- LaTeX-ntheorem-fontdecl) ""))
+ (LaTeX-arg-ntheorem-fontdecl "Body font"))
'("theoremheaderfont"
- (TeX-arg-eval mapconcat 'identity
- (TeX-completing-read-multiple
- "Header font: "
- LaTeX-ntheorem-fontdecl) ""))
+ (LaTeX-arg-ntheorem-fontdecl "Header font"))
'("theoremnumbering"
(TeX-arg-eval completing-read