From: Eric Schulte <eric.schulte@gmx.com>
To: Thomas Alexander Gerds <tagteam@sund.ku.dk>
Cc: emacs-orgmode@gnu.org
Subject: Re: help regarding babel to set in-buffer specific keybinding
Date: Wed, 08 Feb 2012 07:34:45 -0700 [thread overview]
Message-ID: <87ty31nzor.fsf@gmx.com> (raw)
In-Reply-To: grb6151uq57p91.fsf@linuxifsv005.sund.root.ku.dk
Thomas Alexander Gerds <tagteam@sund.ku.dk> writes:
> here is a (beginner) question regarding the following org-file with
> buffer-local function and keybinding:
>
> ,----
> |
> | * Lisp header (C-c C-c to activate)
> | #+BEGIN_SRC emacs-lisp
> | (defun blue-file ()
> | (interactive)
> | (org-table-insert-row 'below)
> | (org-table-goto-column 1)
> | (insert (format-time-string "%d.%m.%Y"))
> | (org-table-goto-column 2)
> | (org-table-copy-down 1)
> | (org-table-goto-column 3)
> | (org-table-copy-down 1)
> | (org-table-goto-column 4))
> | (define-key org-mode-map [(meta return)] 'blue-file)
> | #+END_SRC
> |
> | #+RESULTS:
> | : blue-file
> |
> |
> | | Date | Staff | Type | Name | Value |
> | |------+--------------+-------------+------+-------|
> | | | Anders And | consulting | | |
> | | | Anders And | supervision | | |
> | | | Anders And | teaching | | |
> | | | Mickey Mouse | consulting | | |
> | | | Mickey Mouse | supervision | | |
> | | | Mickey Mouse | teaching | | |
> `----
>
> now, I would like to tell org to evaluate the lisp code at startup, when
> the org-file is opened. can this be achieved? particularly, is there a
> startup special line which tells org to evaluate the lisp src block? I
> could add a suitable function to org-mode-hook, but is this the
> recommended way?
>
> also, I would like to make org-mode-map buffer-local ... but certainly
> this is not an orgmode question.
>
> suggestions/help are very much appreciated!
>
> Tomy
>
There is not currently any support for evaluating specific code blocks
on buffer open. You could move your elisp code into a
buffer-local-variable block (which can house functions) and which are
evaluated when buffers are opened. I believe all changes made in such
blocks are buffer local, so that may be your best bet.
See [[info:elisp#File%20Local%20Variables][info:elisp#File Local Variables]]
or http://www.emacswiki.org/emacs/FileLocalVariables
Cheers,
--
Eric Schulte
http://cs.unm.edu/~eschulte/
next prev parent reply other threads:[~2012-02-08 14:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 7:34 help regarding babel to set in-buffer specific keybinding Thomas Alexander Gerds
2012-02-08 14:34 ` Eric Schulte [this message]
2012-02-08 16:10 ` Eric S Fraga
2012-02-08 23:32 ` Torsten Wagner
2012-02-09 7:14 ` Thomas Alexander Gerds
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=87ty31nzor.fsf@gmx.com \
--to=eric.schulte@gmx.com \
--cc=emacs-orgmode@gnu.org \
--cc=tagteam@sund.ku.dk \
/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).