Hi Mosè,

Mosè Giordano <[email protected]> writes:

> Patches installed, thank you so much.

Many thanks for installing them.  I have yet another improvement for
doc.el:

* 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.

Could you please review and install it as well?

Thanks, Arash

>From fc306c2ddefbb896dc01acd57cb4a16073cbf034 Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Fri, 13 May 2016 09:07:53 +0200
Subject: [PATCH] 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.
---
 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"
-- 
2.8.1

_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to