commit 19fedea29a13cf95887fa7cb8ea2a600462730f6
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Fri Oct 18 10:09:35 2024 +0200

    Fix hyphenation patterns check with recent babel
    
    This was broken since 2016.
    
    See discussion in https://www.lyx.org/trac/ticket/13112
---
 lib/chkconfig.ltx | 25 +++++++++++++++++--------
 status.24x        |  2 ++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx
index bde9d59e4b..dbe99648df 100644
--- a/lib/chkconfig.ltx
+++ b/lib/chkconfig.ltx
@@ -212,13 +212,14 @@
 \AddPackage[\expandafter\@parse@version\fmtversion//00\@nil]{LaTeX}
 
 %%% And now, the list of available languages
-% The trick is to know that \the\everyjob contains something like
+% Up to 2016 \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.
+% But see below for recent versions of babel.
 \def\mesg{}
 {\def\typeout#1{\xdef\mesg{\mesg #1}}
  \the\everyjob}
@@ -226,19 +227,27 @@
 % (2) strip the useless parts from \mesg. This uses the fact that TeX
 % allows to define macros with parameters delimited by arbitrary text.
 \def\platexname{pLaTeX2e}
+\def\langs{}
 \ifx\pfmtname\platexname
   \def\langs{japanese}
 \else
-  \def\strip#1patterns for #2, loaded.#3\endmark{\def\langs{#2}}
-  \expandafter\strip\mesg\endmark
+  \ifx\mesg\empty
+%    As of 2016, babel does not print out the loaded hyphenation patterns to
+%    the log anymore, so \mesg will be empty. For the following method,
+%    see https://tex.stackexchange.com/questions/330085/
+     \@ifundefined{bbl@languages}{}{
+        \def\bbl@elt#1#2#3#4{#1, }
+        \edef\@langs{\bbl@languages}
+        \def\strip#1, \endmark{\def\langs{#1}}
+        \expandafter\strip\@langs\endmark
+      }
+  \else
+    \def\strip#1patterns for #2, loaded.#3\endmark{\def\langs{#2}}
+    \expandafter\strip\mesg\endmark
+  \fi
 \fi
 
 % (3) handle the result
-% FIXME: As of 2016, babel does not print out the loaded hyphenation patterns 
to
-%        the log anymore, so this discontinues to work. For possible 
workarounds
-%        (with babel), see https://tex.stackexchange.com/questions/330085/
-%        Leaving this activated for the time being, since it probably still
-%        works with older distributions.
 \message{^^J\prefix checking for available hyphenation patterns... \langs}
 \AddVariable{languages}{\langs}
 
diff --git a/status.24x b/status.24x
index 0b05406f88..0ad2ec7048 100644
--- a/status.24x
+++ b/status.24x
@@ -106,3 +106,5 @@ What's new
 
 * BUILD/INSTALLATION
 
+- Fix (only informal) check for hyphenation patterns in (re)configuration.
+
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to