emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Babel: RESULTS for no value


From: Jarmo Hurri
Subject: Re: [O] Babel: RESULTS for no value
Date: Sat, 07 Mar 2015 19:36:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Aaron Ecay <address@hidden> writes:

> It might be a little distracting to see it there, but it shouldn’t
> interfere with the functionality in any way (for example, it should be
> invisible on export).  It the line’s presence causing any problems for
> your code?

It is a nuisance. To summarize, in my current implementation of
Processing support, whenever I execute a Processing code with C-c C-c to
view the resulting sketch in an external window, the following lines
appear in the org file:

#+RESULTS:
#+BEGIN_HTML
#+END_HTML

Furthermore, the HTML lines are replaced on every new execution of the
code, making the org buffer change on every execution. That is not very
convenient.

Let me try to explain how I have implemented support for
Processing. When Processing code is executed with C-c C-c, it does not
return any value: the sketch (graphics) is shown in an external
window. But when the results of the code are exported, the code is
written as html, embedded in a processing.js script. The html code then
draws the sketch when viewed in a browser. It works really well, and I
am mighty proud of that idea. ;-)

To achieve this behaviour, I have set

(defvar org-babel-default-header-args:processing
  '((:results . "html") (:exports . "results"))
  "Default arguments when evaluating a Processing source block.")

This yields correct behaviour when the results are exported. However,
this also causes for the #+BEGIN_HTML #+END_HTML lines to appear when no
value is returned.

In function org-babel-execute:processing I can identify whether
execution is done for exporting by checking whether
org-babel-exp-reference-buffer is null. If an export is not done, the
function launches the external viewer and returns nil. If an export is
done, the function returns the html code.

There might be other ways around the problem - that would not involve
removal of #+RESULTS: when no value is produced - but I have not been
able to figure out a solution.

Jarmo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]