auctex-diffs
[Top][All Lists]
Advanced

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

master 8f70cd52 7/7: Simplify implementation of style/ulem.el


From: Arash Esbati
Subject: master 8f70cd52 7/7: Simplify implementation of style/ulem.el
Date: Thu, 3 Nov 2022 18:04:57 -0400 (EDT)

branch: master
commit 8f70cd521184481b7256d1dd1a1d86c814b76a33
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    Simplify implementation of style/ulem.el
    
    * style/ulem.el (LaTeX-ulem-fontdecl, LaTeX-ulem-fontcmd)
    (TeX-arg-ulem-fontdecl, TeX-arg-ulem-fontcmd)
    (TeX-arg-ulem-useunder): Remove variables and functions.
    ("ulem"): Move the functionality into the style hook.
---
 style/ulem.el | 56 ++++++++++++--------------------------------------------
 1 file changed, 12 insertions(+), 44 deletions(-)

diff --git a/style/ulem.el b/style/ulem.el
index fa9cefb0..f2383e20 100644
--- a/style/ulem.el
+++ b/style/ulem.el
@@ -57,8 +57,18 @@
     ;; \useunder {underline_command}{font_declaration}{font_command}
     ;; replaces occurences of font_declaration and font_command with the
     ;; underline_command
-    '("useunder" TeX-arg-ulem-useunder
-      TeX-arg-ulem-fontdecl TeX-arg-ulem-fontcmd))
+    '("useunder"
+      (TeX-arg-completing-read ("\\uline" "\\uuline" "\\uwave" "\\sout"
+                                "\\xout"  "\\dashuline" "\\dotuline")
+                               "Underline command")
+      (TeX-arg-completing-read ("\\itshape"  "\\bfseries" "\\scshape"
+                                "\\ttfamily" "\\upshape"  "\\mdseries"
+                                "\\rmfamily" "\\sffamily" "\\slshape")
+                               "Font declaration")
+      (TeX-arg-completing-read ("\\textit" "\\textbf" "\\textsc"
+                                "\\texttt" "\\textup" "\\textmd"
+                                "\\textrm" "\\textsf" "\\textsl")
+                               "Font command")))
 
    ;; \ULdepth can be changed with \setlength
    (LaTeX-add-lengths "ULdepth")
@@ -80,48 +90,6 @@
                               'underline-command)))
  TeX-dialect)
 
-(defvar LaTeX-ulem-fontdecl
-  (mapcar (lambda (str) (concat "\\" str))
-          '("itshape" "bfseries" "scshape"
-            "ttfamily" "upshape" "mdseries"
-            "rmfamily" "sffamily" "slshape"))
-  "List of font declaration commands in LaTeX.")
-
-(defvar LaTeX-ulem-fontcmd
-  (mapcar (lambda (str) (concat "\\" str))
-          '("textit" "textbf" "textsc"
-            "texttt" "textup" "textmd"
-            "textrm" "textsf" "textsl"))
-  "List of font commands in LaTeX")
-
-(defun TeX-arg-ulem-fontdecl (optional &optional prompt)
-  "Prompt for the font-declaration un \\useunder."
-  (TeX-argument-insert
-   (completing-read (TeX-argument-prompt
-                     optional prompt "Font declaration")
-                    LaTeX-ulem-fontdecl nil t)
-   optional))
-
-(defun TeX-arg-ulem-fontcmd (optional &optional prompt)
-  "Prompt for the font-declaration un \\useunder."
-  (TeX-argument-insert
-   (completing-read (TeX-argument-prompt
-                     optional prompt "Font command")
-                    LaTeX-ulem-fontcmd nil t)
-   optional))
-
-;; adapted from url.el: TeX-arg-urlstyle
-(defun TeX-arg-ulem-useunder (optional &optional prompt)
-  "Prompt for underline command used in \\useunder."
-  (TeX-argument-insert
-   (completing-read (TeX-argument-prompt optional prompt "Underline command")
-                    (mapcar (lambda (str) (concat "\\" str))
-                            '("uline" "uuline"
-                              "uwave" "sout" "xout"
-                              "dashuline" "dotuline"))
-                    nil t)
-   optional))
-
 (defvar LaTeX-ulem-package-options
   '("UWforbf" "ULforem" "normalbf" "normalem")
   "Package options for the ulem package.")



reply via email to

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