%D \module
%D   [       file=core-def,
%D        version=2002.05.07,
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=Defaults,
%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 / Defaults}

%D Here we collect settings that cannot be done earlier due to
%D depedencies. More code will moved to this module later.

\unprotect

\usesymbols[mis,nav] % no longer mvs preloaded

\setupsymbolset[navigation 1]

\setupinteraction[\c!symbolset=navigation 1]

% what a mess

\everypar  \emptytoks
\neverypar \emptytoks

\appendtoks
  % \flushnotes
    \page_otr_command_synchronize_side_floats % an otr specific command
    \checkindentation
    \showparagraphnumber
    \restoreinterlinepenalty
  % \flushmargincontents
  % \flushcommentanchors
    \flushnotes
    \synchronizenotes
  % \OTRSETshowstatus
    \registerparoptions
  % \flushsyncpositions
    \flushpostponednodedata
    \typo_delimited_repeat
    \insertparagraphintro
    \typo_initial_handle
    \typo_firstline_handle
\to \everypar

\appendtoks
    \flushnotes
\to \everydisplay

% \appendtoks
%     \adjustsidefloatdisplaylines
% \to \everydisplay

% \appendtoks
%     \flushpostponednodedata
% \to \neverypar

% \appendtoks
%     \flushsyncpositions
% \to \everyheadstart

% \appendtoks
%     \flushsyncresets
% \to \everyendoftextbody

\appendtoks
    \ignorespaces
\to \everybeginofpar

\appendtoks
    \removeunwantedspaces
  % \strut                % option ?
  % \flushsyncresets
  % \setlastlinewidth     % gone, will be done in lua
    \endgraf
\to \everyendofpar

% initialization order:

\ifdefined\font_preloads_at_every_job  \else \let\font_preloads_at_every_job \relax \fi
\ifdefined\font_preloads_at_start_text \else \let\font_preloads_at_start_text\relax \fi
\ifdefined\font_preloads_at_stop_text  \else \let\font_preloads_at_stop_text \relax \fi

\appendtoks
    \font_preloads_at_start_text
\to \everystarttext

\appendtoks
    \font_preloads_at_stop_text
\to \everystoptext

% We made \loadoptionfile obsolete: we pass options via the command line to
% luatex now and handle them directly instead of via a file. This also makes
% the next obsolete:
%
% \directsetup{*runtime:options}
% \directsetup{*runtime:modules}

\appendtoks
    \showcontextbanner
    \initializenewlinechar
    \calculatecurrenttime
    \syst_files_load
    % for the moment here (before doc env)
    \setupoutput[pdf]%
    %
    \clf_setdocumentcommandline
    \clf_setdocumentctxfile
    \clf_setdocumentfilenames
    \font_preloads_at_every_job
    \settopskip                           % brrr
    \initializemainlanguage
    \initializepagebackgrounds
    \initializepagecounters
    \clf_setdocumentmodes
    \clf_setdocumentmodules
    \clf_setdocumentenvironments
\to \everyjob

\appendtoks
    \ifarrangingpages\poparrangedpages\fi
\to \everybye

\prependtoks
    \resetallattributes
\to \everybeforeoutput

\appendtoks
    \the\everybackendshipout
\to \everyshipout

\prependtoks
    \the\everylastbackendshipout
\to \everylastshipout

\prependtoks
    \lefttoright
\to \everybeforeoutput

% temporary here:

\unexpanded\def\arg{\mathortext\normalmatharg\normaltextarg}

% might move to \everydump or even disappear:

\nonknuthmode

% brrr

\appendtoks
    \synchronizegloballinespecs
    \synchronizelocallinespecs
\to \everysetupbodyfont

\appendtoks
    \synchronizelocallinespecs
\to \everyswitchtobodyfont

% who knows

% \appendtoks
%     \resetcharacterspacing
% \to \everyhyphenatedurl

% \setbreakpoints[compound]

%D Till we fixed all styles:

\let\\=\crlf

\protect \endinput
