auctex-diffs
[Top][All Lists]
Advanced

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

master 9b365b74 4/5: Simplify implementation of style/textpos.el


From: Arash Esbati
Subject: master 9b365b74 4/5: Simplify implementation of style/textpos.el
Date: Fri, 4 Nov 2022 08:26:18 -0400 (EDT)

branch: master
commit 9b365b7419b6f972af34ea3dff04151717c1e02d
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    Simplify implementation of style/textpos.el
    
    * style/textpos.el ("textpos"): Use `TeX-arg-conditional' instead
    of `TeX-arg-eval' in the style hook.
---
 style/textpos.el | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/style/textpos.el b/style/textpos.el
index 0f02efb3..50187f92 100644
--- a/style/textpos.el
+++ b/style/textpos.el
@@ -1,6 +1,6 @@
 ;;; textpos.el --- AUCTeX style for `textpos.sty' version v1.7j  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015, 2016, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -87,27 +87,25 @@ them."
     '("TPMargin*" (TeX-arg-length "Margin around textblock"))
 
     ;; We ignore the `\textblock...color' (i.e. without `u') versions
-    '("textblockcolour"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((color (cond ((member "xcolor" (TeX-style-list))
-                             (completing-read "Color name: " 
(LaTeX-xcolor-definecolor-list)))
-                            ((member "color" (TeX-style-list))
-                             (completing-read "Color name: " 
(LaTeX-color-definecolor-list)))
-                            (t
-                             (TeX-read-string "Color name: ")))))
-           (format "%s" color)))))
-
-    '("textblockrulecolour"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((color (cond ((member "xcolor" (TeX-style-list))
-                             (completing-read "Color name: " 
(LaTeX-xcolor-definecolor-list)))
-                            ((member "color" (TeX-style-list))
-                             (completing-read "Color name: " 
(LaTeX-color-definecolor-list)))
-                            (t
-                             (TeX-read-string "Color name: ")))))
-           (format "%s" color)))))
+    `("textblockcolour"
+      (TeX-arg-conditional (TeX-member "\\`x?color\\'" (TeX-style-list) 
#'string-match)
+          ((TeX-arg-completing-read ,(lambda ()
+                                       (or (and (fboundp 
'LaTeX-xcolor-definecolor-list)
+                                                
(LaTeX-xcolor-definecolor-list))
+                                           (and (fboundp 
'LaTeX-color-definecolor-list)
+                                                
(LaTeX-color-definecolor-list))))
+                                    "Color name"))
+        ((TeX-arg-string "Color name"))))
+
+    `("textblockrulecolour"
+      (TeX-arg-conditional (TeX-member "\\`x?color\\'" (TeX-style-list) 
#'string-match)
+          ((TeX-arg-completing-read ,(lambda ()
+                                       (or (and (fboundp 
'LaTeX-xcolor-definecolor-list)
+                                                
(LaTeX-xcolor-definecolor-list))
+                                           (and (fboundp 
'LaTeX-color-definecolor-list)
+                                                
(LaTeX-color-definecolor-list))))
+                                    "Color name"))
+        ((TeX-arg-string "Color name"))))
 
     '("TPshowboxestrue")
     '("TPshowboxesfalse")



reply via email to

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