From 93acae0704e873168f27d304901cde8fd9524dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Fri, 14 Jun 2024 16:59:37 +0200 Subject: [PATCH 2/5] ob-lua: Sort tabular results `test-ob-lua/colnames-yes-header-argument-pp' fails intermittently due to tabular results being returned from Lua to Emacs Lisp in different order than expected. We fix the problem by sorting all tabular results before returning them. * lisp/ob-lua.el (org-babel-lua-wrapper-method): Sort all tabular results, recursively, before returning them from Lua to Emacs Lisp. --- lisp/ob-lua.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ob-lua.el b/lisp/ob-lua.el index 0168bc070..b2eb46c07 100644 --- a/lisp/ob-lua.el +++ b/lisp/ob-lua.el @@ -270,7 +270,13 @@ function dump(it, indent) if #indent ~= 0 then result = result .. '\\n' end - for key, value in pairs(it) do + local keys = {} + for key in pairs(it) do + table.insert(keys, key) + end + table.sort(keys) + for _, key in pairs(keys) do + local value = it[key] result = result .. indent .. dump(key) -- 2.39.3 (Apple Git-146)