From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Oesting Subject: Possible Calc support for Org-Babel? Date: Fri, 22 Oct 2010 13:17:28 -0400 Message-ID: <7CDB7386-9B39-46CB-94E8-C6B5CBD59C4F@me.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT Return-path: Received: from [140.186.70.92] (port=44773 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P9LFf-00021y-FI for emacs-orgmode@gnu.org; Fri, 22 Oct 2010 13:18:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P9LFe-00084r-9L for emacs-orgmode@gnu.org; Fri, 22 Oct 2010 13:17:59 -0400 Received: from asmtpout030.mac.com ([17.148.16.105]:36277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P9LFe-00084E-3n for emacs-orgmode@gnu.org; Fri, 22 Oct 2010 13:17:58 -0400 Received: from lawn-128-61-112-92.lawn.gatech.edu (lawn-128-61-112-92.lawn.gatech.edu [128.61.112.92]) by asmtp030.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0LAP00JMZC14HR40@asmtp030.mac.com> for emacs-orgmode@gnu.org; Fri, 22 Oct 2010 10:17:30 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org A few of us at my institution have started using CALC in our documents (not embedded, which is far too clumsy for most of us, but C-x * u and simple embedded phrases, often to the tune of several pages) to use Emacs text files rather like Maple and Mathematica files. We're starting to use GIT and OrgMode together to format the work and save versions and forks; while there are many CAS packages that can be used to write out memos and reports, the power of Elisp/Emacs was simply too good to pass up. It appears that Calc syntax can be used to assign formulas to spreadsheets, but the result is difficult to read, and unsuitable for a sequence of several dozen lines. Similarly, using embedded Ruby-symbolic code in the text produces excellent results, but we lose the ability to take advantage of Calc, which is significantly stronger for our purposes. Other symbolic packages require more time to learn and are difficult to implement across all of our various platforms, whereas Calc is a universal and extremely flexible tool for this work. My questions are these: * Has there been implemented, or would it be at all difficult to implement, a 'calc' language functionality for Org-Babel allowing the following manner of text: > #+begin_src calc :results output > Fish = 2 > Dog = 2 * Fish > > sqrt( Dog ) => > sqrt( 4 ) => > #+end_src > > #+results: > : sqrt( Dog ) => 2 > : sqrt( 4 ) = 2 The goal of this exercise would simply be to cut out the text from the code block, feed it to a buffer, run the Emacs Calc mode on it, and then output the appropriate results where => occurs. * Has there been implemented, or would it be at all difficult to implement, a 'running tag' approach to the Calc mode, essentially a #+CALC directive allowing the following manner of text, preferably with auto-update: > This is a discussion. > > #+CALC: Fish = 2 > > Fish deserves significant commentary; however, we expect that there is some command > that would allow us to update the entire buffer's #+CALC sequence. Thus: > > #+CALC: Dog = 2 * Fish > #+CALC: sqrt( Dog ) => > #+results: > : sqrt( Dog ) => 2 > > If you need a different result, tweak the 'Fish =' line, above, and request a re-sequencing, > either via C-c C-c or via some M-x command, resulting in behavior functionally similar to > C-x * u. The goal of this exercise would be, upon updating, to strip all lines beginning with #+CALC and feed them to a buffer, inserting the results of => statements where the respective line occurs. The benefit of this method over the previous is that it allows for assignments (:=) enduring across entire files (though the same could be accomplished if one SRC_BEGIN block could somehow call another.) In conclusion, it seems to me that I cannot possibly be the first person to have done research in OrgMode, and that these problems were likely solved long ago. When searching the manual, however, I find nothing that produces a distinctly clear and encapsulated Calc embed in OrgMode. Do these exist, and if not, would it require mere hours of time to implement them, or weeks? Is there a tutorial on writing OrgMode extensions? - M