> > the problem is in your definition of 'end' and 'bottom' > ?? end := end of run bottom := bottom of last page, in this case > > the real final thing is \end and \everygoodbye happens just before that > (the only calls after it are postponed error messages, which have no > consequence for any pdf and the primitive \end which is really needed) > yes, as I seen in \def\stoptext > of course there can be pending conditional branches that needs to be > finished; just try \appendtoks\tracingall\to\everygoodbye > true > > You can also do something > > \startluacode > table.insert(input.stop_actions, function() > texio.write_nl("I still have no clue why you need it.") > end) > \stopluacode > ok thank you -- I like lua code -- > > any other hook in itself will introduce a new situation of 'something done > before the real \end' > exactly what I mean: "any other hook in itself will introduce a new situation of 'something done before the real \end'" that potentially can modify current page . Consider this: between final_cleanup; {prepare for death} and end_of_TEX: close_files_and_terminate; insert {************* MY HACK ************} almost_death ;{I see state, but it's 'frozen' so any modification will never influence pdf or dvi , only to log or terminal or external files} {*******************************************} in almost_death you can do what ever you want -- you will never modify (relevant part of ) state that can influence final pdf or dvi . ================================================== @ Now this is really it: \TeX\ starts and ends here. The initial test involving |ready_already| should be deleted if the \PASCAL\ runtime system is smart enough to detect such a ``mistake.'' @^system dependencies@> @p begin @!{|start_here|} history:=fatal_error_stop; {in case we quit during initialization} t_open_out; {open the terminal for output} if ready_already=314159 then goto start_of_TEX; @@; if bad>0 then begin wterm_ln('Ouch---my internal constants have been clobbered!', '---case ',bad:1); @.Ouch...clobbered@> goto final_end; end; initialize; {set global variables to their starting values} @!init if not get_strings_started then goto final_end; init_prim; {call |primitive| for each primitive} init_str_ptr:=str_ptr; init_pool_ptr:=pool_ptr; fix_date_and_time; tini@/ ready_already:=314159; start_of_TEX: @; @; history:=spotless; {ready to go!} @ main_control; {come to life} final_cleanup; {prepare for death} {************* MY HACK ************} almost_death ;{I see state, but it's 'frozen' so any modification will never influence pdf or dvi , only to log or terminal or external files} {*******************************************} end_of_TEX: close_files_and_terminate; final_end: ready_already:=0; end. ======================================= anyway, as I wrote , this is not bad: \def\LuigisWhateverShouldHappen{\immediate\write16{BOOOM!}Something Luigi want to do for some unknown reason.\immediate\write16{BOOOM!}} \appendtoks\LuigisWhateverShouldHappen \to \everylastshipout \starttext hello \stoptext \LuigisWhateverShouldHappen can be made more robust -- for example you can find a way to nullify "Something...reason." so it doesn't appear on final pdf , and so on -- -- luigi