%D \module
%D   [       file=core-ini,
%D        version=2003.12.01,
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=Additional Initialization,
%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 / Additional Initialization}

%D We will move more code to here, so that we become less dependent of the
%D orde in which modules are loaded.

\unprotect

\everypar  \emptytoks
\neverypar \emptytoks

\appendtoks \flushnotes                  \to \everypar
\appendtoks \synchronizesidefloats       \to \everypar

\appendtoks \checkinlinedirection        \to \everypar

\appendtoks \checkindentation            \to \everypar
\appendtoks \showparagraphnumber         \to \everypar
\appendtoks \flushmargincontents         \to \everypar
\appendtoks \flushcommentanchors         \to \everypar
\appendtoks \synchronizenotes            \to \everypar
\appendtoks \OTRSETshowstatus            \to \everypar
\appendtoks \flushpostponedbookmark      \to \everypar
\appendtoks \registerparoptions          \to \everypar
\appendtoks \flushsyncpositions          \to \everypar
\appendtoks \flushpostponednodedata      \to \everypar
\appendtoks \dohandlerepeatdelimitedtext \to \everypar
\appendtoks \insertparagraphintro        \to \everypar

\appendtoks \flushpostponedbookmark      \to \neverypar
\appendtoks \flushpostponedbookmark      \to \everylistentry

\appendtoks \flushnotes                  \to \everydisplay
\appendtoks \adjustsidefloatdisplaylines \to \everydisplay

\appendtoks \flushsyncpositions          \to \everyheadstart

\appendtoks \flushsyncresets             \to \everyendoftextbody

\appendtoks \ignorespaces                \to \everybeginofpar

\appendtoks \removeunwantedspaces        \to \everyendofpar
%appendtoks \strut                       \to \everyendofpar % option ?
\appendtoks \flushsyncresets             \to \everyendofpar
\appendtoks \setlastlinewidth            \to \everyendofpar % must happen before endgraf
\appendtoks \endgraf                     \to \everyendofpar

% Todo: verbatim, xml, tex, move code to here

\ifx\normalcompound\undefined \let\normalcompound=| \fi

\appendtoks \catcode`|=\@@active \let|\normalcompound \to \everyTEXinputmode
\appendtoks \catcode`|=\@@letter                      \to \everyXMLinputmode

\protect \endinput
