emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline"
@ 2011-02-27 13:57 Vladimir Alexiev
  2011-02-27 16:06 ` Eric Schulte
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Alexiev @ 2011-02-27 13:57 UTC (permalink / raw)
  To: emacs-orgmode

When I try to tangle the simple file shown below, I get this error:
  "Wrong type argument: sequencep, hline".
Org-mode version 7.4 (release_7.4.44.g49d9c.dirty)

I have the default values of these args (checked through gebugging)
According to the help:
* :hlines: `no' (default)
  Strips horizontal lines from the input table.
* :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

This is urgent for me, so any help is appreciated!

---- 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 

---- backtrace cut at 74 columns (email me for the full backtrace):

Debugger entered--Lisp error: (wrong-type-argument sequencep hline)       
  org-babel-ref-index-list("0" hline)                                     
  #[(sub-lis) "\302\b   \"\207" [remainder sub-lis org-babel-ref-index-lis
  mapcar(#[(sub-lis) "\302\b    \"\207" [remainder sub-lis org-babel-ref-i
  org-babel-ref-index-list("*,0" (("search" "replace") hline ("no salt add
  org-babel-ref-resolve("normalize[*,0]")                                 
  org-babel-ref-parse("norm_search=normalize[*,0]")                       
  (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (cdr el)))           
  (lambda (el) (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (cdr el)
  mapcar((lambda (el) (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (
  (org-babel-disassemble-tables (mapcar (lambda (el) (if (consp (cdr el)) 
  (let* ((vars-and-names (org-babel-disassemble-tables (mapcar (lambda (el
  org-babel-process-params(((:comments . "") (:shebang . "") (:cache . "no
  org-babel-get-src-block-info()                                          
  byte-code("\b\203\b

I tried debugging but quickly got lost. Still, some observations:
- org-babel-disassemble-tables: didn't seem to do much since 'vars' was nil
- org-babel-ref-index-list: I think it should receive the stripped table,
  i.e. these elements should have been removed:
  ("search" "replace") hline

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline"
  2011-02-27 13:57 [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline" Vladimir Alexiev
@ 2011-02-27 16:06 ` Eric Schulte
  2011-02-27 20:07   ` Sébastien Vauban
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Schulte @ 2011-02-27 16:06 UTC (permalink / raw)
  To: Vladimir Alexiev; +Cc: emacs-orgmode

Vladimir Alexiev <vladimir@sirma.bg> writes:

> When I try to tangle the simple file shown below, I get this error:
>   "Wrong type argument: sequencep, hline".
> Org-mode version 7.4 (release_7.4.44.g49d9c.dirty)
>
> I have the default values of these args (checked through gebugging)
> According to the help:
> * :hlines: `no' (default)
>   Strips horizontal lines from the input table.
> * :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
>
> This is urgent for me, so any help is appreciated!
>

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

Best -- Eric

>
> ---- 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 
>
> ---- backtrace cut at 74 columns (email me for the full backtrace):
>
> Debugger entered--Lisp error: (wrong-type-argument sequencep hline)       
>   org-babel-ref-index-list("0" hline)                                     
>   #[(sub-lis) "\302\b   \"\207" [remainder sub-lis org-babel-ref-index-lis
>   mapcar(#[(sub-lis) "\302\b    \"\207" [remainder sub-lis org-babel-ref-i
>   org-babel-ref-index-list("*,0" (("search" "replace") hline ("no salt add
>   org-babel-ref-resolve("normalize[*,0]")                                 
>   org-babel-ref-parse("norm_search=normalize[*,0]")                       
>   (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (cdr el)))           
>   (lambda (el) (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (cdr el)
>   mapcar((lambda (el) (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (
>   (org-babel-disassemble-tables (mapcar (lambda (el) (if (consp (cdr el)) 
>   (let* ((vars-and-names (org-babel-disassemble-tables (mapcar (lambda (el
>   org-babel-process-params(((:comments . "") (:shebang . "") (:cache . "no
>   org-babel-get-src-block-info()                                          
>   byte-code("\b\203\b
>
> I tried debugging but quickly got lost. Still, some observations:
> - org-babel-disassemble-tables: didn't seem to do much since 'vars' was nil
> - org-babel-ref-index-list: I think it should receive the stripped table,
>   i.e. these elements should have been removed:
>   ("search" "replace") hline
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline"
  2011-02-27 16:06 ` Eric Schulte
@ 2011-02-27 20:07   ` Sébastien Vauban
  2011-02-27 21:19     ` Eric Schulte
  0 siblings, 1 reply; 9+ messages in thread
From: Sébastien Vauban @ 2011-02-27 20:07 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline"
  2011-02-27 20:07   ` Sébastien Vauban
@ 2011-02-27 21:19     ` Eric Schulte
  2011-02-27 22:41       ` Sébastien Vauban
  2011-02-27 23:21       ` Vladimir Alexiev
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Schulte @ 2011-02-27 21:19 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Sébastien Vauban <wxhgmqzgwmuf@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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline"
  2011-02-27 21:19     ` Eric Schulte
@ 2011-02-27 22:41       ` Sébastien Vauban
  2011-02-27 23:21       ` Vladimir Alexiev
  1 sibling, 0 replies; 9+ messages in thread
From: Sébastien Vauban @ 2011-02-27 22:41 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

"Eric Schulte" wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> 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-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline"
  2011-02-27 21:19     ` Eric Schulte
  2011-02-27 22:41       ` Sébastien Vauban
@ 2011-02-27 23:21       ` Vladimir Alexiev
  2011-02-28  0:19         ` Eric Schulte
  1 sibling, 1 reply; 9+ messages in thread
From: Vladimir Alexiev @ 2011-02-27 23:21 UTC (permalink / raw)
  To: emacs-orgmode

> 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)?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline"
  2011-02-27 23:21       ` Vladimir Alexiev
@ 2011-02-28  0:19         ` Eric Schulte
  2011-02-28  0:58           ` [BUG] org-babel-tangle causes Vladimir Alexiev
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Schulte @ 2011-02-28  0:19 UTC (permalink / raw)
  To: Vladimir Alexiev; +Cc: emacs-orgmode

Vladimir Alexiev <vladimir@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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [BUG] org-babel-tangle causes
  2011-02-28  0:19         ` Eric Schulte
@ 2011-02-28  0:58           ` Vladimir Alexiev
  2011-02-28  4:03             ` Eric Schulte
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Alexiev @ 2011-02-28  0:58 UTC (permalink / raw)
  To: emacs-orgmode

I found a simple WORKAROUND. 
Kindly put this in the documentation of :colnames,
at the end of the nil value:

Please note that such "table disassembly" does not work with var indexing.
As a simple workaround, put the #+tblname AFTER the hline (not before the table).
For example:

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

  | colA | colB |
  |------+------|
  #+tblname: table
  | a1   | b1   |
  | a2   | b2   |

  #+begin_src perl :var a=table[*,0] :var b=table[*,1]
  $a; $b;
  #+end_src 

If you tangle this source with C-c C-x t, you can see 
that the assignments are correct.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [BUG] org-babel-tangle causes
  2011-02-28  0:58           ` [BUG] org-babel-tangle causes Vladimir Alexiev
@ 2011-02-28  4:03             ` Eric Schulte
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Schulte @ 2011-02-28  4:03 UTC (permalink / raw)
  To: Vladimir Alexiev; +Cc: emacs-orgmode

Vladimir Alexiev <vladimir@sirma.bg> writes:

> I found a simple WORKAROUND. 
> Kindly put this in the documentation of :colnames,
> at the end of the nil value:
>
> Please note that such "table disassembly" does not work with var
> indexing.  As a simple workaround, put the #+tblname AFTER the hline
> (not before the table).

Done, thanks for the suggestion

> 
> For example:
>
>   #+STARTUP:  showeverything
>   #+BABEL:    :tangle yes
>
>   | colA | colB |
>   |------+------|
>   #+tblname: table
>   | a1   | b1   |
>   | a2   | b2   |
>
>   #+begin_src perl :var a=table[*,0] :var b=table[*,1]
>   $a; $b;
>   #+end_src 
>
> If you tangle this source with C-c C-x t, you can see 
> that the assignments are correct.
>

I think that the following would be cleaner.  This is the workaround I
had in mind in my previous email, sorry I should have explicitly
mentioned this option.

#+tblname: perl-table-w-hline
| colA | colB |
|------+------|
| a1   | b1   |
| a2   | b2   |

#+headers: :var b=perl-table-w-hline[2..,1]
#+headers: :var a=perl-table-w-hline[2..,0]
#+begin_src perl :tangle yes
  $a; $b;
#+end_src 

Best -- Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-02-28  4:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-27 13:57 [BUG] org-babel-tangle causes "Wrong type argument: sequencep, hline" Vladimir Alexiev
2011-02-27 16:06 ` Eric Schulte
2011-02-27 20:07   ` Sébastien Vauban
2011-02-27 21:19     ` Eric Schulte
2011-02-27 22:41       ` Sébastien Vauban
2011-02-27 23:21       ` Vladimir Alexiev
2011-02-28  0:19         ` Eric Schulte
2011-02-28  0:58           ` [BUG] org-babel-tangle causes Vladimir Alexiev
2011-02-28  4:03             ` Eric Schulte

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).