emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to write a org babel hook, which can manupulate result
Date: Thu, 27 Mar 2014 11:44:28 +0900	[thread overview]
Message-ID: <87r45o7437.fsf@tanger.home> (raw)
In-Reply-To: <8761n0jyio.fsf@news.tumashu-localhost.org> (Feng Shu's message of "Thu, 27 Mar 2014 08:06:23 +0800")

Feng Shu <tumashu@gmail.com> writes:

> Daimrod <daimrod@gmail.com> writes:
>
>> Feng Shu <tumashu@gmail.com> writes:
>>
>>> Hi:
>> Hi Feng,
>>
>> Look at the :post header argument.
>> (info "(org) post")
>
> How to use elisp in :post directly,

I don't think you can.

You have to use it this way (not tested):

#+NAME: align-multi-table
#+BEGIN_SRC emacs-lisp :var content="nil" :results raw
  (align-multi-table content)
#+END_SRC
#+begin_src R :results output raw drawer :post align-multi-table(content=*this*)
  <content>
#+end_src

> for example:
>
> #+begin_src R :results output raw drawer :post (align-multi-table)
>   <content>
> #+end_src
> #+begin_comment
> (defun align-multi-table (&optional content)
>   (interactive)
>   (let ((content (or content *this*)))
>     (with-temp-buffer
>       (insert content)
>       (goto-char (point-min))
>       (while (not (eobp))
> 	(when (org-at-table-p)
> 	  (org-table-align))
> 	(forward-line))
>       (buffer-string))))
> #+end_comment
>
>>
>>> I want to write a hook to menupulate org babel output,
>>> The problem is: How can I get two points info: [pointA] and [pointB]
>>> in my hook function?
>>>
>>> #+begin_src R :results output raw drawer
>>> tbl <- data.frame(a=c(1,2,3),b=c(3,2,1))
>>> print(ascii(tbl),type="org")
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>> :RESULTS:
>>> [pointA]
>>> |   |    a |    b |
>>> |---+------+------|
>>> | 1 | 1.00 | 3.00 |
>>> | 2 | 2.00 | 2.00 |
>>> | 3 | 3.00 | 1.00 |
>>> [pointB]
>>> :END:

-- 
Daimrod/Greg

  reply	other threads:[~2014-03-27  2:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 13:17 How to write a org babel hook, which can manupulate result Feng Shu
2014-03-26 13:32 ` Daimrod
2014-03-26 15:32   ` Feng Shu
2014-03-27  0:06   ` Feng Shu
2014-03-27  2:44     ` Daimrod [this message]
2014-03-27  4:31       ` Feng Shu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r45o7437.fsf@tanger.home \
    --to=daimrod@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).