you are right, I meant C-y ;) I have these templates defined in my setup:
;; * Expansions for blocks ;; add <p for python expansion (add-to-list 'org-structure-template-alist '("p" "#+BEGIN_SRC python\n?\n#+END_SRC" "<src lang=\"python\">\n?\n</src>")) ;; add <por for python expansion with raw output (add-to-list 'org-structure-template-alist '("por" "#+BEGIN_SRC python :results output raw\n?\n#+END_SRC" "<src lang=\"python\">\n?\n</src>")) ;; add <pv for python expansion with value (add-to-list 'org-structure-template-alist '("pv" "#+BEGIN_SRC python :results value\n?\n#+END_SRC" "<src lang=\"python\">\n?\n</src>")) ;; add <el for emacs-lisp expansion (add-to-list 'org-structure-template-alist '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC" "<src lang=\"emacs-lisp\">\n?\n</src>")) ;; add <sh for shell (add-to-list 'org-structure-template-alist '("sh" "#+BEGIN_SRC sh\n?\n#+END_SRC" "<src lang=\"shell\">\n?\n</src>")) John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Fri, Apr 17, 2015 at 11:08 AM, Jorge A. Alfaro-Murillo < jorge.alfaro-muri...@yale.edu> wrote: > John Kitchin writes: > > I like this kind of keyboard shortcut: >> For python: <p TAB C-w >> For emacs-lisp >> <el TAB C-w >> > > I agree, this is the best method. Although probably you mean C-y instead > of C-w. > > For the record, this requires you to set up `org-structure-template-alist' > to include python and emacs-lisp. For example, I use p and E, for python > and emacs-lisp, so in my .emacs I have: > > #+BEGIN_SRC emacs-lisp > (eval-after-load "org" > '(progn > (add-to-list 'org-structure-template-alist > '("E" > "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC" > "<src > lang=\\"emacs-lisp\\">\n\n?</src>")) > (add-to-list 'org-structure-template-alist > '("p" > "#+BEGIN_SRC python\n?\n#+END_SRC" > "<src > lang=\\"python\\">\n\n?</src>")))) > #+END_SRC > > I even use the method in message-mode, for writing emails with code, like > I just did now =) > > Best, > > -- > Jorge. > > >