From c4eb95663d8e14360fc564279757de46eeecdc6f Mon Sep 17 00:00:00 2001
From: Elie Roux <elie.roux@telecom-bretagne.eu>
Date: Sun, 9 Jun 2013 10:21:58 +0200
Subject: In simple callbacks, we stop on a false return

(so that we can truely disable hyphenation)
---
 luatexbase-mcb.dtx | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'luatexbase-mcb.dtx')

diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx
index 3740e06..6d23eb8 100644
--- a/luatexbase-mcb.dtx
+++ b/luatexbase-mcb.dtx
@@ -572,7 +572,7 @@ local function listhandler (name)
         for _, f in ipairs(callbacklist[name]) do
             ret = f.func(head, ...)
             if ret == false then
-                log("function '%s' returned false\nin callback '%s'",
+                log("function '%s' returned false in callback '%s'",
                     f.description, name)
                 break
             end
@@ -611,14 +611,22 @@ local function firsthandler (name)
 end
 %    \end{macrocode}
 %
-%    Handler for |simple| callbacks.
+%    Handler for |simple| callbacks. If a function returns false, we return
+%    this value, without going through other functions.
 %
 %    \begin{macrocode}
 local function simplehandler (name)
     return function(...)
+        local ret = true
         for _, f in ipairs(callbacklist[name]) do
-            f.func(...)
+            ret = f.func(...)
+            if ret == false then
+                log("function '%s' returned false in callback '%s'",
+                    f.description, name)
+                return false
+            end
         end
+        return ret
     end
 end
 %    \end{macrocode}
-- 
cgit v1.2.3

