%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
\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

\appendtoks
    \showcontextbanner
    \initializenewlinechar
    \calculatecurrenttime
    \loadsystemfiles
  % \loadoptionfile                       % obsolete, but nice to keep as reference of when/how
    \job_options_get_commandline          % expands some commands
    \job_options_get_ctxfile              % might expand some commands
    \job_options_set_filenames
    \font_preloads_at_every_job
    \settopskip                           % brrr
    \initializemainlanguage
    \initializexmlprocessing              % is this still needed?
    \initializepagebackgrounds
    \initializepagecounters
  % \directsetup{*runtime:options}%       % obsolete as the option file is replaced by a more direct mechanism
  % \directsetup{*runtime:modules}%       % obsolete as the option file is replaced by a more direct mechanism
    \job_options_set_modes
    \job_options_set_modules
    \job_options_set_environments
\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]

\protect \endinput
