[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Gh917+958 add nowarn option to filecontents (#959) (1f06c5ef)

GitHub noreply at github.com
Thu Nov 17 00:05:17 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/1f06c5ef0c5d9e696e9726a86df11c5da67f84e1

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

commit 1f06c5ef0c5d9e696e9726a86df11c5da67f84e1
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Thu Nov 17 00:05:17 2022 +0100

    Gh917+958 add nowarn option to filecontents (#959)
    
    * fix for #917 and #958
    
    * documentation updates
    
    * silent -> nowarn
    
    * one more test that needs updating


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

1f06c5ef0c5d9e696e9726a86df11c5da67f84e1
 base/changes.txt                           |  6 +++++
 base/doc/ltnews37.tex                      | 17 +++++++++++++
 base/ltclass.dtx                           | 23 ++++++++++++++----
 base/testfiles-1run/github-0220.luatex.tlg |  2 +-
 base/testfiles-1run/github-0220.tlg        |  2 +-
 base/testfiles/github-0198.luatex.tlg      |  4 ++--
 base/testfiles/github-0198.tlg             |  4 ++--
 base/testfiles/github-0238.luatex.tlg      |  2 +-
 base/testfiles/github-0238.tlg             |  2 +-
 base/testfiles/github-0256.luatex.tlg      |  6 ++---
 base/testfiles/github-0256.tlg             |  6 ++---
 base/testfiles/github-0415.luatex.tlg      |  2 +-
 base/testfiles/github-0415.tlg             |  2 +-
 base/testfiles/github-0415.xetex.tlg       |  2 +-
 base/testfiles/github-0504.luatex.tlg      |  2 +-
 base/testfiles/github-0504.tlg             |  2 +-
 base/testfiles/github-0917+0958.luatex.tlg | 27 +++++++++++++++++++++
 base/testfiles/github-0917+0958.lvt        | 38 ++++++++++++++++++++++++++++++
 base/testfiles/github-0917+0958.tlg        | 24 +++++++++++++++++++
 base/testfiles/tlb-filename-01.luatex.tlg  |  2 +-
 base/testfiles/tlb-filename-01.tlg         |  2 +-
 21 files changed, 152 insertions(+), 25 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 10dd3636..1ddeed47 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -11,6 +11,12 @@ All changes above are only part of the development branch for the next release.
 ================================================================================
 
 
+2022-11-16  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltclass.dtx:
+	Introduce key 'nowarn' on filecontents (gh/958)
+	Do not show "current dir" in message (gh/917)
+
 2022-11-13  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* doc.dtx:
diff --git a/base/doc/ltnews37.tex b/base/doc/ltnews37.tex
index f22a0be5..9500ae7b 100644
--- a/base/doc/ltnews37.tex
+++ b/base/doc/ltnews37.tex
@@ -194,6 +194,23 @@ desired effect.
 \githubissue{953}
 
 
+\subsection{New key for \env{filecontents}}
+
+The \env{filecontents} environment warns on the terminal if a file
+gets overwritten even if that is intentional,
+e.g., when you write a temporary file over and over again.  To make
+the warning less noisy in this case we added a new \texttt{nowarn} key
+that redirects the overwriting warning to the transcript file. We
+think that some record of the action is still required to help with
+debugging, thus it is not completely silenced. The warning that
+nothing gets written, because the file aready exists (and the
+\texttt{force} key was not used), is not altered and still shows up on
+the terminal.
+%
+\githubissue{958}
+
+
+
 \subsection{A further hook for shipping out pages}
 
 Since October 2020 the shipout process offers a number of hooks to
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index a525b6f5..63c42f6c 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2022/10/22 v1.5e LaTeX Kernel (Class & Package Interface)]
+             [2022/11/16 v1.5f LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -2813,6 +2813,7 @@
 %    unknown option.
 % \changes{v1.3h}{2020/01/28}{Allow spaces in option string and display
 %     only unknown options not the whole option list (gh/256)}
+% \changes{v1.5f}{2022/11/16}{Introduce key 'nowarn' on filecontents (gh/958)}
 %    \begin{macrocode}
 \def\filec at ntents@opt[#1]{%
   \edef\@fortmp{\zap at space#1 \@empty}%
@@ -2821,7 +2822,7 @@
       \csname filec at ntents@\reserved at a\endcsname
     \else
     \@latex at error{Unknown filecontents option \reserved at a}%
-       {Valid options are force (or overwrite), nosearch, noheader}%
+       {Valid options are force (or overwrite), nosearch, noheader, nowarn}%
     \fi}%
   \filec at ntents
 }
@@ -2849,6 +2850,18 @@
 \let\filec at ntents@checkdir\@empty
 \def\filec at ntents@where{exists on the system}
 %    \end{macrocode}
+%    Option \texttt{nowarn} does not show any warning on the terminal
+%    but still writes it to the \texttt{.log}.
+% \changes{v1.5f}{2022/11/16}{Introduce key 'nowarn' on filecontents (gh/958)}
+%    \begin{macrocode}
+\def\filec at ntents@nowarn{%
+  \let\filec at ntents@warning\@latex at note@no at line
+}
+%    \end{macrocode}
+%    By default we show terminal warnings.
+%    \begin{macrocode}
+\let\filec at ntents@warning\@latex at warning@no at line
+%    \end{macrocode}
 %
 %    \begin{macrocode}
 \begingroup%
@@ -2925,6 +2938,8 @@
 %    on the terminal.
 % \changes{v1.3g}{2020/01/27}{Fix typo in error message}
 % \changes{v1.3j}{2020/02/20}{Fix missing quotes around file name (gh/284)}
+% \changes{v1.5f}{2022/11/16}{Introduce key 'nowarn' on filecontents (gh/958)}
+% \changes{v1.5f}{2022/11/16}{Do not show "current dir" in message (gh/917)}
 %    \begin{macrocode}
       \ch at ck7\reserved at c\write\relax%
       \if at filesw%  % Foul ... trying to overwrite \jobname!
@@ -2932,8 +2947,8 @@
         write to the file you are reading from!\MessageBreak%
         Data is written to screen instead.}%
       \else%
-        \@latex at warning@no at line%
-           {Writing or overwriting file `\@currdir\@curr at file'}%
+        \filec at ntents@warning%
+           {Writing or overwriting file `\@curr at file'}%
         \immediate\openout\reserved at c\q at curr@file\relax%
       \fi%
     \fi%
diff --git a/base/testfiles-1run/github-0220.luatex.tlg b/base/testfiles-1run/github-0220.luatex.tlg
index 00df82bb..f36a8b08 100644
--- a/base/testfiles-1run/github-0220.luatex.tlg
+++ b/base/testfiles-1run/github-0220.luatex.tlg
@@ -15,7 +15,7 @@ Reading the file ``github 220 input.tex'' (same result)
 This is from file ``github 220 input''.
 )
 Forcing to writing a file with the same name, should succeed:
-LaTeX Warning: Writing or overwriting file `./github 220 input'.
+LaTeX Warning: Writing or overwriting file `github 220 input'.
 \openout127 = github 220 input.tex
 Reading the file ``github 220 input.tex'' (different result)
 ("./github 220 input.tex"
diff --git a/base/testfiles-1run/github-0220.tlg b/base/testfiles-1run/github-0220.tlg
index 935f76bd..f0afb6ca 100644
--- a/base/testfiles-1run/github-0220.tlg
+++ b/base/testfiles-1run/github-0220.tlg
@@ -15,7 +15,7 @@ Reading the file ``github 220 input.tex'' (same result)
 This is from file ``github 220 input''.
 )
 Forcing to writing a file with the same name, should succeed:
-LaTeX Warning: Writing or overwriting file `./github 220 input'.
+LaTeX Warning: Writing or overwriting file `github 220 input'.
 Reading the file ``github 220 input.tex'' (different result)
 (github 220 input.tex
 This is from the third file ``github 220 input''.
diff --git a/base/testfiles/github-0198.luatex.tlg b/base/testfiles/github-0198.luatex.tlg
index 88a0f16e..be998b91 100644
--- a/base/testfiles/github-0198.luatex.tlg
+++ b/base/testfiles/github-0198.luatex.tlg
@@ -1,8 +1,8 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-LaTeX Warning: Writing or overwriting file `././test-base.sty'.
+LaTeX Warning: Writing or overwriting file `./test-base.sty'.
 \openout127 = ./test-base.sty
-LaTeX Warning: Writing or overwriting file `././test-sub.sty'.
+LaTeX Warning: Writing or overwriting file `./test-sub.sty'.
 \openout127 = ./test-sub.sty
 (test-base.sty (test-sub.sty))
 This should produce: "Done":
diff --git a/base/testfiles/github-0198.tlg b/base/testfiles/github-0198.tlg
index 3693f7bc..c68ef087 100644
--- a/base/testfiles/github-0198.tlg
+++ b/base/testfiles/github-0198.tlg
@@ -1,7 +1,7 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-LaTeX Warning: Writing or overwriting file `././test-base.sty'.
-LaTeX Warning: Writing or overwriting file `././test-sub.sty'.
+LaTeX Warning: Writing or overwriting file `./test-base.sty'.
+LaTeX Warning: Writing or overwriting file `./test-sub.sty'.
 (test-base.sty (test-sub.sty))
 This should produce: "Done":
 Done.
diff --git a/base/testfiles/github-0238.luatex.tlg b/base/testfiles/github-0238.luatex.tlg
index 48ae6210..1577f765 100644
--- a/base/testfiles/github-0238.luatex.tlg
+++ b/base/testfiles/github-0238.luatex.tlg
@@ -1,4 +1,4 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-LaTeX Warning: Writing or overwriting file `./github-0238-0.vrb'.
+LaTeX Warning: Writing or overwriting file `github-0238-0.vrb'.
 \openout127 = github-0238-0.vrb
diff --git a/base/testfiles/github-0238.tlg b/base/testfiles/github-0238.tlg
index 833582f5..3e4e125f 100644
--- a/base/testfiles/github-0238.tlg
+++ b/base/testfiles/github-0238.tlg
@@ -5,4 +5,4 @@ Don't change this file in any respect.
                                                   \fi 
 l. ...\begin{filecontents*}[force]{\jobname-0.vrb}
 (That was another \errmessage.)
-LaTeX Warning: Writing or overwriting file `./github-0238-0.vrb'.
+LaTeX Warning: Writing or overwriting file `github-0238-0.vrb'.
diff --git a/base/testfiles/github-0256.luatex.tlg b/base/testfiles/github-0256.luatex.tlg
index 89681430..c5cd3a03 100644
--- a/base/testfiles/github-0256.luatex.tlg
+++ b/base/testfiles/github-0256.luatex.tlg
@@ -6,10 +6,10 @@ Type  H <return>  for immediate help.
  ...                                              
 l. ......{filecontents}[overwrite, noheader, UNKNOWN]
                                                   {\jobname.xxx}
-Valid options are force (or overwrite), nosearch, noheader
-LaTeX Warning: Writing or overwriting file `./github-0256.xxx'.
+Valid options are force (or overwrite), nosearch, noheader, nowarn
+LaTeX Warning: Writing or overwriting file `github-0256.xxx'.
 \openout127 = github-0256.xxx
 First line: hello = Hello?
-LaTeX Warning: Writing or overwriting file `././github-0256.xxx'.
+LaTeX Warning: Writing or overwriting file `./github-0256.xxx'.
 \openout127 = ./github-0256.xxx
 First line: %% LaTeX2e file `./github-0256.xxx' = some comment line?
diff --git a/base/testfiles/github-0256.tlg b/base/testfiles/github-0256.tlg
index 3bb4b2cb..d18fcd31 100644
--- a/base/testfiles/github-0256.tlg
+++ b/base/testfiles/github-0256.tlg
@@ -6,8 +6,8 @@ Type  H <return>  for immediate help.
  ...                                              
 l. ......ilecontents}[overwrite, noheader, UNKNOWN]
                                                   {\jobname.xxx}
-Valid options are force (or overwrite), nosearch, noheader
-LaTeX Warning: Writing or overwriting file `./github-0256.xxx'.
+Valid options are force (or overwrite), nosearch, noheader, nowarn
+LaTeX Warning: Writing or overwriting file `github-0256.xxx'.
 First line: hello = Hello?
-LaTeX Warning: Writing or overwriting file `././github-0256.xxx'.
+LaTeX Warning: Writing or overwriting file `./github-0256.xxx'.
 First line: %% LaTeX2e file `./github-0256.xxx' = some comment line?
diff --git a/base/testfiles/github-0415.luatex.tlg b/base/testfiles/github-0415.luatex.tlg
index ae140161..1cc4ec8b 100644
--- a/base/testfiles/github-0415.luatex.tlg
+++ b/base/testfiles/github-0415.luatex.tlg
@@ -2,5 +2,5 @@ This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
 LaTeX Info: File `f^^f6^^f6.tex' already exists on the system.
             Not generating it from this source.
-LaTeX Warning: Writing or overwriting file `./f^^f6^^f6.tex'.
+LaTeX Warning: Writing or overwriting file `f^^f6^^f6.tex'.
 \openout127 = f^^f6^^f6.tex
diff --git a/base/testfiles/github-0415.tlg b/base/testfiles/github-0415.tlg
index 45080e56..381c30a1 100644
--- a/base/testfiles/github-0415.tlg
+++ b/base/testfiles/github-0415.tlg
@@ -2,4 +2,4 @@ This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
 LaTeX Info: File `f^^c3^^b6^^c3^^b6.tex' already exists on the system.
             Not generating it from this source.
-LaTeX Warning: Writing or overwriting file `./f^^c3^^b6^^c3^^b6.tex'.
+LaTeX Warning: Writing or overwriting file `f^^c3^^b6^^c3^^b6.tex'.
diff --git a/base/testfiles/github-0415.xetex.tlg b/base/testfiles/github-0415.xetex.tlg
index d79dd0dc..594d4546 100644
--- a/base/testfiles/github-0415.xetex.tlg
+++ b/base/testfiles/github-0415.xetex.tlg
@@ -2,4 +2,4 @@ This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
 LaTeX Info: File `f^^f6^^f6.tex' already exists on the system.
             Not generating it from this source.
-LaTeX Warning: Writing or overwriting file `./f^^f6^^f6.tex'.
+LaTeX Warning: Writing or overwriting file `f^^f6^^f6.tex'.
diff --git a/base/testfiles/github-0504.luatex.tlg b/base/testfiles/github-0504.luatex.tlg
index 8ff0887a..8de6ff2b 100644
--- a/base/testfiles/github-0504.luatex.tlg
+++ b/base/testfiles/github-0504.luatex.tlg
@@ -1,6 +1,6 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-LaTeX Warning: Writing or overwriting file `./myexpl3pkg.sty'.
+LaTeX Warning: Writing or overwriting file `myexpl3pkg.sty'.
 \openout127 = myexpl3pkg.sty
 space catcode before loading myexpl3pkg=10
 (myexpl3pkg.sty
diff --git a/base/testfiles/github-0504.tlg b/base/testfiles/github-0504.tlg
index e145d942..d240b304 100644
--- a/base/testfiles/github-0504.tlg
+++ b/base/testfiles/github-0504.tlg
@@ -1,6 +1,6 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-LaTeX Warning: Writing or overwriting file `./myexpl3pkg.sty'.
+LaTeX Warning: Writing or overwriting file `myexpl3pkg.sty'.
 space catcode before loading myexpl3pkg=10
 (myexpl3pkg.sty
 Package: myexpl3pkg ....-..-.. v... Testing
diff --git a/base/testfiles/github-0917+0958.luatex.tlg b/base/testfiles/github-0917+0958.luatex.tlg
new file mode 100644
index 00000000..b736ccba
--- /dev/null
+++ b/base/testfiles/github-0917+0958.luatex.tlg
@@ -0,0 +1,27 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+LaTeX Warning: Writing or overwriting file `./github-0917+0958-file.tex'.
+\openout127 = ./github-0917+0958-file.tex
+(github-0917+0958-file.tex
+in github-0917+0958-file.tex
+)
+LaTeX Warning: Writing or overwriting file `./././github-0917+0958-file.tex'.
+\openout127 = ./././github-0917+0958-file.tex
+(./github-0917+0958-file.tex
+in ././github-0917+0958-file.tex
+)
+LaTeX Info: File `./github-0917+0958-file.tex' already in current directory.
+            Not generating it from this source.
+(github-0917+0958-file.tex
+in ././github-0917+0958-file.tex
+)
+LaTeX Info: File `./github-0917+0958-file.tex' already in current directory.
+            Not generating it from this source.
+(github-0917+0958-file.tex
+in ././github-0917+0958-file.tex
+)
+LaTeX Info: Writing or overwriting file `./github-0917+0958-file.tex'.
+\openout127 = ./github-0917+0958-file.tex
+(github-0917+0958-file.tex
+in github-0917+0958-file.tex forced nowarn
+)
diff --git a/base/testfiles/github-0917+0958.lvt b/base/testfiles/github-0917+0958.lvt
new file mode 100644
index 00000000..9304145c
--- /dev/null
+++ b/base/testfiles/github-0917+0958.lvt
@@ -0,0 +1,38 @@
+\documentclass{article}
+
+\input{test2e}
+
+\START
+
+\begin{filecontents}[nosearch,force]{\jobname-file.tex}
+\typeout{in \jobname-file.tex}
+\end{filecontents}
+
+\input{\jobname-file.tex}
+
+\begin{filecontents}[nosearch,force]{././\jobname-file.tex}
+\typeout{in ././\jobname-file.tex}
+\end{filecontents}
+
+\input{././\jobname-file.tex}
+
+\begin{filecontents}[nosearch]{\jobname-file.tex}
+\typeout{in \jobname-file.tex not forced}
+\end{filecontents}
+
+\input{\jobname-file.tex}
+
+\begin{filecontents}[nosearch,nowarn]{\jobname-file.tex}
+\typeout{in \jobname-file.tex not forced nowarn}
+\end{filecontents}
+
+\input{\jobname-file.tex}
+
+\begin{filecontents}[nosearch,force,nowarn]{\jobname-file.tex}
+\typeout{in \jobname-file.tex forced nowarn}
+\end{filecontents}
+
+\input{\jobname-file.tex}
+
+
+\END
diff --git a/base/testfiles/github-0917+0958.tlg b/base/testfiles/github-0917+0958.tlg
new file mode 100644
index 00000000..75fa58ff
--- /dev/null
+++ b/base/testfiles/github-0917+0958.tlg
@@ -0,0 +1,24 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+LaTeX Warning: Writing or overwriting file `./github-0917+0958-file.tex'.
+(github-0917+0958-file.tex
+in github-0917+0958-file.tex
+)
+LaTeX Warning: Writing or overwriting file `./././github-0917+0958-file.tex'.
+(./github-0917+0958-file.tex
+in ././github-0917+0958-file.tex
+)
+LaTeX Info: File `./github-0917+0958-file.tex' already in current directory.
+            Not generating it from this source.
+(github-0917+0958-file.tex
+in ././github-0917+0958-file.tex
+)
+LaTeX Info: File `./github-0917+0958-file.tex' already in current directory.
+            Not generating it from this source.
+(github-0917+0958-file.tex
+in ././github-0917+0958-file.tex
+)
+LaTeX Info: Writing or overwriting file `./github-0917+0958-file.tex'.
+(github-0917+0958-file.tex
+in github-0917+0958-file.tex forced nowarn
+)
diff --git a/base/testfiles/tlb-filename-01.luatex.tlg b/base/testfiles/tlb-filename-01.luatex.tlg
index 1753dbd1..1d7d8487 100644
--- a/base/testfiles/tlb-filename-01.luatex.tlg
+++ b/base/testfiles/tlb-filename-01.luatex.tlg
@@ -6,7 +6,7 @@ l. ...\showthe\wd0
 2: no
 > 0.0pt.
 l. ...\showthe\wd0
-LaTeX Warning: Writing or overwriting file `./file here.txt'.
+LaTeX Warning: Writing or overwriting file `file here.txt'.
 \openout127 = file here.txt
 3: yes
 > 0.0pt.
diff --git a/base/testfiles/tlb-filename-01.tlg b/base/testfiles/tlb-filename-01.tlg
index 0aea1de2..e9f104dd 100644
--- a/base/testfiles/tlb-filename-01.tlg
+++ b/base/testfiles/tlb-filename-01.tlg
@@ -6,7 +6,7 @@ l. ...\showthe\wd0
 2: no
 > 0.0pt.
 l. ...\showthe\wd0
-LaTeX Warning: Writing or overwriting file `./file here.txt'.
+LaTeX Warning: Writing or overwriting file `file here.txt'.
 3: yes
 > 0.0pt.
 l. ...\showthe\wd0





More information about the latex3-commits mailing list.