emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem (bug?) evaluating octave code ("function name does not agree with file name)
@ 2015-08-18 13:42 Tomas Grigera
  2015-08-18 19:38 ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: Tomas Grigera @ 2015-08-18 13:42 UTC (permalink / raw)
  To: emacs-orgmode

Hello list,

I am a very happy user of orgmode and babel.  I recently picked up a
document from last year, and found that code blocks that used to
evaluate fine now don't.  A code block like this

#+BEGIN_SRC octave
1;
function y=dup(x)
  y=2*x;
end

dup(2)
#+END_SRC

fails with

: warning: function name 'dup' does not agree with function file name ''
: error: 'dup' undefined near line 1 column 1

on evaluating, despite the "1;" trick at the beginning.  Saving to
foo.m and running from octave works fine.

I'm using

Emacs 24.4.1
Org-mode version 8.3.1 (8.3.1-56-g17a225-elpa)
GNU Octave, version 3.8.2


There has been some change, of which I am unaware, in the way babel
handles this block that leads to this behaviour.  However, it seems to
me that it is a well-formed block and should evaluate fine.  Am I
wrong?

Thanks in advance

Tomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem (bug?) evaluating octave code ("function name does not agree with file name)
  2015-08-18 13:42 Problem (bug?) evaluating octave code ("function name does not agree with file name) Tomas Grigera
@ 2015-08-18 19:38 ` Eric S Fraga
  2015-08-18 21:10   ` Tomas Grigera
  0 siblings, 1 reply; 3+ messages in thread
From: Eric S Fraga @ 2015-08-18 19:38 UTC (permalink / raw)
  To: Tomas Grigera; +Cc: emacs-orgmode

On Tuesday, 18 Aug 2015 at 10:42, Tomas Grigera wrote:
> Hello list,
>
> I am a very happy user of orgmode and babel.  I recently picked up a
> document from last year, and found that code blocks that used to
> evaluate fine now don't.  A code block like this

[...]

> There has been some change, of which I am unaware, in the way babel
> handles this block that leads to this behaviour.  However, it seems to
> me that it is a well-formed block and should evaluate fine.  Am I
> wrong?

Just to confirm that you are not wrong and I ran into this a while ago
now.  That is, problems with functions defined in the middle of the code
as opposed to functions in their own .m files.  I didn't have time to
figure out what was wrong at the time due to deadlines so found other
ways of doing what I wanted including @(x) function definitions.

The strange thing is that babel seems to not leave any code in the /tmp
files it creates so I cannot see what code org babel is trying to execute.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-117-gc98729

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem (bug?) evaluating octave code ("function name does not agree with file name)
  2015-08-18 19:38 ` Eric S Fraga
@ 2015-08-18 21:10   ` Tomas Grigera
  0 siblings, 0 replies; 3+ messages in thread
From: Tomas Grigera @ 2015-08-18 21:10 UTC (permalink / raw)
  To: Tomas Grigera, emacs-orgmode

Thanks Eric,

My workaround was to use :session, though not completely satisfactory
(I need to clean up the output).

Your comment made me notice

1. octave reports the problem filename as empty
2. the undefined function call happens at 'line 1', which would not be
the case if the whole code block was copied to a file.

It seems babel is feeding octave the lines one-by-one.  Strange.

Tomas



On Tue, Aug 18, 2015 at 4:38 PM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> On Tuesday, 18 Aug 2015 at 10:42, Tomas Grigera wrote:
>> Hello list,
>>
>> I am a very happy user of orgmode and babel.  I recently picked up a
>> document from last year, and found that code blocks that used to
>> evaluate fine now don't.  A code block like this
>
> [...]
>
>> There has been some change, of which I am unaware, in the way babel
>> handles this block that leads to this behaviour.  However, it seems to
>> me that it is a well-formed block and should evaluate fine.  Am I
>> wrong?
>
> Just to confirm that you are not wrong and I ran into this a while ago
> now.  That is, problems with functions defined in the middle of the code
> as opposed to functions in their own .m files.  I didn't have time to
> figure out what was wrong at the time due to deadlines so found other
> ways of doing what I wanted including @(x) function definitions.
>
> The strange thing is that babel seems to not leave any code in the /tmp
> files it creates so I cannot see what code org babel is trying to execute.
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-117-gc98729

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-18 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-18 13:42 Problem (bug?) evaluating octave code ("function name does not agree with file name) Tomas Grigera
2015-08-18 19:38 ` Eric S Fraga
2015-08-18 21:10   ` Tomas Grigera

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