branch: externals/org
commit 80f6a949e56d83c59133dc098d3acdfc606237f7
Author: Rudolf Adamkovič <rud...@adamkovic.org>
Commit: Ihor Radchenko <yanta...@posteo.net>

    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 0168bc0700..b2eb46c07e 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)

Reply via email to