From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Embedded elisp formulas, was: Spreadsheet and weighted means Date: Wed, 01 Oct 2008 17:03:00 -0700 Message-ID: <87y717uamj.fsf@gmail.com> References: <87wsh7w589.fsf@selenimh.orion.org> <9136F031-BBCD-4A80-A117-6047C5D3F777@uva.nl> <87y718nu0l.fsf@selenimh.orion.org> <871vz0t7z5.fsf_-_@gmail.com> <87prmk5ab6.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KlBeq-00011i-DB for emacs-orgmode@gnu.org; Wed, 01 Oct 2008 20:03:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KlBep-00011P-5u for emacs-orgmode@gnu.org; Wed, 01 Oct 2008 20:03:04 -0400 Received: from [199.232.76.173] (port=43888 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlBeo-00011M-Vx for emacs-orgmode@gnu.org; Wed, 01 Oct 2008 20:03:03 -0400 Received: from wf-out-1314.google.com ([209.85.200.169]:24175) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KlBeo-00075E-FN for emacs-orgmode@gnu.org; Wed, 01 Oct 2008 20:03:02 -0400 Received: by wf-out-1314.google.com with SMTP id 28so825280wfc.24 for ; Wed, 01 Oct 2008 17:03:01 -0700 (PDT) In-Reply-To: <87prmk5ab6.fsf@gmail.com> (Paul R.'s message of "Wed, 01 Oct 2008 22:29:01 +0200") 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: Paul R Cc: Carsten Dominik , emacs-orgmode@gnu.org Paul R writes: > On Wed, 01 Oct 2008 12:45:34 -0700, "Eric Schulte" said: > >> This raises an issue I've been running into recently, If I have >> a multi-line elisp function (I guess same issue would apply for >> multi-line shell commands) that I want to use from an org file (for >> example to compute table columns), is there a way to save and load >> the function from the org file? I've tried multiline [[elisp: ]] >> links but they don't work well, maybe something like... > > maybe you can use the emacs facility to load code when visiting > a file. For more information, read the following info node : > File: emacs, Node: Specifying File Variables I looked at this, but then I ran across org-eval.el in the org/contrib/lisp directory. With (require 'org-eval) in my .emacs I can put something like the following (defun my-specific-function-for-this-file (org-tabl-cell) (format "%S" (do-something-special (read org-tabl-cell)))) in an org file and org-eval is nice enough to evaluate the code defining the function upon opening the file, to display only the name of the function in a special face, and to allow me to edit the function in the appropriate mode with C-' (also works for ruby/shell/python/etc...). Everything I could have asked for! It nice to request a feature and find it's already implemented. Thanks -- Eric