emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Programmatically insert source-blocks
Date: Wed, 20 Mar 2013 23:03:23 +0100	[thread overview]
Message-ID: <8738vppw44.fsf@gmail.com> (raw)
In-Reply-To: m2fvzphkey.fsf@christianmoe.com

Christian Moe <mail@christianmoe.com> 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

  reply	other threads:[~2013-03-20 22:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 19:36 Programmatically insert source-blocks Thorsten Jolitz
2013-03-20 20:43 ` Christian Moe
2013-03-20 22:03   ` Thorsten Jolitz [this message]
2013-03-23 22:35     ` Eric Schulte
2013-03-25  5:54       ` Bastien

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=8738vppw44.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).