emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: "Jorge A. Alfaro-Murillo" <jorge.alfaro-murillo@yale.edu>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: paste from clip to code block
Date: Fri, 17 Apr 2015 11:17:40 -0400	[thread overview]
Message-ID: <CAJ51ETqXo_X_QyZURQZJ2HM7NYmPvhEfBgAO5ivNHucdbym43A@mail.gmail.com> (raw)
In-Reply-To: <87383ypzbd.fsf@yale.edu>

[-- Attachment #1: Type: text/plain, Size: 2406 bytes --]

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-murillo@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.
>
>
>

[-- Attachment #2: Type: text/html, Size: 4139 bytes --]

  reply	other threads:[~2015-04-17 15:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17  7:21 paste from clip to code block Xebar Saram
2015-04-17 13:56 ` John Kitchin
2015-04-17 14:36   ` Xebar Saram
2015-04-17 15:08   ` Jorge A. Alfaro-Murillo
2015-04-17 15:17     ` John Kitchin [this message]
2015-05-07  7:59       ` Sebastien Vauban
2015-09-05 20:15         ` Grant Rettke
2015-09-07 14:09           ` John Kitchin
2015-09-07 16:39             ` Grant Rettke
2015-09-07 20:18               ` John Kitchin

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=CAJ51ETqXo_X_QyZURQZJ2HM7NYmPvhEfBgAO5ivNHucdbym43A@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=jorge.alfaro-murillo@yale.edu \
    /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).