* [babel] Output table
@ 2013-12-02 16:16 Sebastien Vauban
2013-12-02 18:28 ` Eric Schulte
0 siblings, 1 reply; 3+ messages in thread
From: Sebastien Vauban @ 2013-12-02 16:16 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hello,
I'm trying to generate R graphs from lines found in the *Messages* buffer with
the following code of mine:
#+begin_src emacs-lisp :results output table
(setq txt nil)
(with-current-buffer "*Messages*"
(goto-char (point-min))
(while (re-search-forward
"^Retrieving newsgroup: \\(.+\\)"
nil t)
(setq txt (concat txt (format "%s" (match-string 1)) "\n"))
(princ txt)))
#+end_src
However, the results is always an example block, NEVER in an Org _table_ -- and
I don't understand why. Does anybody?
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [babel] Output table
2013-12-02 16:16 [babel] Output table Sebastien Vauban
@ 2013-12-02 18:28 ` Eric Schulte
2013-12-02 21:04 ` Sebastien Vauban
0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2013-12-02 18:28 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
"Sebastien Vauban" <sva-news@mygooglest.com> writes:
> Hello,
>
> I'm trying to generate R graphs from lines found in the *Messages* buffer with
> the following code of mine:
>
> #+begin_src emacs-lisp :results output table
> (setq txt nil)
> (with-current-buffer "*Messages*"
> (goto-char (point-min))
> (while (re-search-forward
> "^Retrieving newsgroup: \\(.+\\)"
> nil t)
> (setq txt (concat txt (format "%s" (match-string 1)) "\n"))
> (princ txt)))
> #+end_src
>
> However, the results is always an example block, NEVER in an Org _table_ -- and
> I don't understand why. Does anybody?
>
> Best regards,
> Seb
I bet because ":results output" in Emacs Lisp is only interpreted as a
string. You're better off just returning a list with something like the
following.
#+begin_src emacs-lisp :results output table
(let (txts)
(with-current-buffer "*Messages*"
(goto-char (point-min))
(while (re-search-forward
"^Retrieving newsgroup: \\(.+\\)"
nil t)
(push (match-string 1) txts)))
txts)
#+end_src
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [babel] Output table
2013-12-02 18:28 ` Eric Schulte
@ 2013-12-02 21:04 ` Sebastien Vauban
0 siblings, 0 replies; 3+ messages in thread
From: Sebastien Vauban @ 2013-12-02 21:04 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
Eric Schulte wrote:
> "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> writes:
>> I'm trying to generate R graphs from lines found in the *Messages* buffer with
>> the following code of mine:
>>
>> #+begin_src emacs-lisp :results output table
>> (setq txt nil)
>> (with-current-buffer "*Messages*"
>> (goto-char (point-min))
>> (while (re-search-forward
>> "^Retrieving newsgroup: \\(.+\\)"
>> nil t)
>> (setq txt (concat txt (format "%s" (match-string 1)) "\n"))
>> (princ txt)))
>> #+end_src
>>
>> However, the results is always an example block, NEVER in an Org _table_ -- and
>> I don't understand why. Does anybody?
>
> I bet because ":results output" in Emacs Lisp is only interpreted as a
> string. You're better off just returning a list with something like the
> following.
>
> #+begin_src emacs-lisp :results output table
> (let (txts)
> (with-current-buffer "*Messages*"
> (goto-char (point-min))
> (while (re-search-forward
> "^Retrieving newsgroup: \\(.+\\)"
> nil t)
> (push (match-string 1) txts)))
> txts)
> #+end_src
I guess you meant ":results value", then? Because "output" does not return
anything with your code.
As you can imagine, though the list could be processed by R, the fact it's not
a table makes it unreadable as is in the Org buffer and in a generated PDF (at
least, without extra conversion blocks).
See http://screencast.com/t/QVd0VDLYE1.
Would there be a way to get a proper table more directly?
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-02 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-02 16:16 [babel] Output table Sebastien Vauban
2013-12-02 18:28 ` Eric Schulte
2013-12-02 21:04 ` Sebastien Vauban
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).