emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] ob-octave.el


From: Ihor Radchenko
Subject: Re: [BUG] ob-octave.el
Date: Sat, 29 Oct 2022 05:54:04 +0000

Tobias Zawada <i_inbox@tn-home.de> writes:

> Currently, evaluating the Org-mode source block
>
> #+NAME: bug
> #+BEGIN_SRC octave :exports results
> ["one"; "two"; "three"]
> #+END_SRC
>
> gives
>
> #+RESULTS: bug
> : ottnwheor  e  e
>
> Substituting ~fprintf~ in ~org-babel-octave-wrapper-method~ with ~fdisp~ 
> changes the output to
>
> #+NAME: bug
> #+BEGIN_SRC octave :exports results
> ["one"; "two"; "three"]
> #+END_SRC
>
> #+RESULTS: bug
> | one   |
> | two   |
> | three |
>
> which is more adequate.

Thanks for reporting, and sorry for the late reply.
Your suggestion looks fine, although I am a bit concerned if the
trailing newline in the old version was significant.

Can you please test the attached patch when the output long and occupies
multiple lines? (I am not familiar with octave)

Best,
Ihor

>From ac15cc43b0f755da186301c826c74a8010b3f8a9 Mon Sep 17 00:00:00 2001
Message-Id: 
<ac15cc43b0f755da186301c826c74a8010b3f8a9.1667022604.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sat, 29 Oct 2022 13:48:45 +0800
Subject: [PATCH] ob-octave: Fix octave :results value parsing

* lisp/ob-octave.el (org-babel-octave-wrapper-method): Use fdisp
instead of fprintf.

Reported-by: Alexandre Duret-Lutz <adl@lrde.epita.fr>
Link: https://orgmode.org/list/217078597.347872.1639979694777@email.ionos.de
---
 lisp/ob-octave.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index 55926b789..b0a7767ec 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -61,7 +61,7 @@ (defvar org-babel-matlab-emacs-link-wrapper-method
 ")
 (defvar org-babel-octave-wrapper-method
   "%s
-if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); 
fclose(fid);
+if ischar(ans), fid = fopen('%s', 'w'); fdisp(fid, ans); fclose(fid);
 else, dlmwrite('%s', ans, '\\t')
 end")
 
-- 
2.35.1


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

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