* Return value of context call @ 2010-07-04 17:39 Marco 2010-07-05 7:41 ` Taco Hoekwater 0 siblings, 1 reply; 5+ messages in thread From: Marco @ 2010-07-04 17:39 UTC (permalink / raw) To: ntg-context Hi, when there's a mistake in the context code then the context call returns »1«. When there's a mistake in the metapost code then the context call returns »0«. This is annoying for me, since I use the return value as indicator for my pdf reader to refresh. This seems like a bug to me. Is there a workaround? Best regards Marco ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Return value of context call 2010-07-04 17:39 Return value of context call Marco @ 2010-07-05 7:41 ` Taco Hoekwater 2010-07-05 10:49 ` Marco 2010-07-14 12:40 ` Hans Hagen 0 siblings, 2 replies; 5+ messages in thread From: Taco Hoekwater @ 2010-07-05 7:41 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Marco On 07/04/2010 07:39 PM, Marco wrote: > Hi, > > when there's a mistake in the context code then the context call > returns »1«. When there's a mistake in the metapost code then the > context call returns »0«. > > This is annoying for me, since I use the return value as indicator for > my pdf reader to refresh. This seems like a bug to me. Is there a > workaround? Like this maybe, this converts metapost errors into a series of tex errors: \startluacode function report_mplib_error (...) local v = string.format(...) tex.sprint(tex.ctxcatcodes,"\\errmessage{") tex.sprint(tex.vrbcatcodes,v) tex.print(tex.ctxcatcodes,"}") end function metapost.reporterror(result) if not result then report_mplib_error("mp error: no result object returned") elseif result.status > 0 then local t, e, l = result.term, result.error, result.log if t and t ~= "" then report_mplib_error("mp terminal: %s",t) end if e then report_mplib_error("mp error: %s",(e=="" and "?") or e) end if not t and not e and l then metapost.lastlog = metapost.lastlog .. "\n" .. l report_mplib_error("mp log: %s",l) else report_mplib_error("mp error: unknown, no error, terminal or log messages") end else return false end return true end \stopluacode ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Return value of context call 2010-07-05 7:41 ` Taco Hoekwater @ 2010-07-05 10:49 ` Marco 2010-07-14 12:40 ` Hans Hagen 1 sibling, 0 replies; 5+ messages in thread From: Marco @ 2010-07-05 10:49 UTC (permalink / raw) To: ntg-context > Like this maybe, this converts metapost errors into a series of tex > errors: > [...] The code works for me. Thank you very much. Can it be added to the core? I think it's sensible behaviour to return ≠0 when an error occurs. That's what users would expect. Kind regards Marco ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Return value of context call 2010-07-05 7:41 ` Taco Hoekwater 2010-07-05 10:49 ` Marco @ 2010-07-14 12:40 ` Hans Hagen 2010-07-14 14:28 ` Marco 1 sibling, 1 reply; 5+ messages in thread From: Hans Hagen @ 2010-07-14 12:40 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Taco Hoekwater, Marco On 5-7-2010 9:41, Taco Hoekwater wrote: > On 07/04/2010 07:39 PM, Marco wrote: >> Hi, >> >> when there's a mistake in the context code then the context call >> returns »1«. When there's a mistake in the metapost code then the >> context call returns »0«. >> >> This is annoying for me, since I use the return value as indicator for >> my pdf reader to refresh. This seems like a bug to me. Is there a >> workaround? > > Like this maybe, this converts metapost errors into a series of tex > errors: > > \startluacode > function report_mplib_error (...) > local v = string.format(...) > tex.sprint(tex.ctxcatcodes,"\\errmessage{") > tex.sprint(tex.vrbcatcodes,v) > tex.print(tex.ctxcatcodes,"}") > end i added something like this as option \enabledirectives[mplib.texerrors] \startMPcode draww fullcircle ; \stopMPcode this then can be set in texmfcnf.lua in the directives table mplib.texerrors = "yes", no beta yet ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Return value of context call 2010-07-14 12:40 ` Hans Hagen @ 2010-07-14 14:28 ` Marco 0 siblings, 0 replies; 5+ messages in thread From: Marco @ 2010-07-14 14:28 UTC (permalink / raw) To: ntg-context On Wed, 14 Jul 2010 14:40:34 +0200, Hans Hagen <pragma@wxs.nl> wrote: > i added something like this as option > > \enabledirectives[mplib.texerrors] > > \startMPcode > draww fullcircle ; > \stopMPcode > > this then can be set in texmfcnf.lua in the directives table > > mplib.texerrors = "yes", Thanks a lot!! Marco ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-07-14 14:28 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-07-04 17:39 Return value of context call Marco 2010-07-05 7:41 ` Taco Hoekwater 2010-07-05 10:49 ` Marco 2010-07-14 12:40 ` Hans Hagen 2010-07-14 14:28 ` Marco
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).