emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "David A. Gershman" <dagershman@dagertech.net>
To: emacs-orgmode@gnu.org
Subject: Re: Babel Export - Getting asked for coding system
Date: Thu, 22 Sep 2016 10:14:50 -0700	[thread overview]
Message-ID: <8E534C8D-EE51-4246-9A11-771732C9CC47@dagertech.net> (raw)
In-Reply-To: <87wpi3q5wa.fsf@gmail.com>

Thank you for the explanation.  It turns out I did find a work-around which is exactly what you mentioned.  The only difference is instead of specifying the file name twice, I was able to get it only once and use the 'file' option to :results:

#+BEGIN_SRC perl :results output file :exports results :var fname=image.png
  use GD;
  my $image = build_pic();
  open( F, ">$fname" );
  binmode F
  print F $image;
  close( F );
  print $fname;
#+END_SRC

As you say, this uses Perl to output the file but with the 'file' option to ":results", Org expects a filename as the output result, I only need specify the filename once, and Org will still create a link for the results section:

#+RESULTS:
[[file:image.png]]

Thanks again for your help and info!

--dag

On September 22, 2016 9:02:45 AM PDT, Aaron Ecay <aaronecay@gmail.com> wrote:
>Hi David,
>
>The way you have this code set up, perl will print a string to its
>stdout.  Emacs will read that string into a buffer, then write it to a
>file.
>
>It would be simpler to write the file directly from perl.  Note that
>this will require specifying the file name twice (in the :file header
>and in the perl code).  This is because ob-perl does not support the
>:results graphics syntax (which could be classed as a wishlist-type
>bug).

-- 
David A. Gershman, CISSP
dagershman@dagertech.net

      reply	other threads:[~2016-09-22 17:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 22:38 Babel Export - Getting asked for coding system David A. Gershman
2016-09-22 16:02 ` Aaron Ecay
2016-09-22 17:14   ` David A. Gershman [this message]

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=8E534C8D-EE51-4246-9A11-771732C9CC47@dagertech.net \
    --to=dagershman@dagertech.net \
    --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).