I found the need to write this today, figured I'd share on the off chance anyone else has a need for this sort of script. txt2org --- convert tab-separated data to org-mode tables http://orgmode.org/worg/org-hacks.html#sec-3-4 Cheers, -- Eric Schulte http://cs.unm.edu/~eschulte
Eric Schulte <schulte.eric@gmail.com> writes: > I found the need to write this today, figured I'd share on the off > chance anyone else has a need for this sort of script. > > txt2org --- convert tab-separated data to org-mode tables > http://orgmode.org/worg/org-hacks.html#sec-3-4 Is it different from M-x org-table-import RET > Cheers, --
Jambunathan K <kjambunathan@gmail.com> writes: > Eric Schulte <schulte.eric@gmail.com> writes: > >> I found the need to write this today, figured I'd share on the off >> chance anyone else has a need for this sort of script. >> >> txt2org --- convert tab-separated data to org-mode tables >> http://orgmode.org/worg/org-hacks.html#sec-3-4 > > Is it different from > > M-x org-table-import RET > Yes, it is a shell script and not an Emacs Lisp function, hence it can be used in different contexts. Also, it probably isn't quite as nice in terms of right or left aligning column contents. -- Eric Schulte http://cs.unm.edu/~eschulte
Eric Schulte <schulte.eric@gmail.com> wrote:
> I found the need to write this today, figured I'd share on the off
> chance anyone else has a need for this sort of script.
>
> txt2org --- convert tab-separated data to org-mode tables
> http://orgmode.org/worg/org-hacks.html#sec-3-4
>
As an alternative, the command
M-x org-table-convert-region
does much of the dirty work - but you are on your own for hlines.
Nick
Eric Schulte <schulte.eric@gmail.com> writes: > I found the need to write this today, figured I'd share on the off > chance anyone else has a need for this sort of script. > > txt2org --- convert tab-separated data to org-mode tables > http://orgmode.org/worg/org-hacks.html#sec-3-4 Neat! In the same vein, the next release of Clojure (1.5) includes a way to export to Org mode tables: https://github.com/clojure/clojure/blob/master/changes.md#28-clojurepprintprint-table-output-compatible-with-emacs-org-mode -- Bastien
Bastien writes: > In the same vein, the next release of Clojure (1.5) includes > a way to export to Org mode tables: While we are talking about exporting tables to/from Org: Start a session from sudoku.el and use this org file to easily import Sudoku from a paper or book into sudoku.el and maybe keep track of what you did. Not the most elegant code for dealing with the lists structures, but it gets the job done. --8<---------------cut here---------------start------------->8--- #+NAME: export-sudoku #+BEGIN_SRC emacs-lisp :var table=() :hlines no :results output silent (setq custom-puzzles (list (mapcar (lambda (row) (mapcar (lambda (entry) (if (stringp entry) 0 entry)) row)) (remove 'hline table)))) #+END_SRC #+NAME: import-sudoku #+BEGIN_SRC emacs-lisp :results value :hlines yes (let (board (index 0)) (setq board (mapcar (lambda (row) (mapcar (lambda (entry) (if (zerop entry) "" entry)) row)) current-board)) (list (nth 0 board) (nth 1 board) (nth 2 board) 'hline (nth 3 board) (nth 4 board) (nth 5 board) 'hline (nth 6 board) (nth 7 board) (nth 8 board))) #+END_SRC #+TBLNAME: Test | 3 | | 2 | | | | 5 | | 8 | | | 9 | | 3 | | 5 | | 6 | | | 6 | | | | 7 | | | | 4 | |---+---+---+---+---+---+---+---+---| | | 8 | | 1 | | 4 | | 2 | | | | | 9 | | | | 8 | | | | | 2 | | 6 | | 9 | | 5 | | |---+---+---+---+---+---+---+---+---| | 8 | | | | 9 | | | | 5 | | | 1 | | 4 | | 3 | | 8 | | | 2 | | 4 | | | | 1 | | 9 | #+CALL: export-sudoku(table=Test) :results output silent #+CALL: import-sudoku() :hlines yes --8<---------------cut here---------------end--------------->8--- One noteworthy thing: even though I say ":hlines no" (I can also do this on the call line with the same result), the table still gets exported to elisp _with_ hlines and I need to filter them out myself. I'm not sure if that is intended, but it feels a bit awkward. If anything, this exception should be noted in the documentation if it is intentional. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
> > One noteworthy thing: even though I say ":hlines no" (I can also do this > on the call line with the same result), the table still gets exported to > elisp _with_ hlines and I need to filter them out myself. I'm not sure > if that is intended, but it feels a bit awkward. If anything, this > exception should be noted in the documentation if it is intentional. > elisp is special in that no hline or heading processing is done for you (the idea being that if you're working from within elisp you can do this yourself). This is a relic from the early days of Babel. I believe it is mentioned in the documentation (if it isn't I agree that it should be). -- Eric Schulte http://cs.unm.edu/~eschulte
Eric Schulte writes: > This is a relic from the early days of Babel. I believe it is > mentioned in the documentation (if it isn't I agree that it should > be). Not that I can find, neither in the manual nor Worg (I've looked again). Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Waldorf MIDI Implementation & additional documentation: http://Synth.Stromeko.net/Downloads.html#WaldorfDocs
Achim Gratz <Stromeko@nexgo.de> writes: > Eric Schulte writes: >> This is a relic from the early days of Babel. I believe it is >> mentioned in the documentation (if it isn't I agree that it should >> be). > > Not that I can find, neither in the manual nor Worg (I've looked again). > I added a note to the manual. Thanks for double-checking. -- Eric Schulte http://cs.unm.edu/~eschulte
Eric Schulte writes: > I added a note to the manual. Thanks for double-checking. Thanks. Did I understand correctly that the same also happens for the :rownames argument and should there be some similar wording like there is for :colnames? Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptation for Waldorf rackAttack V1.04R1: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
Achim Gratz <Stromeko@nexgo.de> writes: > Eric Schulte writes: >> I added a note to the manual. Thanks for double-checking. > > Thanks. Did I understand correctly that the same also happens for the > :rownames argument I just checked this and yes, elisp ignores :rownames as well. > and should there be some similar wording like there is for :colnames? > Just committed such wording to the manual. Thanks, > > > Achim. -- Eric Schulte http://cs.unm.edu/~eschulte