emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Ian Kelling <ian@iankelling.org>
Cc: Achim Gratz <Stromeko@nexgo.de>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Fix error prone babel table output format detection
Date: Sun, 04 May 2014 09:51:02 -0600	[thread overview]
Message-ID: <87bnvda5sx.fsf@gmail.com> (raw)
In-Reply-To: 87bnvhhlhn.fsf@treetowl.lan

Ian Kelling <ian@iankelling.org> writes:

> Ian Kelling <ian@iankelling.org> 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.
>

Hi Ian,

You should use the `org-every' function here.  Look at the source of
that function to see code to efficiently perform this sort of check.

Best,

>
> -- >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 source
>  		 ((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 'hline))
> +					     (setq proper nil))))
>  				       result (list result))
>  				   '(:fmt (lambda (cell) (format "%s" cell)))) "\n"))
>  		  (goto-char beg) (when (org-at-table-p) (org-table-align)))

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

  reply	other threads:[~2014-05-04 16:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-01  4:56 [PATCH] Fix error prone babel table output format detection Ian Kelling
2014-05-01  7:08 ` Achim Gratz
2014-05-01  8:30   ` Ian Kelling
2014-05-01  9:13     ` Ian Kelling
2014-05-01  9:32       ` Ian Kelling
2014-05-01  9:55         ` Ian Kelling
2014-05-04 15:51           ` Eric Schulte [this message]
2014-05-04 19:42             ` Ian Kelling
2014-05-07  9:15               ` Eric Schulte
2014-05-07 20:57                 ` Ian Kelling
2014-05-21 13:05                   ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bnvda5sx.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=Stromeko@nexgo.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=ian@iankelling.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).