From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: paste from clip to code block Date: Fri, 17 Apr 2015 11:17:40 -0400 Message-ID: References: <87383ypzbd.fsf@yale.edu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b15aaadc3eba60513ed14c8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj81l-0005OS-2h for emacs-orgmode@gnu.org; Fri, 17 Apr 2015 11:18:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yj81j-0006x7-K1 for emacs-orgmode@gnu.org; Fri, 17 Apr 2015 11:17:57 -0400 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]:36572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj81j-0006wu-7g for emacs-orgmode@gnu.org; Fri, 17 Apr 2015 11:17:55 -0400 Received: by pabsx10 with SMTP id sx10so128214338pab.3 for ; Fri, 17 Apr 2015 08:17:54 -0700 (PDT) In-Reply-To: <87383ypzbd.fsf@yale.edu> 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: "Jorge A. Alfaro-Murillo" Cc: "emacs-orgmode@gnu.org" --047d7b15aaadc3eba60513ed14c8 Content-Type: text/plain; charset=UTF-8 you are right, I meant C-y ;) I have these templates defined in my setup: ;; * Expansions for blocks ;; add

\n?\n")) ;; add \n?\n")) ;; add \n?\n")) ;; add \n?\n")) ;; add \n?\n")) 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-murillo@yale.edu> wrote: > John Kitchin writes: > > I like this kind of keyboard shortcut: >> For python:

> For emacs-lisp >> > > > 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" > " lang=\\"emacs-lisp\\">\n\n?")) > (add-to-list 'org-structure-template-alist > '("p" > "#+BEGIN_SRC python\n?\n#+END_SRC" > " lang=\\"python\\">\n\n?")))) > #+END_SRC > > I even use the method in message-mode, for writing emails with code, like > I just did now =) > > Best, > > -- > Jorge. > > > --047d7b15aaadc3eba60513ed14c8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

you are right, I meant C-y ;)

I have th= ese templates defined in my setup:

;; * Expan= sions for blocks
;; add <p for python expansion
(add= -to-list 'org-structure-template-alist
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0'("p" "#+BEGIN_SRC python\n?\= n#+END_SRC" "<src lang=3D\"python\">\n?\n</src= >"))

;; add <por for python expansion w= ith raw output
(add-to-list 'org-structure-template-alist
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'("por"= ; "#+BEGIN_SRC python :results output raw\n?\n#+END_SRC" "&l= t;src lang=3D\"python\">\n?\n</src>"))
;; add <pv for python expansion with value
(add-t= o-list 'org-structure-template-alist
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0'("pv" "#+BEGIN_SRC python :resu= lts value\n?\n#+END_SRC" "<src lang=3D\"python\">= \n?\n</src>"))

;; add <el for emacs-= lisp expansion
(add-to-list 'org-structure-template-alist
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'("el"= "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC" "<src lang=3D\&qu= ot;emacs-lisp\">\n?\n</src>"))

= ;; add <sh for shell
(add-to-list 'org-structure-template-= alist
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'("= ;sh" "#+BEGIN_SRC sh\n?\n#+END_SRC" "<src lang=3D\&q= uot;shell\">\n?\n</src>"))

John

----------------------------= -------
Professor John Kitchin=C2=A0
Doherty Hall A207F
Department= of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15= 213
412-268-7803

On Fri, Apr 17, 2015 at 11:08 AM, Jorge A. A= lfaro-Murillo <jorge.alfaro-murillo@yale.edu> wr= ote:
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&#= 39; to include python and emacs-lisp. For example, I use p and E, for pytho= n and emacs-lisp, so in my .emacs I have:

#+BEGIN_SRC emacs-lisp
=C2=A0(eval-after-load "org"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 '(progn
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(add-to-list 'org-structure-te= mplate-alist
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 '("E"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 "<src=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lang=3D\\"emacs= -lisp\\">\n\n?</src>"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(add-to-list 'org-structure-te= mplate-alist
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 '("p"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 "#+BEGIN_SRC python\n?\n#+END_SRC"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 "<src=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lang=3D\\"pytho= n\\">\n\n?</src>"))))
#+END_SRC

I even use the method in message-mode, for writing emails with code, like I= just did now =3D)

Best,

--
Jorge.



--047d7b15aaadc3eba60513ed14c8--