branch: externals/auctex commit 42f061a05fd2de0f28de50728f9caecd0eccd128 Author: Arash Esbati <ar...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Improve style/amsthm.el * style/amsthm.el (LaTeX-amsthm-theoremstyle-list): Delete variable. (LaTeX-arg-amsthm-fontdecl): Adjust `prompt' in `TeX-argument-prompt' and don't use the 5. argument of `TeX-completing-read-multiple'. (LaTeX-amsthm-auto-cleanup): Remove the part for the deleted `LaTeX-amsthm-theoremstyle-list'. ("amsthm"): Use `LaTeX-add-amsthm-newtheoremstyles' for predefined styles. Adjust the hook for deleted variable. --- style/amsthm.el | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/style/amsthm.el b/style/amsthm.el index b99fda8..569cef9 100644 --- a/style/amsthm.el +++ b/style/amsthm.el @@ -39,11 +39,6 @@ (defvar LaTeX-amsthm-package-options nil "Package options for the amsthm package.") -(defvar LaTeX-amsthm-theoremstyle-list - '(("plain") ("definition") ("remark")) - "List of theorem styles provided by `amsthm.el' and new ones -defined with \"\\newtheoremstyle\".") - (defvar LaTeX-amsthm-fontdecl '(;; family "rmfamily" "sffamily" "ttfamily" @@ -66,10 +61,10 @@ 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 + (fontdecl (mapconcat #'identity (TeX-completing-read-multiple - (TeX-argument-prompt optional prompt "Font") - LaTeX-amsthm-fontdecl nil nil TeX-esc) + (TeX-argument-prompt optional prompt "Font: \\" t) + LaTeX-amsthm-fontdecl) TeX-esc))) (TeX-argument-insert fontdecl optional))) @@ -114,14 +109,9 @@ RefTeX users should customize or add ENVIRONMENT to (defun LaTeX-amsthm-auto-cleanup () "Move parsed results from `LaTeX-auto-amsthm-newtheorem' and -make them available as new environments. Update -`LaTeX-amsthm-theoremstyle-list' with styles defined with -\"\\newtheoremstyle\"." - (dolist (newthm (mapcar 'car (LaTeX-amsthm-newtheorem-list))) - (LaTeX-add-environments (list newthm 'LaTeX-amsthm-env-label))) - (dolist (newthmstyle (LaTeX-amsthm-newtheoremstyle-list)) - (add-to-list (make-local-variable 'LaTeX-amsthm-theoremstyle-list) - newthmstyle))) +make them available as new environments." + (dolist (newthm (mapcar #'car (LaTeX-amsthm-newtheorem-list))) + (LaTeX-add-environments (list newthm 'LaTeX-amsthm-env-label)))) (add-hook 'TeX-auto-prepare-hook #'LaTeX-amsthm-auto-prepare t) (add-hook 'TeX-auto-cleanup-hook #'LaTeX-amsthm-auto-cleanup t) @@ -130,8 +120,14 @@ make them available as new environments. Update (TeX-add-style-hook "amsthm" (lambda () + ;; Add the pre-defined styles: + (LaTeX-add-amsthm-newtheoremstyles "definition" + "plain" + "remark") + (LaTeX-add-environments '("proof" LaTeX-amsthm-env-label)) + (TeX-add-symbols ;; Overrule the defintion in `latex.el': '("newtheorem" @@ -163,8 +159,10 @@ make them available as new environments. Update (format "%s" heading))))) '("theoremstyle" - (TeX-arg-eval completing-read "Style: " - LaTeX-amsthm-theoremstyle-list)) + (TeX-arg-eval completing-read + (TeX-argument-prompt nil nil "Style") + ;; LaTeX-amsthm-theoremstyle-list + (LaTeX-amsthm-newtheoremstyle-list))) "qedhere" "swapnumbers" @@ -174,14 +172,12 @@ make them available as new environments. Update (let ((nthmstyle (TeX-read-string (TeX-argument-prompt nil nil "Style name")))) (LaTeX-add-amsthm-newtheoremstyles nthmstyle) - (add-to-list (make-local-variable 'LaTeX-amsthm-theoremstyle-list) - (list nthmstyle)) (format "%s" nthmstyle)))) (TeX-arg-length "Space above") (TeX-arg-length "Space below") - (LaTeX-arg-amsthm-fontdecl "Body font") + (LaTeX-arg-amsthm-fontdecl "Body font: \\") "Indent amount" - (LaTeX-arg-amsthm-fontdecl "Theorem head font") + (LaTeX-arg-amsthm-fontdecl "Theorem head font: \\") "Punctuation after head" (TeX-arg-length "Space after head") "Theorem head spec"))