emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [RFC] new :post header argument for post-processing of code block results
Date: Mon, 01 Apr 2013 01:30:46 -0400	[thread overview]
Message-ID: <87bo9yvmux.fsf@gmail.com> (raw)
In-Reply-To: <87bo9zoxqd.fsf@gmail.com>

Hi Eric

2013ko martxoak 31an, Eric Schulte-ek idatzi zuen:
> 
> Hi,
> 
> I've been wanting to add the ability to post-process the results of a
> code block for some time, and some recent threads (e.g., [1] and [2])
> could both have benefited from post-processing of code block output.

This looks very nice!

> 
> Does this new header argument seem useful?  Any suggestions for better
> syntax which don't add too much conceptual or code complexity?

See below.

> @@ -625,6 +626,11 @@ block."
>  				      (not (listp result)))
>  				 (list (list result)) result))
>  			   (funcall cmd body params)))
> +		    ;; possibly perform post process provided its appropriate
> +		    (when (cdr (assoc :post params))
> +		      (let ((*this* result))
> +			(setq result (org-babel-ref-resolve
> +				      (cdr (assoc :post params))))))

What if you did some string surgery on the :post string, to insert
",data=\"the result\"" into the call?  That way users could just write
:post add-width(width=5cm), which would be automatically transformed
into add-width(width=5cm,data="[[graph.png]]") before being passed to
o-b-ref-resolve.

(I guess you’d have to take special care to handle things like ":post
no-args()" and ":post no-args" properly, stripping the initial comma in
the first case and adding parens in the second.)

This requires that all :post code blocks take a data
argument, but I don’t think that’s more onerous than stipulating the
*this* variable at the lisp level.

Also, I’m unclear on whether elisp is supported (or should be).  Do we
want to allow ":post (message *this*)"?

-- 
Aaron Ecay

  reply	other threads:[~2013-04-01  5:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01  1:17 [RFC] new :post header argument for post-processing of code block results Eric Schulte
2013-04-01  5:30 ` Aaron Ecay [this message]
2013-04-03 14:30   ` Eric Schulte
2013-04-04  2:18     ` Eric Schulte
2013-04-04  9:54       ` Bastien
2013-04-04 12:47         ` Eric Schulte
2013-04-04 12:54           ` Bastien
2014-12-12 16:37     ` Christian Nybø
2013-04-16 12:47 ` Eric S Fraga
2013-04-16 15:23   ` Eric Schulte
2013-04-16 20:42     ` Andreas Leha

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=87bo9yvmux.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /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).