emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex dbfb016 19/25: Use active region if it is a logo


From: Tassilo Horn
Subject: [elpa] externals/auctex dbfb016 19/25: Use active region if it is a logo name.
Date: Sun, 21 Mar 2021 11:44:42 -0400 (EDT)

branch: externals/auctex
commit dbfb016dbc7c25e4aee09fc86bdcea8c9b4bc97d
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Use active region if it is a logo name.
    
    * style/hologo.el (LaTeX-hologo--arg-use-region-or-query-logo-name):
    New function for the logo name arg of \hologo and \Hologo.
---
 style/hologo.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/style/hologo.el b/style/hologo.el
index 373ba9d..8f8693c 100644
--- a/style/hologo.el
+++ b/style/hologo.el
@@ -106,17 +106,23 @@
                 "space"  "hyphen" "runtogether"))) ; plainTeX
   "Local key=value options for hologo macros.")
 
+(defun LaTeX-hologo--arg-use-region-or-query-logo-name (optional)
+  (if (and (use-region-p)
+           (member (buffer-substring (region-beginning) (region-end))
+                   LaTeX-hologo-logo-names))
+      ""
+    (TeX-argument-insert
+     (completing-read "Logo name: " LaTeX-hologo-logo-names)
+     optional)))
+
 (TeX-add-style-hook
  "hologo"
  (lambda ()
    (TeX-add-symbols
 
     ;; Insert logo macros
-    '("hologo" (TeX-arg-eval completing-read
-                             "Logo name: " LaTeX-hologo-logo-names))
-
-    '("Hologo" (TeX-arg-eval completing-read
-                             "Logo name: " LaTeX-hologo-logo-names))
+    '("hologo" LaTeX-hologo--arg-use-region-or-query-logo-name)
+    '("Hologo" LaTeX-hologo--arg-use-region-or-query-logo-name)
 
     ;; Setup macros
     '("hologoSetup" (TeX-arg-key-val LaTeX-hologo-key-val-options-global))



reply via email to

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