[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Fix error prone babel table output format detection

From: Ian Kelling
Subject: Re: [O] [PATCH] Fix error prone babel table output format detection
Date: Thu, 01 May 2014 02:55:00 -0700
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.4.50 (gnu/linux)

Ian Kelling <address@hidden> writes:
> It's a bit late.  here is the same patch with correct indentation.

That patch went out of it's way not to check more of the list than was
necessary, but after sending it, I kept thinking that it does extra
things which possibly negate any performance benefit of not checking the
whole list. So here is a simpler patch does the same thing, but goes
over the whole list. I'd love to hear a more experienced emacs lisper
weigh in on which is better.

-- >8 --
Subject: [PATCH] Fix error prone babel table output format detection

* lisp/ob-core.el: Test that all elements are in a list are lists or
'hline instead of just the first.

org-babel table output uses different formatting for a list of lists,
but detects it incorrectly causing an error. An example of a block
causing an error is an emacs lisp source block containing just 1 line:
'((1) 2)
 lisp/ob-core.el |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 1348f04..05ccb00 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2184,9 +2184,10 @@ code ---- the results are extracted in the syntax of the 
                 ((funcall proper-list-p result)
                  (goto-char beg)
                  (insert (concat (orgtbl-to-orgtbl
-                                  (if (or (eq 'hline (car result))
-                                          (and (listp (car result))
-                                               (listp (cdr (car result)))))
+                                  (if (let ((proper t))
+                                        (dolist (elem result proper)
+                                          (unless (or (listp elem) (eq elem 
+                                            (setq proper nil))))
                                       result (list result))
                                   '(:fmt (lambda (cell) (format "%s" cell)))) 
                  (goto-char beg) (when (org-at-table-p) (org-table-align)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]