From 628da7aa02508a351932702b1631a32195511ee2 Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 22 Sep 2010 14:41:02 +0300 Subject: beta 2010.09.22 12:33 --- scripts/context/lua/mtx-context.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index a22612eeb..cee926a6e 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -637,14 +637,16 @@ end local pdfview -- delayed loading -function scripts.context.openpdf(name) +function scripts.context.openpdf(name,method) pdfview = pdfview or dofile(resolvers.findfile("l-pdfview.lua","tex")) + pdfview.setmethod(method) logs.simple("pdfview methods: %s, current method: %s, MTX_PDFVIEW_METHOD=%s",pdfview.methods(),pdfview.method,os.getenv(pdfview.METHOD) or "") pdfview.open(file.replacesuffix(name,"pdf")) end -function scripts.context.closepdf(name) +function scripts.context.closepdf(name,method) pdfview = pdfview or dofile(resolvers.findfile("l-pdfview.lua","tex")) + pdfview.setmethod(method) pdfview.close(file.replacesuffix(name,"pdf")) end @@ -764,10 +766,11 @@ function scripts.context.run(ctxdata,filename) resultname = nil end -- - if environment.argument("autopdf") or environment.argument("closepdf") then - scripts.context.closepdf(filename) + local pdfview = environment.argument("autopdf") or environment.argument("closepdf") + if pdfview then + scripts.context.closepdf(filename,pdfview) if resultname then - scripts.context.closepdf(resultname) + scripts.context.closepdf(resultname,pdfview) end end -- @@ -880,8 +883,9 @@ function scripts.context.run(ctxdata,filename) scripts.context.purge_job(resultname,true) end -- - if environment.argument("autopdf") then - scripts.context.openpdf(resultname or filename) + local pdfview = environment.argument("autopdf") + if pdfview then + scripts.context.openpdf(resultname or filename,pdfview) end -- if environment.argument("timing") then -- cgit v1.2.3