diff options
Diffstat (limited to 'tex/context/base/core-uti.lua')
-rw-r--r-- | tex/context/base/core-uti.lua | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua index b6ddf775e..9faf9ad30 100644 --- a/tex/context/base/core-uti.lua +++ b/tex/context/base/core-uti.lua @@ -64,7 +64,8 @@ end job.comment("version",job.version) -local enabled = true +local enabled = true +local initialized = false directives.register("job.save",function(v) enabled = v end) ----------.register("job.keep",function(v) kept = v end) @@ -74,15 +75,24 @@ function job.disablesave() -- can be command end function job.initialize(loadname,savename) - job.load(loadname) -- has to come after structure is defined ! - luatex.registerstopactions(function() - if enabled and not status.lasterrorstring or status.lasterrorstring == "" then - -- if kept then - -- job.keep(loadname) -- could move to mtx-context instead - -- end - job.save(savename) + if not initialized then + if not loadname or loadname == "" then + loadname = tex.jobname .. ".tuc" + end + if not savename or savename == "" then + savename = tex.jobname .. ".tua" end - end) + job.load(loadname) -- has to come after structure is defined ! + luatex.registerstopactions(function() + if enabled and not status.lasterrorstring or status.lasterrorstring == "" then + -- if kept then + -- job.keep(loadname) -- could move to mtx-context instead + -- end + job.save(savename) + end + end) + initialized = true + end end function job.register(collected, tobesaved, initializer, finalizer, serializer) @@ -391,3 +401,13 @@ implement { actions = job.comment, arguments = { { "*" } } } + +implement { + name = "initializejob", + actions = job.initialize +} + +implement { + name = "disablejobsave", + actions = job.disablesave +} |