>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Isn't it possible to define \mesg only when \typeout's argument
Angus> starts "Babel":

I thought about that (and I do not know how to do it...), but a better
solution has been proposed on fctt: concatenate all the \typeout
messages into the \mesg macro, and find the languages in there. This
gives the following updated patch, where I have added some comments to
explain the code.

JMarc

Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.654
diff -u -p -r1.654 ChangeLog
--- lib/ChangeLog	7 Dec 2004 09:38:57 -0000	1.654
+++ lib/ChangeLog	8 Dec 2004 15:51:58 -0000
@@ -1,6 +1,12 @@
+2004-12-08  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+	
+	* configure.m4: remove code from last entry...
+
+	* chkconfig.ltx: ... and replace it with a TeX solution
+
 2004-12-07  Martin Vermeer  <[EMAIL PROTECTED]>
 
-	 * configure.m4: add printout of language list for which
+	* configure.m4: add printout of language list for which
         hyphenation is enabled
 
 2004-11-19  Jürgen Spitzmüller  <[EMAIL PROTECTED]>
Index: lib/chkconfig.ltx
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/chkconfig.ltx,v
retrieving revision 1.14
diff -u -p -r1.14 chkconfig.ltx
--- lib/chkconfig.ltx	14 Sep 2004 10:20:37 -0000	1.14
+++ lib/chkconfig.ltx	8 Dec 2004 15:51:58 -0000
@@ -152,6 +152,25 @@
 \message{^^J\prefix checking for LaTeX version... \fmtversion}
 \AddVariable{fmtversion}{\fmtversion}
 
+%%% And now, the list of available languages
+% The trick is to know that \the\everyjob contains something like
+%  \typeout{LaTeX2e <2001/06/01>}
+%  \typeout{Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, nohyphenation, loaded.}
+% All we have to do is to extract the list from there:
+% (1) concatenate all the messages that are displayed everytime the
+% format is loaded. The is done by redefining locally \typeout to
+% append its argument to the macro \mesg.
+\def\mesg{}
+{\def\typeout#1{\xdef\mesg{\mesg #1}}
+ \the\everyjob}
+% (2) strip the useless parts from \mesg. This uses the fact that TeX
+% allows to define macros with parameters delimited by arbitrary text.
+\def\strip#1patterns for #2, loaded.#3\endmark{\def\langs{#2}}
+\expandafter\strip\mesg\endmark
+% (3) handle the result
+\message{^^J\prefix checking for available hyphenation patterns... \langs}
+\AddVariable{languages}{\langs}
+
 %%% Check for ec fonts. Most of this code has been shamelessely stolen
 %%% from the file ltxcheck.tex in the LaTeX distribution. In particular,
 %%% don't ask me how the macro \ecrm works...
Index: lib/configure.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.86
diff -u -p -r1.86 configure.m4
--- lib/configure.m4	7 Dec 2004 09:38:57 -0000	1.86
+++ lib/configure.m4	8 Dec 2004 15:51:58 -0000
@@ -219,19 +219,6 @@ else
   LATEX=
   ac_result="not useable"
 fi
-# Grab the list of languages avaliable to LaTeX by parsing the LaTeX log file, chklatex.log.
-LANGUAGES=`sed -n '/hyphenation patterns/{
-:loop
-/loaded\.$/!{
-$!{
-N
-s/\n//
-s/^.*for\ //
-tloop
-}
-}
-/loaded\.$/p
-}' chklatex.log`
 rm -f chklatex.ltx chklatex.log])dnl
 dnl
 # Search LaTeX2e
@@ -536,11 +523,6 @@ changequote(,)dnl
 echo "creating doc/LaTeXConfig.lyx"
 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
-# Add a line to chkconfig.sed so that the placeholder in
-# LaTeXConfig.lyx.in will be replaced by the list of available
-# languages.
-test "${LANGUAGES}" != "" && \
-        echo "s/@chk_languages@/${LANGUAGES}/g" >> chkconfig.sed
 sed -f chkconfig.sed "${srcdir}"/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
 
 echo "creating $outfile"

Reply via email to