(define-key org-mode-map (kbd "C-c C-b") 'rgr/org-split-src)
(defun rgr/org-split-src(&optional arg)
(interactive "P")
(beginning-of-line)
((lambda(info)
(if info
(let ((pos (point))
(lang (nth 0 info))
(stars (make-string (org-current-level) ?*)))
(insert
(format
"%s\n%s \n#+begin_src %s\n%s#+end_src\n%s \n#+begin_src %s\n"
"#+end_src"
stars
lang
(if (region-active-p)
(delete-and-extract-region (region-beginning) (region-end)) "\n")
stars
lang))
(org-back-to-heading))
(insert
(format
"\n#+begin_src\n%s\n#+end_src\n"
(if (region-active-p)
(delete-and-extract-region (region-beginning) (region-end)) "")))))
(org-babel-get-src-block-info)))
--
My Emacs Files At GitHub
No comments:
Post a Comment