[latex3-commits] [git/LaTeX3-latex3-xcolor] testglobal: correct global color changes (8f03f1b)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Feb 21 13:47:08 CET 2023


Repository : https://github.com/latex3/xcolor
On branch  : testglobal
Link       : https://github.com/latex3/xcolor/commit/8f03f1bfaf0be128226548cce6e6f57f8e756abd

>---------------------------------------------------------------

commit 8f03f1bfaf0be128226548cce6e6f57f8e756abd
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Feb 21 13:47:08 2023 +0100

    correct global color changes


>---------------------------------------------------------------

8f03f1bfaf0be128226548cce6e6f57f8e756abd
 xcolor.dtx | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/xcolor.dtx b/xcolor.dtx
index d633997..8a236a5 100644
--- a/xcolor.dtx
+++ b/xcolor.dtx
@@ -4953,8 +4953,9 @@
 % and setup the l3color:
 %    \begin{macrocode}
       \toks@\expandafter{\@@drv}%
+      \ifx\xglobal@\global \globalcolorstrue\fi
       \edef\@@tmp
-       {\ifglobalcolors\noexpand\XC at store@globalcolor{\@@nam}{{\@@mod}{\@@clr}}\else\xglobal@\fi        
+       {\ifglobalcolors\noexpand\XC at store@globalcolor{\@@nam}{{\@@mod}{\@@clr}}\fi        
         \noexpand\@namedef{\@backslashchar color@\@@nam}%
          {\noexpand\xcolor@{\@@cls}{\the\toks@}{\@@mod}{\@@clr}}%
         \noexpand\XC at expl@color at set@@nnn{\@@nam}{\@@mod}{\@@clr}}%
@@ -5120,9 +5121,11 @@
 \def\XC at c@l at rlet#1#2%
  {\@ifundefinedcolor{#2}%
    {\c at lor@error{`#2'}\let\@@tmp\@empty}%
-   {\ifglobalcolors\extractcolorspecs{#2}\@@mod\@@clr\fi
+   {\ifx\xglobal@\global \globalcolorstrue\fi
+    \ifglobalcolors\extractcolorspecs{#2}\@@mod\@@clr\fi
     \edef\@@tmp
-     {\ifglobalcolors\noexpand\XC at store@globalcolor{#1}{{\@@mod}{\@@clr}}\else\xglobal@\fi
+     {\unexpanded{\XC at smuggle@color\global\let\XC at smuggle@color\relax}%
+      \ifglobalcolors\noexpand\XC at store@globalcolor{#1}{{\@@mod}{\@@clr}}\fi
       \noexpand\XC at let@cc{\@backslashchar color@#1}{\@backslashchar color@#2}%
       \noexpand\XC at expl@color at set@eq@@nn{#1}{#2}}}}
 %    \end{macrocode}
@@ -5520,7 +5523,9 @@
 %    \begin{macrocode}
 \def\XC at declaredcolor
  {\XC at split\XC@@tmp
-  \edef\@@tmp{\noexpand\@undeclaredcolor[\@@mod]{\@@clr}}%
+  \edef\@@tmp{%
+   \unexpanded{\XC at smuggle@color\global\let\XC at smuggle@color\relax}%
+   \noexpand\@undeclaredcolor[\@@mod]{\@@clr}}%
   \expandafter\endgroup\@@tmp}
 %    \end{macrocode}
 %
@@ -6077,13 +6082,15 @@
 %    \begin{macrocode}
 \def\@ifundefinedcolor#1{\@ifundefined{\@backslashchar color@#1}}
 \ExplSyntaxOn
+\tl_new:N\XC at smuggle@color
 \def\@ifundefinedcolor#1{%
   \@ifundefined { \@backslashchar color@#1 }
     {       
       \exp_args:NNe
       \prop_get:NnNTF \g__color_global_prop {#1} \l__color_tmp_tl
         {
-          \exp_last_unbraced:Nno\definecolor{#1}{\l__color_tmp_tl}
+          \tl_gset:Nx\XC at smuggle@color{\exp_not:N\definecolor{#1}\l__color_tmp_tl}
+          \XC at smuggle@color %not sure if needed ...
           \@secondoftwo
         }
         {\@firstoftwo}





More information about the latex3-commits mailing list.