auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/auctex c7de94dc94 24/76: Replace `TeX-arg-eval'


From: Tassilo Horn
Subject: [elpa] externals/auctex c7de94dc94 24/76: Replace `TeX-arg-eval'
Date: Fri, 13 Jan 2023 14:30:58 -0500 (EST)

branch: externals/auctex
commit c7de94dc942f77b4159a5c3fb5d0c57eebe8cc9e
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    Replace `TeX-arg-eval'
    
    * style/doc.el ("doc"): Replace `TeX-arg-eval' with closure.
    For "DocInput", add a check if "l3doc" style is loaded and adjust
    the query accordingly.
    
    * style/l3doc.el ("l3doc"): Remove entry for "DocInput"
    incl. fontification which is done inside "doc.el".
---
 style/doc.el   | 59 ++++++++++++++++++++++++++++++++--------------------------
 style/l3doc.el | 12 ++----------
 2 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/style/doc.el b/style/doc.el
index d57e1e05b1..cb210be346 100644
--- a/style/doc.el
+++ b/style/doc.el
@@ -249,44 +249,52 @@ percent sign at the beginning of a line before
     '("theglossary" LaTeX-env-item))
 
    (TeX-add-symbols
-    ;; 2.1 The driver file
-    '("DocInput"
-      (TeX-arg-eval
-       (lambda ()
+    ;; 2.1 The driver file: Note that `l3doc.el' also loads `doc.el'
+    ;; but `\DocInput' behaves differently.  With `l3doc.el', it takes
+    ;; comma-separated arguments, with `doc.el' it takes only one
+    ;; argument.
+    `("DocInput"
+      (TeX-arg-conditional (member "l3doc" (TeX-style-list))
+          (,(lambda (optional)
+              (let ((file (TeX-read-string
+                           (TeX-argument-prompt optional nil
+                                                (format "File(s) to input 
(default %s)"
+                                                        (buffer-name)))
+                           nil nil (buffer-name))))
+                (TeX-argument-insert file optional))))
+        (,(lambda (optional)
+            (let ((file (file-relative-name
+                         (read-file-name
+                          (TeX-argument-prompt optional nil
+                                               (format "File to input (default 
%s)"
+                                                       (buffer-name)))
+                          nil (buffer-name) nil nil
+                          (lambda (x)
+                            (or (file-directory-p x)
+                                (string-match "\\.\\(fdd\\|dtx\\)\\'" x))))
+                         (TeX-master-directory))))
+              (TeX-argument-insert file optional))))))
+
+    `("IndexInput"
+      ,(lambda (optional)
          (let ((file (file-relative-name
                       (read-file-name
-                       "File to input: " nil nil nil nil
-                       (lambda (x)
-                         (or (file-directory-p x)
-                             (string-match "\\.\\(fdd\\|dtx\\)\\'" x))))
-                      (TeX-master-directory))))
-           (format "%s" file)))))
-
-    '("IndexInput"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((file (file-relative-name
-                      (read-file-name
-                       "File to input: " nil nil nil nil
+                       (TeX-argument-prompt optional nil "File to input")
+                       nil nil nil nil
                        (lambda (x)
                          (or (file-directory-p x)
                              (string-match "\\.\\(tex\\|ltx\\|fdd\\|dtx\\)\\'" 
x))))
                       (TeX-master-directory))))
-           (format "%s" file)))))
+           (TeX-argument-insert file optional))))
 
     ;; 2.2 Package options
     '("SetupDoc" (TeX-arg-completing-read-multiple LaTeX-doc-package-options
                                                    "Options"))
 
     ;; 2.4 Describing the usage of macros and environments
-    '("DescribeMacro"
+    `("DescribeMacro"
       [TeX-arg-completing-read ("noindex" "noprint") "Suppress option"]
-      (TeX-arg-eval
-       (lambda ()
-         (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Macro")
-                      TeX-esc)))
-           (format "%s" name)))))
+      (TeX-arg-string "Macro" ,TeX-esc))
     '("DescribeEnv"
       [TeX-arg-completing-read ("noindex" "noprint") "Suppress option"]
       "Environment")
@@ -434,7 +442,6 @@ percent sign at the beginning of a line before
      (font-latex-add-keywords '(("meta"       "{"))
                               'textual)
      (font-latex-add-keywords '(("DocInput"   "{")
-                                ("DocInclude" "{" )
                                 ("IndexInput" "{"))
                               'reference)))
  TeX-dialect)
diff --git a/style/l3doc.el b/style/l3doc.el
index de11ee0fa3..a13f2179d3 100644
--- a/style/l3doc.el
+++ b/style/l3doc.el
@@ -186,13 +186,7 @@ For syntax environment from l3doc class."
 
     '("NB" "Tag" t)
 
-    '("DocInput"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((file (TeX-read-string
-                      (format "File(s) to include (default %s): " 
(current-buffer))
-                      nil nil (current-buffer))))
-           (format "%s" file)))))
+    ;; "DocInput": This macro is supplied in `doc.el'
 
     ;; 4.5 Describing functions in the implementation
     '("TestFiles" "File(s)")
@@ -245,9 +239,7 @@ For syntax environment from l3doc class."
                                 ("TestFiles"             "{")
                                 ("UnitTested"            "")
                                 ("TestMissing"           "{"))
-                              'function)
-     (font-latex-add-keywords '("DocInput" "{")
-                              'reference)))
+                              'function)))
  TeX-dialect)
 
 (defvar LaTeX-l3doc-class-options




reply via email to

[Prev in Thread] Current Thread [Next in Thread]