[latex3-commits] [git/LaTeX3-latex3-latex3] LaTeX2020: Allow \AtBeginDocument in generic mode (3bfcd0b44)

Joseph Wright joseph.wright at morningstar2.co.uk
Sun Oct 6 12:31:46 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : LaTeX2020
Link       : https://github.com/latex3/latex3/commit/3bfcd0b44f055553563fb15bf25d8e122c130c40

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

commit 3bfcd0b44f055553563fb15bf25d8e122c130c40
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Oct 6 11:25:41 2019 +0100

    Allow \AtBeginDocument in generic mode
    
    This is needed for upcoming changes.


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

3bfcd0b44f055553563fb15bf25d8e122c130c40
 l3backend/CHANGELOG.md        |  4 ++++
 l3backend/l3backend-color.dtx |  6 ++----
 l3kernel/expl3.dtx            |  4 ++--
 l3kernel/l3file.dtx           | 19 +++++++++++--------
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index 77ad3215e..e50a7dbfd 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -6,6 +6,10 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Changed
+
+- Improved functionality in generic mode
+
 ## [2019-09-05]
 
 ### Added
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index e11e68a5d..adc2a5b5f 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -84,7 +84,7 @@
 \cs_new_protected:Npn \@@_backend_pickup:N #1 { }
 \AtBeginDocument
   {
-    \@ifpackageloaded { color }
+    \cs_if_exist:cT { ver at color.sty }
       {
         \cs_set_protected:Npn \@@_backend_pickup:N #1
           {
@@ -104,7 +104,6 @@
         \cs_new_protected:Npn \@@_backend_pickup:w #1 ~ #2 \q_stop #3
           { \tl_set:Nn #3 { #1 ~ #2 } }
       }
-      { }
   }
 %</package>
 %    \end{macrocode}
@@ -182,7 +181,7 @@
 \cs_new_protected:Npn \@@_backend_pickup:N #1 { }
 \AtBeginDocument
   {
-    \@ifpackageloaded { color }
+    \cs_if_exist:cT { ver at color.sty }
       {
         \cs_set_protected:Npn \@@_backend_pickup:N #1
           {
@@ -213,7 +212,6 @@
               }
           }
       }
-      { }
   }
 %</package>
 %    \end{macrocode}
diff --git a/l3kernel/expl3.dtx b/l3kernel/expl3.dtx
index 3c344aa87..ad145dc32 100644
--- a/l3kernel/expl3.dtx
+++ b/l3kernel/expl3.dtx
@@ -1505,12 +1505,12 @@
 % \begin{macro}{\AtBeginDocument}
 % \begin{macro}[int]{\expl at AtBeginDocument}
 %   There are a few uses of \cs{AtBeginDocument} in the package code: the
-%   easiest way around that is to simply do nothing for these. As
+%   easiest way around that is to simply do the code \enquote{now}. As
 %   bundles such as \pkg{miniltx} may have defined \cs{AtBeginDocument}
 %   any existing definition is saved for restoration after the  payload.
 %    \begin{macrocode}
 \let\expl at AtBeginDocument\AtBeginDocument
-\def\AtBeginDocument#1{}%
+\def\AtBeginDocument#1{#1}%
 \expandafter\def\expandafter\l at expl@tidy at tl\expandafter
   {%
     \l at expl@tidy at tl
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 8ab18ce4b..5d7aeaea2 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -3202,14 +3202,17 @@
 % \cs{g_@@_record_seq}.
 %    \begin{macrocode}
 %<*package>
-\AtBeginDocument
-  {
-    \exp_args:NNx \seq_set_from_clist:Nn \l_@@_tmp_seq
-      { \tl_to_str:N \@filelist }
-    \seq_gconcat:NNN
-      \g_@@_record_seq
-      \g_@@_record_seq
-      \l_@@_tmp_seq
+\cs_if_exist:NT \@filelist
+  {
+    \AtBeginDocument
+      {
+        \exp_args:NNx \seq_set_from_clist:Nn \l_@@_tmp_seq
+          { \tl_to_str:N \@filelist }
+        \seq_gconcat:NNN
+          \g_@@_record_seq
+          \g_@@_record_seq
+          \l_@@_tmp_seq
+      }
   }
 %</package>
 %    \end{macrocode}





More information about the latex3-commits mailing list