[Orgmode] Re: [BUG] org-babel-tangle causes Wrong type argument: sequencep, hline

2011-02-27 Thread Sébastien Vauban
Hi Eric,

Eric Schulte wrote:
 I've just pushed up a change which should fix this issue i.e., the code
 block below now evaluates without error.

Just for my (= our) information, which combination was special here and had to
be fixed in the code?

  input file:

 #+STARTUP:  showeverything
 #+BABEL::tangle yes

 * Normalize
 #+tblname: normalize
 | search| replace  |
 |---+--|
 | no salt added | without salt |

 #+begin_src perl :var norm_search=normalize[*,0] :var 
 norm_repl=normalize[*,1]
 $norm_search;
 $norm_repl;
 #+end_src 

Best regards,
  Seb

-- 
Sébastien Vauban


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: [BUG] org-babel-tangle causes Wrong type argument: sequencep, hline

2011-02-27 Thread Eric Schulte
Sébastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric,

 Eric Schulte wrote:
 I've just pushed up a change which should fix this issue i.e., the code
 block below now evaluates without error.

 Just for my (= our) information, which combination was special here and had to
 be fixed in the code?


The hline was assumed to be a list (as normal rows are) by the indexing
code, so I just inserted a quick check to ensure that hlines are left
alone.

#+begin_src diff
  diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
  index 6cb41ae..31944fd 100644
  --- a/lisp/ob-ref.el
  +++ b/lisp/ob-ref.el
  @@ -181,7 +181,10 @@ to \0:-1\.
  (open (ls) (if (and (listp ls) (= (length ls) 1)) (car ls) 
ls)))
 (open
  (mapcar
  -(lambda (sub-lis) (org-babel-ref-index-list remainder sub-lis))
  +(lambda (sub-lis)
  +   (if (listp sub-lis)
  +   (org-babel-ref-index-list remainder sub-lis)
  + sub-lis))
   (if (or (= 0 (length portion)) (string-match ind-re portion))
   (mapcar
   (lambda (n) (nth n lis))
#+end_src

Best -- Eric

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [BUG] org-babel-tangle causes Wrong type argument: sequencep, hline

2011-02-27 Thread Sébastien Vauban
Hi Eric,

Eric Schulte wrote:
 Sébastien Vauban wxhgmqzgw...@spammotel.com writes:
 Eric Schulte wrote:
 I've just pushed up a change which should fix this issue i.e., the code
 block below now evaluates without error.

 Just for my (= our) information, which combination was special here and had 
 to
 be fixed in the code?

 The hline was assumed to be a list (as normal rows are) by the indexing
 code, so I just inserted a quick check to ensure that hlines are left
 alone.

 #+begin_src diff
   diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
   index 6cb41ae..31944fd 100644
   --- a/lisp/ob-ref.el
   +++ b/lisp/ob-ref.el
   @@ -181,7 +181,10 @@ to \0:-1\.
   (open (ls) (if (and (listp ls) (= (length ls) 1)) (car ls) 
 ls)))
  (open
   (mapcar
   -(lambda (sub-lis) (org-babel-ref-index-list remainder sub-lis))
   +(lambda (sub-lis)
   + (if (listp sub-lis)
   + (org-babel-ref-index-list remainder sub-lis)
   +   sub-lis))
(if (or (= 0 (length portion)) (string-match ind-re portion))
(mapcar
(lambda (n) (nth n lis))
 #+end_src

Thanks a lot for the precision...

Best regards,
  Seb

-- 
Sébastien Vauban


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [BUG] org-babel-tangle causes Wrong type argument: sequencep, hline

2011-02-27 Thread Vladimir Alexiev
 The hline was assumed to be a list (as normal rows are) by the indexing
 code, so I just inserted a quick check to ensure that hlines are left
 alone.

So Eric, you're handing this arg as per documentation (info)
* :hlines: `no' (default)
  Strips horizontal lines from the input table.

But you've missed handling this arg:
* :colnames `nil' (default) 
  If an input table looks like it has column names (because
  its second row is an hline), then the column names will be removed
  from the table before processing

I think that org-babel-ref-index-list should receive the stripped table,
i.e. these elements should have been removed:
  (search replace) hline

I think the fix is somewhere in org-babel-disassemble-tables, 
not in functions it calls (downstream from it). 
But in my debugging it always returned (nil nil nil)?


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: [BUG] org-babel-tangle causes Wrong type argument: sequencep, hline

2011-02-27 Thread Eric Schulte
Vladimir Alexiev vladi...@sirma.bg writes:

 The hline was assumed to be a list (as normal rows are) by the indexing
 code, so I just inserted a quick check to ensure that hlines are left
 alone.

 So Eric, you're handing this arg as per documentation (info)
 * :hlines: `no' (default)
   Strips horizontal lines from the input table.

 But you've missed handling this arg:
 * :colnames `nil' (default) 
   If an input table looks like it has column names (because
   its second row is an hline), then the column names will be removed
   from the table before processing

 I think that org-babel-ref-index-list should receive the stripped table,
 i.e. these elements should have been removed:
   (search replace) hline


I see the point you are making, and this behavior would be ideal.
Unfortunately, the indices are applied to the variable during resolution
of the reference and at this time other header arguments, e.g., :hlines,
:colnames, and :rownames are not available to pre-process the table.

While not ideal, I do believe that it is consistent to say that the
index is applied to the table *before* the other table related header
arguments are applied.  I will update the documentation to make this
clear.

Best -- Eric

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode