>From 74a74a7e7bb03e23178759cb849daf1e64d13259 Mon Sep 17 00:00:00 2001 From: Arash Esbati
Date: Sat, 23 Jan 2016 17:07:52 +0100 Subject: [PATCH 2/4] 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. --- style/ntheorem.el | 49 ++++++++++++++++++++++++++++--------------------- 1 file 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 -- 2.7.0