From 83d1a96aab50cc552604357dedc0b4810914c31a Mon Sep 17 00:00:00 2001
From: Elie Roux <elie.roux@telecom-bretagne.eu>
Date: Mon, 22 Apr 2013 14:41:35 +0200
Subject: Filenames are not printed if called by texlua

---
 luatexbase-loader.dtx | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

(limited to 'luatexbase-loader.dtx')

diff --git a/luatexbase-loader.dtx b/luatexbase-loader.dtx
index 77b9b9b..b8e5098 100644
--- a/luatexbase-loader.dtx
+++ b/luatexbase-loader.dtx
@@ -283,6 +283,17 @@ module('luatexbase', package.seeall)
 kpse.set_program_name("luatex")
 %    \end{macrocode}
 %
+%    In \LaTeX, it's traditional to print the included file paths. We don't want
+%    to do this for scripts using texlua... Currently there is no perfect check
+%    of texlua vs. luatex, so we check for the token table.
+%
+%    \begin{macrocode}
+local print_included_path = false
+if token then
+  print_included_path = true
+end
+%    \end{macrocode}
+%
 %    Emulate (approximatively) kpse's lua format search. More precisely,
 %    combine the search path of |texmfscripts| and |tex| in order to
 %    approximate |LUAINPUTS|. But we need to handle suffixes ourselves.
@@ -357,7 +368,9 @@ local function load_module(mod)
   if not loader then
     return "\n\t[luatexbase.loader] Loading error:\n\t"..error
   end
-  texio.write_nl("("..file..")")
+  if print_included_path then
+    texio.write_nl("("..file..")")
+  end
   return loader
 end
 %    \end{macrocode}
-- 
cgit v1.2.3

