[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Where to define functions for use with org
From: |
Eric Schulte |
Subject: |
Re: [Orgmode] Where to define functions for use with org |
Date: |
Fri, 31 Oct 2008 14:39:08 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Daniel Clemente <address@hidden> writes:
> Hi, I'd like some suggestions about storing (defun)s in .org-files.
>
> Sometimes Org must use ELisp functions, for instance:
> - a dynamic table uses a function org-dblock-write:some_name to create its
> contents
> - a table uses a formula like $5='(my-function $2) which does a calculation
> not available in calc
>
> These scenarios require that you have already the functions you will
> use. If you wrote the (defun ...) in your code, you must go there
> and do C-x C-e to evaluate all of them.
>
> My question is: ¿how would you make this process automatic and still
> distribute the function code together with the .org file?
>
Hi Daniel,
I ran into a problem similar to you description above, and developed a
solution in the form of a modified version of org-eval.el (in the
contrib directory of the org-mode source). It is like org-eval except
for the following changes...
,----[org-eval-light.el]
| ;;; Changes: by Eric Schulte
| ;;
| ;; 1) forms are only executed manually, (allowing for the execution of
| ;; an entire subtree of forms)
| ;; 2) use the org-mode style src blocks, rather than the muse style
| ;; <code></code> blocks
| ;; 3) forms are not replaced by their outputs, but rather the output
| ;; is placed in the buffer immediately following the src block
| ;; commented by `org-eval-light-make-region-example' (when
| ;; evaluated with a prefix argument no output is placed in the
| ;; buffer)
| ;; 4) add defadvice to org-ctrl-c-ctrl-c so that when called inside of
| ;; a source block it will call `org-eval-light-current-snippet'
`----
My modified version is available at
http://github.com/eschulte/org-contrib/tree/master/org-eval-light.el
It's been working fairly well for me, in fact I was going to push this
to the mailing list anyways, but wanted to play with it some more.
Cheers -- Eric