emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Daniel Clemente <n142857@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Where to define functions for use with org
Date: Fri, 31 Oct 2008 14:39:08 -0700	[thread overview]
Message-ID: <87tzaso35v.fsf@gmail.com> (raw)
In-Reply-To: <87bpx25eci.fsf@gmail.com> (Daniel Clemente's message of "Thu, 30 Oct 2008 15:47:57 +0100")

Daniel Clemente <n142857@gmail.com> 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

      parent reply	other threads:[~2008-10-31 21:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30 14:47 Where to define functions for use with org Daniel Clemente
2008-10-30 15:47 ` Paul R
2008-10-31 21:39 ` Eric Schulte [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tzaso35v.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n142857@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).