%#!platex emacsen-common
%%%
%%% emacsen-common
%%% --- Section 3: How emacsen-common works seemlessly
%%% MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
%%% Time-stamp: <2001/12/24 15:38:52 shaolin>


%--------8<--------8<--------8<--------8<--------8<--------8<--------
\newpage


 
\section{emacsen-common の動作原理}

このセクションでは，Vine Linux における
emacsen-common 及び対応 elisp パッケージが
どの様に動作しているか，その原理について説明をしています．


\subsection{emacsen-common 自体のディレクトリ構成}

emacsen-common 自体が持っているファイル/ディレクトリは主に以下の 2つに
分けることができます．

\begin{description}
 \item[\BoldText{/usr/lib/emacsen-common/}]
\ \\
  emacsen-common 対応 emacsen がインストール/アップグレード/
  アンインストールされた際に実行されるスクリプト
  (\BoldText{emacs-\{install,remove\},\{generate,remove\}-flavors-list})
  が収められています．
\\
  また，emacsen-common 対応 elisp がインストール/アップグレード/
  アンインストールされた際に実行されるスクリプト
  (\BoldText{emacs-package-\{install,remove\},
   \{generate,remove\}-package-list}) が収められています．
\\
  同時に，各 elisp パッケージに附属するスクリプトは
  \BoldText{packages/\{install,remove\}/[パッケージ名]}
  に格納されます．
 \item[\BoldText{/var/lib/emacsen-common/}]
\ \\
  現在インストールされている emacsen (\BoldText{installed-flavors}) と
  elisp (\BoldText{installed-elisp}) が書き込まれたファイルが収められている
\end{description}



\subsection{emacsen-common 対応 emacsen がインストールされた際の動作}

これらは全て該当 emacsen の \BoldText{\%post} スクリプトから実行されます．

\begin{itemize}
 \item \BoldText{/usr/lib/emacsen-common/generate-flavors-list}
       が実行され，
\\
       \BoldText{/var/lib/emacsen-common/installed-flavors}
       に該当 emacsen 名 (flavor) が書き込まれる
 \item \BoldText{/usr/lib/emacsen-common/emacs-install}
       が実行され，現在インストールされている elisp
\\
       (\BoldText{/var/lib/emacsen-common/installed-elisp} が参照される)
       のバイトコンパイルが行われる
\end{itemize}


\subsection{emacsen-common 対応 elisp がインストールされた際の動作}

これらも同様に該当 elisp の \BoldText{\%post} スクリプトから実行されます．

\begin{itemize}
 \item 必要ならば既にバイトコンパイルされたファイルが削除される
 \item \BoldText{/usr/lib/emacsen-common/generate-package-list}
       が実行され，
\\
       \BoldText{/var/lib/emacsen-common/installed-elisp}
       に該当 elisp 名が書き込まれる
 \item \BoldText{/usr/lib/emacsen-common/emacs-package-install}
       が実行され，現在インストールされている emacsen flavor
       (\BoldText{/var/lib/emacsen-common/installed-flavors} が参照される)
       各々に対するバイトコンパイルとインストールが行われる
\end{itemize}



\subsection{バイトコンパイルされたファイルがインストールされる先}

バイトコンパイル前の \BoldText{.el} ファイルが格納されているのは
先述の通り
\BoldText{/usr/share/emacs/site-lisp/[パッケージ名]}
ですが，バイトコンパイルされた \BoldText{.elc} がインストールされる
先は emacsen-common で統一されています．
Vine では，インストール先は
\BoldText{/usr/share/[emacsen flavor 名]}
と決められています．

実際には，

\begin{itemize}
 \item \BoldText{/usr/share/emacs-20.7/site-lisp} $\rightarrow$
       \BoldText{/usr/share/emacs/20.7/site-lisp}
 \item \BoldText{/usr/share/emacs-21.1/site-lisp} $\rightarrow$
       \BoldText{/usr/share/emacs/21.1/site-lisp}
\end{itemize}

とシンボリックリンクが張られており，それぞれの emacs 固有の load-path に
該当するディレクトリに \BoldText{.elc} がインストールされる様になっています．
\\

xemacs の場合は，\BoldText{/usr/share/xemacs-21.1.14} 以下を
load-path (正確には early-package-load-path) に含める様，
xemacs 自体を build してあります．
