Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gh1150 docstrip #1595

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ to completeness or accuracy and it contains some references to files that are
not part of the distribution.
================================================================================

2024-12-23 Frank Mittelbach <[email protected]>

* docstrip.dtx (subsection{Batchfile commands}):
Check that stream macro (with the name of a file to generate) is not
already used, e.g., as declared preamble (gh/1150)

2024-12-21 Joseph Wright <[email protected]>
* ltoutenc.dtx
Correct \=\i setup in T1 (gh/1587)
Expand Down
12 changes: 12 additions & 0 deletions base/doc/ltnews41.tex
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,18 @@ \subsection{Fix the use of \texttt{localmathalpabets}}
%
\githubissue[s]{1101 1028}

\subsection{\pkg{docstrip}:\ Error if \texttt{.ins} file is problematical}

If a file to generate had the same name as a preamble declared with
\cs{declarepreamble} the preamble definition was overwritten because
the macro used to store it was reused for denoting the output
stream. The same problem happened with postambles declared with
\cs{declarepostamble}. This is now detected and an error message is
issued. To circumvent the issue in that case, simply use a different
macro name for the preamble or postamble.
%
\githubissue{1150}


%\section{Changes to packages in the \pkg{amsmath} category}

Expand Down
35 changes: 32 additions & 3 deletions base/docstrip.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
\catcode`\{=1
\catcode`\}=2
\def\filename{docstrip.dtx}
\def\fileversion{v2.6b}
\def\filedate{2022-09-03}
\def\docdate {2024-02-08}
\def\fileversion{v2.6c}
\def\filedate{2024-12-23}
\def\docdate {2024-12-23}
%%
%
%\iffalse
Expand Down Expand Up @@ -3027,8 +3027,37 @@ Z
% defining preamble for the current file.
% \begin{macrocode}
\def\@fileX#1#2{%
% \end{macrocode}
% If the csname used for the stream has already been defined, e.g.,
% as a preamble or postamble or for some other purposes, chances are
% that turning it into a stream number will break something. We
% therefore generate an error and show the current definition.
% \changes{v2.6c}{2024-12-23}{Check that stream macro is not already
% used (gh/1150)}
% \begin{macrocode}
\ifx#1\relax \else
\errmessage{Command \string#1 for denoting the output \noexpand
\file stream already defined!^^J
\space Current meaning is:^^J^^J\meaning#1^^J^^J
\space Extraction will probably fail - check result}%
\fi
\chardef#1=\stream@closed
\def\curout{#1}%
% \end{macrocode}
% If it matches the name of the current preamble or postable then
% it definitely can't work, so we call that out explicitly:
% \begin{macrocode}
\ifx\curout\currentpreamble
\errmessage{Declared preamble name \string#1 not allowed if
\string\file{\@stripstring#1} is used}%
\fi
\ifx\curout\currentpostamble
\errmessage{Declared postamble name \string#1 not allowed if
\string\file{\@stripstring#1} is used}%
\fi
% \end{macrocode}
%
% \begin{macrocode}
\let\curinfiles\empty
\let\curinnames\empty
\def\curref{\MetaPrefix ^^J%
Expand Down
Loading