From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eduardo Ochs Subject: Re: How to execute org babel src block line by line? Date: Tue, 19 Apr 2016 16:05:03 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asaxO-0002xc-Eo for emacs-orgmode@gnu.org; Tue, 19 Apr 2016 15:05:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asaxM-0000yc-NQ for emacs-orgmode@gnu.org; Tue, 19 Apr 2016 15:05:06 -0400 Received: from mail-yw0-x22a.google.com ([2607:f8b0:4002:c05::22a]:36406) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asaxM-0000yH-IR for emacs-orgmode@gnu.org; Tue, 19 Apr 2016 15:05:04 -0400 Received: by mail-yw0-x22a.google.com with SMTP id o66so28480197ywc.3 for ; Tue, 19 Apr 2016 12:05:04 -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: emacs-orgmode Hi Xor3, Maybe you should take a look at eev - more specifically, at eepitch, which is one of its modules... there's a demo here, starting at 0:16, http://angg.twu.net/eev-videos/video4-eepitch.mp4 http://www.youtube.com/watch?v=3DLj_zKC5BR64 and there's a tutorial here: http://angg.twu.net/eev-intros/find-eev-quick-intro.html I am not sure if it is already as compatible with Org as it should - I use Org all the time, but just a few basic features... if you want to try it and stumble on any problems please let me know and I will fix everything ASAP - I am in the middle of my holidays. =3D) Cheers! Eduardo Ochs eduardoochs@gmail.com http://angg.twu.net/ P.S.: I am trying isend-mode now. On Mon, Apr 18, 2016 at 5:44 AM, Xor3 wrote: > Hi community, > I want to execute org babel src block one line a time. > Here is what I have tried. > I use `isend' to send things to REPL buffer. When "C-" is pre= ssed at first time, a REPL buffer which is decided by `lang' params is s= tartd. Then everything send to that buffer. An additional param `:dir' is c= onfigured to decide the starting `default-directry' of the REPL command. > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > (eval-after-load "org" > '(progn > ;; ;; (org-defkey org-mode-map (kbd "C-") 'org-isend-send= ) > (define-key org-mode-map (kbd "C-") 'org-isend-send) > > (defun org-isend-send() > (interactive) > (let* ((oldbuf (current-buffer)) > (info (org-babel-get-src-block-info)) > (lang (nth 0 info)) > (body (nth 1 info)) > (params (nth 2 info)) > (session (cdr (assoc :session params))) > (dir (cdr (assoc :dir params))) > (isend--command-buffer (concat "*" session "*")) > (working-directory > (or (and dir (file-name-as-directory dir)) default-dire= ctory))) > (when (not (get-buffer isend--command-buffer)) > (cond > ((string-equal lang "python") (save-current-buffer > (let ((default-directory w= orking-directory)) > (call-interactively 'run= -python) > (with-current-buffer "*P= ython*" > (rename-buffer isend--= command-buffer))))) > ((string-equal lang "sh") (save-current-buffer > (let ((default-directory worki= ng-directory)) > (if (string-equal session "e= shell") > (eshell) > (progn > (shell) > (with-current-buffer "*s= hell*" > (rename-buffer isend--= command-buffer))))))) > (t (error "session?"))) > (require 'isend) > (require 'isend-mode) > (when (not isend-mode) > (isend-mode 1) > (make-local-variable 'isend-mode-map) > (define-key isend-mode-map (kbd "C-") nil) > (local-set-key (kbd "C-") 'org-isend-send)) > (cond > ((string-equal lang "python") (isend-ipython-setup)) > (t (isend-shell-setup))) > ) > ;; (display-buffer isend--command-buffer) > (isend-display-buffer) > (call-interactively 'isend-send) > ;; (with-current-buffer isend--command-buffer > ;; (goto-char (point-max)) > ;; (comint-send-input) > ;; (funcall (key-binding (kbd "RET"))) > ;; ) > )))) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > I want to execute my shells/python/ruby scirpts this way by writing ou= t them first, then `C-' doing the rest. > > Does anyone know a better or more native `org' way to do this? > Thank you for your help.