From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: Babel questions for finalising Processing support Date: Sat, 07 Mar 2015 14:47:18 +0000 Message-ID: <87sidgn9u1.fsf@gmail.com> References: <87vbiee7wo.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUG16-0002PO-8X for emacs-orgmode@gnu.org; Sat, 07 Mar 2015 09:47:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUG12-0001Oq-A6 for emacs-orgmode@gnu.org; Sat, 07 Mar 2015 09:47:48 -0500 Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]:36355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUG12-0001Oa-3V for emacs-orgmode@gnu.org; Sat, 07 Mar 2015 09:47:44 -0500 Received: by wghk14 with SMTP id k14so15013025wgh.3 for ; Sat, 07 Mar 2015 06:47:43 -0800 (PST) In-Reply-To: <87vbiee7wo.fsf@iki.fi> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jarmo Hurri , emacs-orgmode@gnu.org Hi Jarmo, It=E2=80=99s good to hear of your progress! 2015ko martxoak 6an, Jarmo Hurri-ek idatzi zuen: >=20 > Greetings. >=20 > My implementation of Processing support in Babel is proceeding really > well! I have now both external viewing of sketches and export to html > (sketches drawn by browser) working. >=20 > There are a number of details to fix, though. >=20 > 1. When editing Processing code with C-c ' I get an error from > processing-mode. Editing with C-c ' works just fine, but the error is > annoying. It seems to me the error is caused by the fact that > processing-mode refers to buffer-file-name, which is not valid in a > temporary buffer. Any ideas on how to fix this inside org? (Wouldn't > want to get involved with processing-mode if it can be avoided.) Why not? It sounds like their code is causing the problem. > Is > there for example a hook I could use to set buffer-file-name to some > temporary value? You could look at the first answer here for inspiration: . I=E2=80=99d say you should try to have processing-mode made more robust bef= ore pursuing hacky solutions. >=20 > 2. When processing code is executed with C-c C-c, it shows the sketch in > an external viewer. When exported, the results are html code. To this > end I have set default header arguments for Processing to be > ":results html" and ":exports results". With C-c C-c execution, > org-babel-execute:processing returns nil. >=20 > This works fine otherwise, but even C-c C-c execution produces an > empty results section: >=20 > #+RESULTS: > #+BEGIN_HTML > #+END_HTML >=20 > This is a nuisance, since C-c C-c execution always also changes the > current file (even though nothing changes). Is there a way to avoid > this? I think your org-babel-execute:processing should return nil (the elisp value). This should be caught by the first branch of the cond below the comment =E2=80=9C;; insert results based on type=E2=80=9D in org-babel-inse= rt-result, leading to the begin/end not being inserted. (Maybe you already figured this out, based on your later email.) >=20=20=20=20 > 3. In ob-processing.el I (require 'ob). However, to avoid a compiler > warning about a free variable I still need to declare >=20 > (eval-when-compile (defvar org-babel-temporary-directory)) >=20 > Is this ok? This looks bogus. The defvar for org-babel-temporary-directory is not evaluated when noninteractive is true. I think the defvar should be unconditional, but I also don=E2=80=99t understand why the code is like tha= t in the first place, so let=E2=80=99s see if someone knows why before changing = it. >=20 > 4. Processing support in Babel will depend on processing2-emacs module, > which contains the function processing-sketch-run. Again, to avoid > compiler warnings, I am declaring this by >=20 > (declare-function processing-sketch-run "processing-mode.el" nil) >=20 > Is this ok? Are you not doing (require 'processing-mode)? If you do that, I don=E2=80= =99t understand why the declare-function is also needed. --=20 Aaron Ecay