emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel Export - Getting asked for coding system
@ 2016-09-21 22:38 David A. Gershman
  2016-09-22 16:02 ` Aaron Ecay
  0 siblings, 1 reply; 3+ messages in thread
From: David A. Gershman @ 2016-09-21 22:38 UTC (permalink / raw)
  To: emacs-orgmode

I have a block of Perl using the GD library to generate a PNG:

#+BEGIN_SRC perl : results output :file output.png :exports results
  # code to generate png
  print $image -> png();
#+END_SRC

When I export, I get a buffer with the raw PNG data and the question (in the mini-buffer):

    Select coding system (default raw-text):

Hitting enter will then continue as expected.

Is there a way to specify just dumping the result out to the file without asking the question?  Adding 'raw' to ":results" doesn't do it.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Babel Export - Getting asked for coding system
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Ecay @ 2016-09-22 16:02 UTC (permalink / raw)
  To: David A. Gershman, emacs-orgmode

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).

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Babel Export - Getting asked for coding system
  2016-09-22 16:02 ` Aaron Ecay
@ 2016-09-22 17:14   ` David A. Gershman
  0 siblings, 0 replies; 3+ messages in thread
From: David A. Gershman @ 2016-09-22 17:14 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-22 17:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).