emacs-orgmode
[Top][All Lists]
Advanced

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

Re: convert subtree or nested list to table


From: Matt Price
Subject: Re: convert subtree or nested list to table
Date: Tue, 20 Jul 2021 11:11:08 -0400

Christian et al,

I seem to have broken something while fiddling around and I can't quite make out what.  Would someone be willing to check for me whether this does or does not produce the desired full table? Right now I am again getting a truncated result and I'm not fully sure what I might be oding wrong.  Here is what I have:

#+NAME: rubric-one
- Grade
  a. A
  b. B
  c. C
  d. D
  e. F
- Style
  a. Excellent
  b. Good
  c. Adequate
  d. Lousy
  e. Failing

#+NAME: list2table
#+BEGIN_SRC emacs-lisp :var order="columns" data="" :results table value raw replace
 (let (longest)
    (setq data (map 'list '-flatten data))
    (setq data (map 'list (lambda (x) (seq-difference x '(unordered ordered))) data))
    ;; Pad out lists to equal length
    (setq longest (seq-max (map 'list 'length data)))
    (setq data
          (map 'list
               (lambda (l)
                 (append l (make-list (- longest (length l)) "")))
                 data))
    ;; Order by columns or rows
    (if (string= order "columns")
        (apply #'mapcar* #'list data) ; transpose
      data))
#+END_SRC

#+RESULTS: list2table
| Grade |

----------------

thanks as always for the help!

reply via email to

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