[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Programmatically insert source-blocks
From: |
Thorsten Jolitz |
Subject: |
Re: [O] Programmatically insert source-blocks |
Date: |
Wed, 20 Mar 2013 23:03:23 +0100 |
User-agent: |
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux) |
Christian Moe <address@hidden> writes:
Hi Christian,
> Here's one way, and pointers to more:
> http://lists.gnu.org/archive/html/emacs-orgmode/2011-04/msg00406.html
thanks for the links.
I mean, it is not toooo difficult to write a function like
,----------------------------------------------------------
| (defun org-insert-block (lang)
| (interactive "Mlanguage: ")
| (insert (format "#+begin_src %s\n \n#+end_src" lang))
| (goto-char (- (point) 10)))
`----------------------------------------------------------
or to write insert statements like
,-------------------------------------------------------
| (insert (format "#+begin_src %s\n \n#+end_src" lang))
`-------------------------------------------------------
in a program - but I find it strange that this is not part of core
Org-mode functionality. There are dozens of functions that deal with
existing code-blocks, but none (non-interactive) that creates/inserts
a code-block.
So here is my FEATURE REQUEST:
either modify `org-babel-demarcate-block' so that it can be used to
insert a language-specific code-block (with args?) non-interactively, or
add something like `org-insert-block' to Org-mode's core. I would prefer
signature
,----------------------------------------------
| (defun org-insert-block (lang &rest args)...)
`----------------------------------------------
to be able to specify the src-block headline exactly in a program that
uses this function.
--
cheers,
Thorsten