auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. df0d719f0ceae40d79473


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. df0d719f0ceae40d79473ffbeb3499ef8598f0f9
Date: Fri, 19 Nov 2021 13:49:16 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  df0d719f0ceae40d79473ffbeb3499ef8598f0f9 (commit)
       via  08f5c9e4c96e78806344fe26294ea2fe7158cee8 (commit)
      from  5f67eac8d508402349884ba80808ec0f4722f4fb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit df0d719f0ceae40d79473ffbeb3499ef8598f0f9
Author: Arash Esbati <arash@gnu.org>
Date:   Fri Nov 19 19:48:31 2021 +0100

    Improve handling of key=vals in style/hologo.el
    
    * style/hologo.el ("hologo"): Use `TeX-arg-key-eval' instead of
    more complicated call of `TeX-arg-eval'.

diff --git a/style/hologo.el b/style/hologo.el
index 863b3d4..25f8105 100644
--- a/style/hologo.el
+++ b/style/hologo.el
@@ -1,6 +1,6 @@
 ;;; hologo.el --- AUCTeX style for `hologo.sty' (v1.10)  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2015, 2018, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2021 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -199,25 +199,15 @@
            (format "%s" keyval)))))
 
     ;; Additional user macros
-    '("hologoVariant"
+    `("hologoVariant"
       LaTeX-hologo--arg-use-region-or-query-logo-name
-      (TeX-arg-eval
-       (lambda ()
-         (let ((setup (TeX-read-key-val
-                       nil
-                       (append LaTeX-hologo-key-val-options-local
-                               LaTeX-hologo-key-val-options-global))))
-           (format "%s" setup)))))
+      (TeX-arg-key-val (append ,LaTeX-hologo-key-val-options-local
+                               ,LaTeX-hologo-key-val-options-global)))
 
-    '("HologoVariant"
+    `("HologoVariant"
       LaTeX-hologo--arg-use-region-or-query-logo-name
-      (TeX-arg-eval
-       (lambda ()
-         (let ((setup (TeX-read-key-val
-                       nil
-                       (append LaTeX-hologo-key-val-options-local
-                               LaTeX-hologo-key-val-options-global))))
-           (format "%s" setup)))))
+      (TeX-arg-key-val (append ,LaTeX-hologo-key-val-options-local
+                               ,LaTeX-hologo-key-val-options-global)))
 
     '("hologoList" 0)
 

commit 08f5c9e4c96e78806344fe26294ea2fe7158cee8
Author: Arash Esbati <arash@gnu.org>
Date:   Fri Nov 19 19:45:54 2021 +0100

    Improve handling of key=vals in style/floatrow.el
    
    * style/floatrow.el (LaTeX-floatrow-key-val-options-local)
    (LaTeX-floatrow-update-key-val-options): Remove now unused
    variable and function.
    (LaTeX-floatrow-key-val-options): New function returning key=vals.
    (LaTeX-floatrow-auto-cleanup)
    (LaTeX-floatrow-arg-declare-new-options): Remove call of
    `LaTeX-floatrow-update-key-val-options'.
    ("floatrow"): Call the function `LaTeX-floatrow-key-val-options'
    instead of the variable `LaTeX-floatrow-key-val-options-local'.
    Minor spacing fixes.

diff --git a/style/floatrow.el b/style/floatrow.el
index 5401f2f..be8878f 100644
--- a/style/floatrow.el
+++ b/style/floatrow.el
@@ -1,6 +1,6 @@
 ;;; floatrow.el --- AUCTeX style for `floatrow.sty' (v0.3b)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2017--2020 Free Software Foundation, Inc.
+;; Copyright (C) 2017--2021 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -146,9 +146,74 @@
     ("LTcapwidth" ("table" "contents")))
   "Key=value options for floatrow macros and environments.")
 
-(defvar LaTeX-floatrow-key-val-options-local nil
-  "Buffer-local key=value options for floatrow macros and environments.")
-(make-variable-buffer-local 'LaTeX-floatrow-key-val-options-local)
+(defun LaTeX-floatrow-key-val-options ()
+  "Return an updated list of key=vals from floatrow package."
+  (append
+   (when (LaTeX-floatrow-DeclareNewOption-list)
+     (let ((vcode-keys '("precode" "rowprecode" "midcode" "postcode" 
"rowpostcode"))
+           (sep-keys '("floatrowsep" "capbesidesep"))
+           result)
+       (dolist (keyvals (LaTeX-floatrow-DeclareNewOption-list) result)
+         (let* ((key (cond ((string= (nth 1 keyvals) "FloatStyle")
+                            "style")
+                           ((string= (nth 1 keyvals) "FloatFont")
+                            "font")
+                           ((string= (nth 1 keyvals) "FloatVCode")
+                            "precode")
+                           ((string= (nth 1 keyvals) "ColorBox")
+                            "colorframeset")
+                           ((string= (nth 1 keyvals) "CBoxCorners")
+                            "colorframecorners")
+                           ((string= (nth 1 keyvals) "ObjectSet")
+                            "objectset")
+                           ((string= (nth 1 keyvals) "MarginSet")
+                            "margins")
+                           ((string= (nth 1 keyvals) "FloatSeparators")
+                            "floatrowsep")
+                           ((string= (nth 1 keyvals) "FloatFootnoterule")
+                            "footnoterule")
+                           (t nil)))
+                (val (nth 2 keyvals))
+                (vals-predefined
+                 (cadr (assoc key LaTeX-floatrow-key-val-options)))
+                (vals-parsed (cadr (assoc key result))))
+           ;; Remove entry in `result' if there is one for the `key'.
+           ;; `precode' and `floatrowsep' are special here since they
+           ;; are placeholders for other keys (see above):
+           (cond ((string= key "precode")
+                  (dolist (x vcode-keys)
+                    (when (assoc x result)
+                      (setq result (assq-delete-all (car (assoc x result)) 
result)))))
+                 ((string= key "floatrowsep")
+                  (dolist (x sep-keys)
+                    (when (assoc x result)
+                      (setq result (assq-delete-all (car (assoc x result)) 
result)))))
+                 (t
+                  (when (assoc key result)
+                    (setq result (assq-delete-all (car (assoc key result)) 
result)))))
+           ;; Add the entrie to `result'.  Again, watch for `precode'
+           ;; and `floatrowsep'.  Also delete any dupes:
+           (cond ((string= key "precode")
+                  (dolist (x vcode-keys)
+                    (cl-pushnew (list x (TeX-delete-duplicate-strings
+                                         (append vals-parsed
+                                                 vals-predefined
+                                                 (list val))))
+                                result :test #'equal)))
+                 ((string= key "floatrowsep")
+                  (dolist (x sep-keys)
+                    (cl-pushnew (list x (TeX-delete-duplicate-strings
+                                         (append vals-parsed
+                                                 vals-predefined
+                                                 (list val))))
+                                result :test #'equal)))
+                 (t
+                  (cl-pushnew (list key (TeX-delete-duplicate-strings
+                                         (append vals-parsed
+                                                 vals-predefined
+                                                 (list val))))
+                              result :test #'equal)))))))
+   LaTeX-floatrow-key-val-options))
 
 (defvar LaTeX-floatrow-supported-float-types
   '("figure" "table"                              ; Standard LaTeX
@@ -228,10 +293,6 @@
   ;; Replace initially the way fig & tab env's are inserted:
   (LaTeX-floatrow-env-init)
   ;;
-  ;; Process new key=val options:
-  (when (LaTeX-floatrow-DeclareNewOption-list)
-    (LaTeX-floatrow-update-key-val-options))
-  ;;
   ;; Process new float commands like \ffigbox:
   (when (LaTeX-floatrow-newfloatcommand-list)
     (dolist (cmd (mapcar #'car (LaTeX-floatrow-newfloatcommand-list)))
@@ -291,56 +352,6 @@
 (add-hook 'TeX-auto-cleanup-hook #'LaTeX-floatrow-auto-cleanup t)
 (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
 
-(defun LaTeX-floatrow-update-key-val-options ()
-  "Update buffer-local key-val options before offering for completion."
-  (let ((vcode-keys '("precode" "rowprecode" "midcode" "postcode" 
"rowpostcode"))
-        (sep-keys '("floatrowsep" "capbesidesep")))
-    (dolist (keyvals (LaTeX-floatrow-DeclareNewOption-list))
-      (let* ((key (cond ((string= (nth 1 keyvals) "FloatStyle")
-                         "style")
-                        ((string= (nth 1 keyvals) "FloatFont")
-                         "font")
-                        ((string= (nth 1 keyvals) "FloatVCode")
-                         "precode")
-                        ((string= (nth 1 keyvals) "ColorBox")
-                         "colorframeset")
-                        ((string= (nth 1 keyvals) "CBoxCorners")
-                         "colorframecorners")
-                        ((string= (nth 1 keyvals) "ObjectSet")
-                         "objectset")
-                        ((string= (nth 1 keyvals) "MarginSet")
-                         "margins")
-                        ((string= (nth 1 keyvals) "FloatSeparators")
-                         "floatrowsep")
-                        ((string= (nth 1 keyvals) "FloatFootnoterule")
-                         "footnoterule")
-                        (t nil)))
-             (val (nth 2 keyvals))
-             (val-match (cadr (assoc key 
LaTeX-floatrow-key-val-options-local)))
-             (temp (copy-alist LaTeX-floatrow-key-val-options-local))
-             (opts (cond ((string= key "precode")
-                          (dolist (x vcode-keys)
-                            (setq temp (assq-delete-all (car (assoc x temp)) 
temp)))
-                          temp)
-                         ((string= key "floatrowsep")
-                          (dolist (x sep-keys)
-                            (setq temp (assq-delete-all (car (assoc x temp)) 
temp)))
-                          temp)
-                         (t
-                          (assq-delete-all (car (assoc key temp)) temp)))))
-        (cond ((string= key "precode")
-               (dolist (x vcode-keys)
-                 (cl-pushnew (list x (TeX-delete-duplicate-strings (append 
(list val) val-match)))
-                             opts :test #'equal)))
-              ((string= key "floatrowsep")
-               (dolist (x sep-keys)
-                 (cl-pushnew (list x (TeX-delete-duplicate-strings (append 
(list val) val-match)))
-                             opts :test #'equal)))
-              (t
-               (cl-pushnew (list key (TeX-delete-duplicate-strings (append 
(list val) val-match)))
-                           opts :test #'equal)))
-        (setq LaTeX-floatrow-key-val-options-local (copy-alist opts))))))
-
 (defun LaTeX-floatrow-arg-floatbox (optional)
   "Query and insert arguments of float box commands from floatrow.sty.
 If OPTIONAL is non-nil, indicate optional argument during query."
@@ -477,10 +488,9 @@ a string and corresponds to first parsed element in
     (LaTeX-add-floatrow-DeclareNewOptions
      (list (concat TeX-esc "Declare" key TeX-grop val TeX-grcl)
            key val))
-    (LaTeX-floatrow-update-key-val-options)
     (TeX-argument-insert val optional)
     (TeX-argument-insert
-     (TeX-read-key-val optional LaTeX-floatrow-key-val-options-local) 
optional)))
+     (TeX-read-key-val optional (LaTeX-floatrow-key-val-options)) optional)))
 
 (defun LaTeX-floatrow-arg-newseparatedlabel/ref (optional type)
   "Query and insert user defined label and reference macros from floatrow.sty.
@@ -543,10 +553,6 @@ only the parsed items."
    (TeX-auto-add-regexp LaTeX-floatrow-newseparatedlabel-ref-regexp)
    (TeX-auto-add-regexp LaTeX-floatrow-DeclareNewFloatType-regexp)
 
-   ;; Activate the buffer-local version of key-vals
-   (setq LaTeX-floatrow-key-val-options-local
-         (copy-alist LaTeX-floatrow-key-val-options))
-
    ;; Add pre-defined float commands:
    (LaTeX-add-floatrow-newfloatcommands
     "ffigbox" "fcapside" "ttabbox")
@@ -556,9 +562,9 @@ only the parsed items."
     ;; 2.1 The \floatbox Macro
     ;; \floatbox[<preamble>]{<captype>}[<width>][<height>][<vert 
pos>]{<caption>}{<object>}
     '("floatbox"
-      [ TeX-arg-eval completing-read
-        (TeX-argument-prompt t nil "Preamble")
-        '("\\capbeside" "\\nocapbeside" "\\captop") ]
+      [TeX-arg-eval completing-read
+                    (TeX-argument-prompt t nil "Preamble")
+                    '("\\capbeside" "\\nocapbeside" "\\captop")]
       (TeX-arg-eval completing-read
                     (TeX-argument-prompt nil nil "Float type")
                     LaTeX-floatrow-supported-float-types)
@@ -608,14 +614,14 @@ only the parsed items."
 
     ;; 3 Float Layout Settings
     '("floatsetup"
-      [ TeX-arg-eval completing-read
-        (TeX-argument-prompt t nil "Float type")
-        LaTeX-floatrow-supported-float-types ]
-      (TeX-arg-key-val LaTeX-floatrow-key-val-options-local))
+      [TeX-arg-eval completing-read
+                    (TeX-argument-prompt t nil "Float type")
+                    LaTeX-floatrow-supported-float-types]
+      (TeX-arg-key-val (LaTeX-floatrow-key-val-options)))
 
     ;; 3.2 Settings for Current Float Environment
     '("thisfloatsetup"
-      (TeX-arg-key-val LaTeX-floatrow-key-val-options-local))
+      (TeX-arg-key-val (LaTeX-floatrow-key-val-options)))
 
     ;; 3.3 Clearing of Settings for Current Float Type
     '("clearfloatsetup"

-----------------------------------------------------------------------

Summary of changes:
 style/floatrow.el | 150 ++++++++++++++++++++++++++++--------------------------
 style/hologo.el   |  24 +++------
 2 files changed, 85 insertions(+), 89 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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