# block re-creation of specific auxiliary files

From time to time I'd like to temporarily disable the creation of some specific auxiliary file. Actual examples have been:

• At a late state of editing a document fixing something in the .toc-file directly was the easiest way to obtain a certain result. (I know that this is ugly and potentially dangerous, but ...)

• Working with reledpar obtaining balanced layouts can require a lot of compilations, each of which can be pretty time consuming. When the result has finally settled (and has been written to auxiliary files) I don't want to break it when I change details in the texts potentially making typos that result in compilation-errors.

\nofiles will help in the first case but will block the creation of all auxiliary files. reledpar's custom files are not affected by \nofiles at all.

Locking the files in question by the operating system works for both cases, but has the disadvantage of throwing "I can't write on file..."-errors that require me to react.

So I am looking for a way to customise \nofiles to only block specific files.

Or could an alternative be to instruct TeX just to give up on writing files that are not writable?

This has a hand edited LOT, leaving every other write untouched (lot writes are redirected to the log file)

\begin{filecontents}{\jobname.lot}
\contentsline {table}{\numberline {1}{HERE ztztztz}}{100}
\contentsline {table}{\numberline {2}{THERE ztztztzzzz}}{200}
\end{filecontents}

\documentclass{article}

\makeatletter
\def\tmplot{lot}
\def\@starttoc#1{%
\begingroup
\makeatletter
\@input{\jobname.#1}%
\if@filesw
\def\tmp{#1}%
\ifx\tmp\tmplot
\expandafter\let\csname tf@#1\endcsname\m@ne
\else
\expandafter\newwrite\csname tf@#1\endcsname
\immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
\fi
\fi
\@nobreakfalse
\endgroup}

\makeatother
\begin{document}

\tableofcontents
\listoftables
\listoffigures

\section{zzz}
z
\begin{table}
\caption{ztztztz}
\end{table}
\begin{figure}
\caption{zfzfzfz}
\end{figure}

\section{zzz}
z
\begin{table}
\caption{ztztztzzzz}
\end{table}
\begin{figure}
\caption{zfzfzfzzzz}
\end{figure}

\end{document}