branch: elpa
commit 5886c49d94ac761020bf2494afb42677987b3e90
Author: Arash Esbati <[email protected]>
Commit: Mosè Giordano <[email protected]>
Improve the insertation of "macro" environment
* style/doc.el (LaTeX-env-no-comment): Check if argument
`environment' is "macro" and query/insert a name prefixed with
`TeX-esc'.
(LaTeX-doc-after-insert-macrocode): Add "macro" environment.
("doc"): Run `LaTeX-env-no-comment' when "macro" environment is
inserted.
Signed-off-by: Mosè Giordano <[email protected]>
---
style/doc.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/style/doc.el b/style/doc.el
index abd248d..6c98d66 100644
--- a/style/doc.el
+++ b/style/doc.el
@@ -31,7 +31,12 @@
(defun LaTeX-env-no-comment (environment)
"Insert ENVIRONMENT and make sure there is no commented empty line inside."
- (LaTeX-insert-environment environment)
+ (LaTeX-insert-environment environment
+ (when (string-equal environment "macro")
+ (let ((macroname (TeX-read-string
+ (TeX-argument-prompt nil nil
"Macro")
+ TeX-esc)))
+ (format "{%s}" macroname))))
(unless (TeX-active-mark)
(when (save-excursion
(beginning-of-line)
@@ -42,7 +47,7 @@
(defun LaTeX-doc-after-insert-macrocode (env start end)
"Make sure the macrocode environment is properly formatted after insertion."
- (when (TeX-member env '("macrocode" "macrocode*") 'string-equal)
+ (when (TeX-member env '("macro" "macrocode" "macrocode*") 'string-equal)
(save-excursion
(goto-char end)
(skip-chars-backward " \t")
@@ -70,7 +75,7 @@
"theglossary"
'("macrocode" LaTeX-env-no-comment)
'("macrocode*" LaTeX-env-no-comment)
- '("macro" "Macro"))
+ '("macro" LaTeX-env-no-comment))
(TeX-add-symbols
"EnableCrossrefs"
"DisableCrossrefs"