I've tried to setup a skeleton to speed up entering org source blocks
(define-skeleton skel-org-block "Insert an org block, querying for type." "Type: " "#+begin_" str " " (setq v1 (skeleton-read "Language and headers?: ")) "\n" _ - \n "#+end_" str "\n") (global-set-key (kbd "C-c b") 'skel-org-block)
This works fine in a fresh .org file. But problems occur when I try to add a new source block above an existing one:
C-c babove the block
#+begin_src python blah #+end_src
adds a comma before the first line of the old block:
#+begin_src python #+end_src ,#+begin_src python blah #+end_src
- If I'm adding a new block via
C-c bto the very end of an org file, I can leave the "Language and headers?: " prompt in the minibuffer blank, and I get a simple org block. If I repeat this above an existing org block, I get a message saying
org-edit-src-code: No such language mode: nil-mode.
Something's clearly going wrong with the line
(setq v1 (skeleton-read "Language and headers?: ")), but I'm not sure what.
Is there a fix? Is there a simpler skeleton to help me create an org block on the fly, with headers? (I could always remove the
setq line, but I'd like to be able to specify language and switches.)