Dear all,

please find attached 2 patches against style/ltx-base.el and
style/doc.el:

* style/ltx-base.el ("ltx-base"): Insert a pair of braces after
"DeclareOption*", "AtEndOfPackage", "AtEndOfClass",
"AtBeginDocument" and "AtEndDocument".
Insert a "\relax" after "ProcessOptions".

* style/doc.el ("doc"): Do not indent the content inside the "macro"
environment.
Insert a pair of braces after "DoNotIndex", "StopEventually",
"MacroFont", "AltMacroFont".
Prefix the string read with TeX-esc when inserting
"DescribeMacro", "cmd".
Ask for an argument ("parg", "oarg", "marg", "meta").
Add missing macro "cs".
Delete dups ("MacroFont", "AltMacroFont", "theCodelineNo").
Ask for .fdd and .dtx files to input or include ("DocInput",
"DocInclude").
Add lengths "MacrocodeTopsep", "MacroTopsep", "MacroIndent".

As always, comments are welcome.

Best, Arash

>From afef40b01cc0ab61c5e25e34fbeee37c3f0694fb Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Mon, 9 May 2016 11:36:22 +0200
Subject: [PATCH 1/2] Improve style/doc.el

* style/doc.el ("doc"): Do not indent the content inside the "macro"
environment.
Insert a pair of braces after "DoNotIndex", "StopEventually",
"MacroFont", "AltMacroFont".
Prefix the string read with TeX-esc when inserting
"DescribeMacro", "cmd".
Ask for an argument ("parg", "oarg", "marg", "meta").
Add missing macro "cs".
Delete dups ("MacroFont", "AltMacroFont", "theCodelineNo").
Ask for .fdd and .dtx files to input or include ("DocInput",
"DocInclude").
Add lengths "MacrocodeTopsep", "MacroTopsep", "MacroIndent".
---
 style/doc.el | 63 ++++++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 46 insertions(+), 17 deletions(-)

diff --git a/style/doc.el b/style/doc.el
index 3176368..abd248d 100644
--- a/style/doc.el
+++ b/style/doc.el
@@ -1,6 +1,6 @@
 ;;; doc.el --- AUCTeX style for `doc.sty'
 
-;; Copyright (C) 2004, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2008, 2016 Free Software Foundation, Inc.
 
 ;; Author: Frank Küster <[email protected]>
 ;; Maintainer: [email protected]
@@ -62,6 +62,8 @@
 		'("macrocode" current-indentation))
    (add-to-list 'LaTeX-indent-environment-list
 		'("macrocode*" current-indentation))
+   (add-to-list 'LaTeX-indent-environment-list
+		'("macro" current-indentation))
    (add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-doc-after-insert-macrocode
 	     nil t)
    (LaTeX-add-environments
@@ -72,24 +74,33 @@
    (TeX-add-symbols
     "EnableCrossrefs"
     "DisableCrossrefs"
-    "DoNotIndex"
+    '("DoNotIndex" t)
     "DontCheckModules"
     "CheckModules"
     "Module"
-    '("DescribeMacro" "Macro")
+    '("DescribeMacro" (TeX-arg-eval
+		       (lambda ()
+			 (let ((name (TeX-read-string
+				      (TeX-argument-prompt optional nil "Macro")
+				      TeX-esc)))
+			   (format "%s" name)))))
     '("DescribeEnv" "Environment")
     "verbatim"
     "verb"
-    "parg"
-    "oarg"
-    "marg"
-    "meta"
-    "cmd"
+    '("parg" "Argument")
+    '("oarg" "Argument")
+    '("marg" "Argument")
+    '("meta" "Text")
+    '("cs" "Name")
+    '("cmd" (TeX-arg-eval
+	     (lambda ()
+	       (let ((name (TeX-read-string
+			    (TeX-argument-prompt optional nil "Name")
+			    TeX-esc)))
+		 (format "%s" name)))))
     "makelabel"
-    "MacroFont"
-    "MacroFont"
-    "AltMacroFont"
-    "AltMacroFont"
+    '("MacroFont" t)
+    '("AltMacroFont" t)
     "PrintMacroName"
     "PrintDescribeMacro"
     "PrintDescribeEnv"
@@ -126,7 +137,7 @@
     "GlossaryParms"
     "PrintChanges"
     "AlsoImplementation"
-    "StopEventually"
+    '("StopEventually" t)
     "OnlyDescription"
     "Finale"
     "IndexInput"
@@ -142,16 +153,34 @@
     "CodelineIndex"
     "PageIndex"
     "theCodelineNo"
-    "theCodelineNo"
     "DocstyleParms"
     "MakePercentIgnore"
     "MakePercentComment"
-    "DocInput"
-    "DocInclude"
+    '("DocInput"
+      (TeX-arg-eval
+       (lambda ()
+	 (let ((file (file-relative-name
+		      (read-file-name
+		       "File to input: " nil nil nil nil
+		       (lambda (x)
+			 (string-match "\\.fdd$\\|\\.dtx$" x)))
+		      (TeX-master-directory))))
+	   (format "%s" file)))))
+    '("DocInclude"
+      (TeX-arg-eval
+       (lambda ()
+	 (let ((file (file-relative-name
+		      (read-file-name
+		       "File to include: " nil nil nil nil
+		       (lambda (x)
+			 (string-match "\\.fdd$\\|\\.dtx$" x)))
+		      (TeX-master-directory))))
+	   (format "%s" file)))))
     "GetFileInfo"
     "filename"
     "fileinfo")
-   (TeX-run-style-hooks "shortvrb"))
+   (TeX-run-style-hooks "shortvrb")
+   (LaTeX-add-lengths "MacrocodeTopsep" "MacroTopsep" "MacroIndent"))
  LaTeX-dialect)
 
 ;; Local Variables:
-- 
2.8.1

>From 501483f863a47db243b82e51e8af83b8e6c92b55 Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Mon, 9 May 2016 11:41:24 +0200
Subject: [PATCH 2/2] Insert braces after some macros and \relax after
 \ProcessOptions

* style/ltx-base.el ("ltx-base"): Insert a pair of braces after
"DeclareOption*", "AtEndOfPackage", "AtEndOfClass",
"AtBeginDocument" and "AtEndDocument".
Insert a "\relax" after "ProcessOptions".
---
 style/ltx-base.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/style/ltx-base.el b/style/ltx-base.el
index a586a7a..12f9234 100644
--- a/style/ltx-base.el
+++ b/style/ltx-base.el
@@ -1,6 +1,6 @@
 ;;; ltx-base.el --- AUCTeX style for basic LaTeX commands.
 
-;; Copyright (C) 2004 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2016 Free Software Foundation, Inc.
 
 ;; Author: Frank Küster <[email protected]>
 ;; Maintainer: [email protected]
@@ -48,20 +48,20 @@
      '("DeclareOption" "option" t)
      ;; would be great if DeclareOption RET * RET would give
      ;; \DeclareOption*!
-     "DeclareOption*"
+     '("DeclareOption*" t)
      '("CurrentOption" 0)
      '("PassOptionsToPackage" "option list" "package")
      '("ExecuteOptions" "option list")
-     "ProcessOptions"
+     '("ProcessOptions" (TeX-arg-literal "\\relax"))
      "ProcessOptions*"
      '("OptionNotUsed" 0)
       ;; candidate for opt/mand toggling
      '("RequirePackage" [ "option list" ] "package" [ "release" ])
      '("LoadClass" [ "option list" ] "class" [ "release" ])
-     "AtEndOfPackage"
-     "AtEndOfClass"
-     "AtBeginDocument"
-     "AtEndDocument"
+     '("AtEndOfPackage" t)
+     '("AtEndOfClass" t)
+     '("AtBeginDocument" t)
+     '("AtEndDocument" t)
      '("IfFileExists" "filename" 2)
      '("InputIfFileExists" "filename" 2)
      '("PackageWarning" "name" t)
-- 
2.8.1

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

Reply via email to