emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Tobias Zawada <i_inbox@tn-home.de>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: [BUG] ob-octave.el
Date: Sat, 29 Oct 2022 05:54:04 +0000	[thread overview]
Message-ID: <87r0yri39f.fsf@localhost> (raw)
In-Reply-To: <217078597.347872.1639979694777@email.ionos.de>

[-- Attachment #1: Type: text/plain, Size: 815 bytes --]

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"]
> 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"]
> #+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)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-octave-Fix-octave-results-value-parsing.patch --]
[-- Type: text/x-patch, Size: 1063 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 225 bytes --]

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	other threads:[~2022-10-29  5:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20  5:54 [BUG] ob-octave.el Tobias Zawada
2022-10-29  5:54 ` Ihor Radchenko [this message]
2022-11-16  4:46   ` Ihor Radchenko

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:

  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=87r0yri39f.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=i_inbox@tn-home.de \


* 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


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