We know that there is an efficient way to delete all output from the EvaluationNotebook[]:
FrontEndTokenExecute["DeleteGeneratedCells"] How is it possible to do the same for pre-existing output only under the EvaluationCell[] in the situation when CellAutoOverwrite -> False and GeneratedCell -> False is set for all output by default:
SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData[All], CellAutoOverwrite -> False, GeneratedCell -> False]}]] Specifically, I would like to do this from CellProlog by setting something like
SetOptions[EvaluationNotebook[], CellProlog :> FrontEndTokenExecute["DeleteGeneratedCells"]] but it should delete only output associated with EvaluationCell[], as it happens with the default settings. What can I use instead of FrontEndTokenExecute["DeleteGeneratedCells"] for this purpose?
I have tried temporarily reverting to the default stylesheet, then evoking PrintTemporary[] (what should cause auto-deletion of pre-existing output). But from CellProlog it doesn't work unfortunately:
SetOptions[EvaluationNotebook[], CellProlog :> ( SetOptions[EvaluationNotebook[], StyleDefinitions -> "Default.nb"]; PrintTemporary[]; SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData[All], GeneratedCell -> False, CellAutoOverwrite -> False]}]])]