From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: Programmatically insert source-blocks Date: Wed, 20 Mar 2013 23:03:23 +0100 Message-ID: <8738vppw44.fsf@gmail.com> References: <87k3p1q2xj.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:58887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIR6f-0006FB-Pv for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 18:03:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIR6e-0003ya-ET for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 18:03:37 -0400 Received: from plane.gmane.org ([80.91.229.3]:45115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIR6e-0003yT-7t for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 18:03:36 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UIR6z-0000hS-WD for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 23:03:58 +0100 Received: from e178055100.adsl.alicedsl.de ([85.178.55.100]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Mar 2013 23:03:57 +0100 Received: from tjolitz by e178055100.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Mar 2013 23:03:57 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Christian Moe 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