%D \module
%D   [       file=cont-run,
%D        version=2014.12.26,
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=Runner,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Core Macros / Runner}

\registerctxluafile{cont-run}{}

% \enabletrackers[system.synctex.visualize]
% \enabletrackers[system.synctex.xml]
% \enabledirectives[system.synctex.details]
% \setupsynctex[state=start]

\unprotect

\let\synctexsetfilename  \clf_synctexsetfilename
\let\synctexresetfilename\clf_synctexresetfilename
\let\synctexblockfilename\clf_synctexblockfilename

\let\synctexpause   \donothing
\let\synctexresume  \donothing
\let\synctexpushline\donothing
\let\synctexpopline \donothing

\appendtoks\synctexpause \to\everybeforeoutput
\appendtoks\synctexresume\to\everyafteroutput

\unexpanded\def\setupsynctex[#1]%
  {\begingroup
   \getdummyparameters[\c!state=\v!stop,\c!method=\v!max,#1]%
   \edef\p_state{\dummyparameter\c!state}%
   \clf_setupsynctex
      state  {\p_state}%
      method {\dummyparameter\c!method}%
   \relax
   \ifx\p_state\v!start
     \glet\synctexpause   \clf_synctexpause
     \glet\synctexresume  \clf_synctexresume
     \glet\synctexpushline\clf_synctexpushline
     \glet\synctexpopline \clf_synctexpopline
   \fi
   \endgroup}

\unexpanded\def\blocksynctexfile[#1]%
  {\processcommacommand{#1}\synctexblockfilename}

\let\continuewhenmkivmode\relax

\unexpanded\def\continuewhenlmtxmode
  {\starttext
   \startTEXpage[\c!offset=2ex,\c!foregroundstyle=\tttf]%
      This file needs \LuaMetaTeX\ and \ConTeXt\ \LMTX.%
   \stopTEXpage
   \stoptext
   \endinput}

\protect \endinput

