From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: interesting dilemma with ob-ipython Date: Fri, 10 Jun 2016 10:19:59 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBNI9-0000s9-He for emacs-orgmode@gnu.org; Fri, 10 Jun 2016 10:20:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBNI6-0003bg-9t for emacs-orgmode@gnu.org; Fri, 10 Jun 2016 10:20:09 -0400 Received: from mail-qg0-x233.google.com ([2607:f8b0:400d:c04::233]:36227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBNI6-0003aJ-4w for emacs-orgmode@gnu.org; Fri, 10 Jun 2016 10:20:06 -0400 Received: by mail-qg0-x233.google.com with SMTP id v76so4797523qgv.3 for ; Fri, 10 Jun 2016 07:20:03 -0700 (PDT) In-reply-to: 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" To: Anthony Cowley Cc: "emacs-orgmode@gnu.org" Thanks for this tip. It was a great start! I turned it into this: #+BEGIN_SRC emacs-lisp ;; make src blocks open in the right mode (add-to-list 'org-src-lang-modes '("jupyter-hy" . hy)) (add-to-list 'org-latex-minted-langs '(jupyter-hy "hylang")) ;; set default headers for convenience (setq org-babel-default-header-args:jupyter-hy '((:results . "output replace") (:session . "hy") (:kernel . "hy") (:exports . "code") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no"))) (defalias 'org-babel-execute:jupyter-hy 'org-babel-execute:ipython) (add-to-list 'org-structure-template-alist '("hy" "#+BEGIN_SRC jupyter-hy\n?\n#+END_SRC" "\n?\n")) #+END_SRC Which solves all the problems! 1. src-blocks open in hy-mode and export as hylang in minted. 2. John Kitchin writes: > >> I was looking into ob-ipython as a replacement for regular >> org-babel-python because it seems to be better at sessions. Also, you >> can use other kernels with it! >> >> For example: >> >> #+BEGIN_SRC ipython :session hy :results output :kernel hy >> (print "hello world") >> (import time) >> (print (time.asctime)) >> #+END_SRC >> >> #+RESULTS: >> : hello world >> : Thu Jun 9 17:26:56 2016 >> >> Here is the dilemma: >> If I special edit this, it is in python-mode, not hy-mode. And similarly >> on export, it is highlighted as ipython, not hy-lang. >> >> Any thoughts on how to address these? > > I've had success using something like this, > > (add-to-list 'org-src-lang-modes '("ipython" . haskell)) > > in a :noexport: setup section. > > Anthony -- 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