emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] help regarding babel to set in-buffer specific keybinding


From: Thomas Alexander Gerds
Subject: Re: [O] help regarding babel to set in-buffer specific keybinding
Date: Thu, 9 Feb 2012 08:14:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

this works. thanks for the hint!

Eric Schulte <address@hidden> writes:

> Thomas Alexander Gerds <address@hidden> 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,
--
Thomas A. Gerds -- Assoc. Prof. Department of Biostatistics
University of Copenhagen, Ă˜ster Farimagsgade 5, 1014 Copenhagen, Denmark
Office: CSS-15.2.07 (Gamle Kommunehospital)
tel: 35327914 (sec: 35327901) 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]