emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel evaluation of Calc block not working, bug in Calc?
@ 2014-09-22  7:04 H. Dieter Wilhelm
  2014-09-28 23:56 ` Andrea Rossetti
  0 siblings, 1 reply; 6+ messages in thread
From: H. Dieter Wilhelm @ 2014-09-22  7:04 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Jay Belanger

Hello Orgers,

please consider: Emacs -Q and evaluate the following

#+BEGIN_SRC emacs-lisp
(org-babel-do-load-languages
 'org-babel-load-languages
 '((calc . t)
   (emacs-lisp . t)
   ))
#+END_SRC

#+RESULTS:
| (calc . t) | (emacs-lisp . t) |

The following works as expected

#+BEGIN_SRC calc :var V=3
V + 4
#+END_SRC

But now we are getting: byte-code: Symbol's function definition is void:
v!

#+BEGIN_SRC calc :var v=3
v + 4
#+END_SRC

Calc thinks that the variable v contains a function even though nothing
should be undefined for v and when trying debug-on-entry for
calc-var-value the expression (boundp v) returns t!?  I'm stuck at this
point, could you please have a look, I've no idea how to debug this
further.

GNU Emacs 24.3.93.3 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.24) of
2014-09-17 on vsl28t2g With the latest org-mode from git 

Thanks
        Dieter
-- 
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany

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

* Re: Babel evaluation of Calc block not working, bug in Calc?
  2014-09-22  7:04 Babel evaluation of Calc block not working, bug in Calc? H. Dieter Wilhelm
@ 2014-09-28 23:56 ` Andrea Rossetti
  2014-09-29 17:51   ` Andrea Rossetti
  0 siblings, 1 reply; 6+ messages in thread
From: Andrea Rossetti @ 2014-09-28 23:56 UTC (permalink / raw)
  To: emacs-orgmode

dieter@duenenhof-wilhelm.de (H. Dieter Wilhelm) writes:
> But now we are getting: byte-code: Symbol's function definition is void:
> v!
>
> #+BEGIN_SRC calc :var v=3
> v + 4
> #+END_SRC
>

Hello Dieter, I think I got it!

1) I see the same error message as you see, for variables with
name "v" or "var"

2) diagnosys: I see that Calc tries to avoid name collisions by
adding a "var-" prefix to variable names, and by removing it when
it needs to. (see code in functions "calc-read-var-name" and
"calc-var-name")

3) temporary workaround: try to change ":var v=3" into ":var var-v=3",
it works for me, does it work for you too?

4) proposed correction (untested, and makes sense only if workaround 
actually works): in ob-calc.el, function org-babel-execute:calc,
the invocation of "calc-store-into" could prepend 'var- to its argument

5) warning: if one applies correction 4), then workaround 3) doesn't
work anymore 

  Hope it helps and makes sense for you too, kindest regards.

 Andrea

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

* Re: Babel evaluation of Calc block not working, bug in Calc?
  2014-09-28 23:56 ` Andrea Rossetti
@ 2014-09-29 17:51   ` Andrea Rossetti
  2014-10-04 18:31     ` H. Dieter Wilhelm
  0 siblings, 1 reply; 6+ messages in thread
From: Andrea Rossetti @ 2014-09-29 17:51 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: dieter

Andrea Rossetti <andrea.rossetti@gmail.com> writes:
> 3) temporary workaround: try to change ":var v=3" into ":var var-v=3",
> it works for me, does it work for you too?

I'm afraid I've been a bit cryptic here.
The suggested workaround/test is: replace

#+BEGIN_SRC calc :var v=3
 v + 4
#+END_SRC

with

#+BEGIN_SRC calc :var var-v=3
 v + 4
#+END_SRC

Kindest regards, 

  Andrea

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

* Re: Babel evaluation of Calc block not working, bug in Calc?
  2014-09-29 17:51   ` Andrea Rossetti
@ 2014-10-04 18:31     ` H. Dieter Wilhelm
  2014-10-06 20:31       ` Andrea Rossetti
  0 siblings, 1 reply; 6+ messages in thread
From: H. Dieter Wilhelm @ 2014-10-04 18:31 UTC (permalink / raw)
  To: emacs-orgmode

Hello Andrea 8-)

Andrea Rossetti <andrea.rossetti@gmail.com> writes:
> Andrea Rossetti <andrea.rossetti@gmail.com> writes:
>> 3) temporary workaround: try to change ":var v=3" into ":var var-v=3",
>> it works for me, does it work for you too?
> The suggested workaround/test is: replace
>
> #+BEGIN_SRC calc :var v=3
>  v + 4
> #+END_SRC
>
> with
>
> #+BEGIN_SRC calc :var var-v=3
>  v + 4
> #+END_SRC

This is working for me as well, I think this will help me to understand
what is going on...

Thank you for you help
     Dieter

PS: Are you using Calc regularly?
-- 
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany

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

* Re: Babel evaluation of Calc block not working, bug in Calc?
  2014-10-04 18:31     ` H. Dieter Wilhelm
@ 2014-10-06 20:31       ` Andrea Rossetti
  2014-10-07  6:21         ` H. Dieter Wilhelm
  0 siblings, 1 reply; 6+ messages in thread
From: Andrea Rossetti @ 2014-10-06 20:31 UTC (permalink / raw)
  To: H. Dieter Wilhelm; +Cc: emacs-orgmode

Hi Dieter,

dieter@duenenhof-wilhelm.de (H. Dieter Wilhelm) writes:
> PS: Are you using Calc regularly?

Compact answer: no :(

Detailed answer: I do like Calc and Org+Babel+Calc,
but my daily job doesn't involve any maths.

The Org functions I use most frequently are:
- org-clock-in, org-clock-out, agenda view
- org-columns
- simple exports of TODOs or clocktable in HTML
  or PDF format

Kindest regards,

  Andrea

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

* Re: Babel evaluation of Calc block not working, bug in Calc?
  2014-10-06 20:31       ` Andrea Rossetti
@ 2014-10-07  6:21         ` H. Dieter Wilhelm
  0 siblings, 0 replies; 6+ messages in thread
From: H. Dieter Wilhelm @ 2014-10-07  6:21 UTC (permalink / raw)
  To: emacs-orgmode

Andrea Rossetti <andrea.rossetti@gmail.com> writes:
>> PS: Are you using Calc regularly?
> Compact answer: no :(
> Detailed answer: I do like Calc and Org+Babel+Calc,
> but my daily job doesn't involve any maths.

Then it's understandable, the UI of Calc is very fast but also very,
very abstract.

My hope is that with the Babel interface Calc can get a push.  There is
some potential, although it remains a lot to improve to have a workable
computer algebra system (CAS) in the line of Maxima, Maple, Mathematica
et al. :-|

> The Org functions I use most frequently are:
> - org-clock-in, org-clock-out, agenda view
> - org-columns
> - simple exports of TODOs or clocktable in HTML
>   or PDF format

That is the strength of Org-mode: The combination of code and beautiful
documentation. :-D

               Dieter
-- 
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany

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

end of thread, other threads:[~2014-10-07  6:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-22  7:04 Babel evaluation of Calc block not working, bug in Calc? H. Dieter Wilhelm
2014-09-28 23:56 ` Andrea Rossetti
2014-09-29 17:51   ` Andrea Rossetti
2014-10-04 18:31     ` H. Dieter Wilhelm
2014-10-06 20:31       ` Andrea Rossetti
2014-10-07  6:21         ` H. Dieter Wilhelm

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