* [BUG] ob-octave.el
@ 2021-12-20 5:54 Tobias Zawada
2022-10-29 5:54 ` Ihor Radchenko
0 siblings, 1 reply; 3+ messages in thread
From: Tobias Zawada @ 2021-12-20 5:54 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
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.
The old behavior for scalar strings still works:
#+BEGIN_SRC octave
"Some string."
#+END_SRC
#+RESULTS:
: Some string.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] ob-octave.el
2021-12-20 5:54 [BUG] ob-octave.el Tobias Zawada
@ 2022-10-29 5:54 ` Ihor Radchenko
2022-11-16 4:46 ` Ihor Radchenko
0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2022-10-29 5:54 UTC (permalink / raw)
To: Tobias Zawada; +Cc: emacs-orgmode@gnu.org
[-- 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"]
> #+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
[-- 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
"%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
[-- 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>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [BUG] ob-octave.el
2022-10-29 5:54 ` Ihor Radchenko
@ 2022-11-16 4:46 ` Ihor Radchenko
0 siblings, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2022-11-16 4:46 UTC (permalink / raw)
To: Tobias Zawada; +Cc: emacs-orgmode@gnu.org
Ihor Radchenko <yantar92@posteo.net> writes:
> 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.
Applied onto main.
Fixed.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d09413538
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-16 4:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-20 5:54 [BUG] ob-octave.el Tobias Zawada
2022-10-29 5:54 ` Ihor Radchenko
2022-11-16 4:46 ` Ihor Radchenko
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).