From: Eduardo Ochs <eduardoochs@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: How to execute org babel src block line by line?
Date: Tue, 19 Apr 2016 16:05:03 -0300 [thread overview]
Message-ID: <CADs++6hYN+edtFjZgG-KjfWWNSprGF3gvm7DxhamuL5iCrA8vg@mail.gmail.com> (raw)
In-Reply-To: <tencent_6F36A5CE52D34ED938F4C2DB@qq.com>
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=Lj_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. =)
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 <eude.xj@foxmail.com> 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-<return>" is pressed at first time, a REPL buffer which is decided by `lang' params is startd. Then everything send to that buffer. An additional param `:dir' is configured to decide the starting `default-directry' of the REPL command.
>
> =================================================
> (eval-after-load "org"
> '(progn
> ;; ;; (org-defkey org-mode-map (kbd "C-<return>") 'org-isend-send)
> (define-key org-mode-map (kbd "C-<return>") '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-directory)))
> (when (not (get-buffer isend--command-buffer))
> (cond
> ((string-equal lang "python") (save-current-buffer
> (let ((default-directory working-directory))
> (call-interactively 'run-python)
> (with-current-buffer "*Python*"
> (rename-buffer isend--command-buffer)))))
> ((string-equal lang "sh") (save-current-buffer
> (let ((default-directory working-directory))
> (if (string-equal session "eshell")
> (eshell)
> (progn
> (shell)
> (with-current-buffer "*shell*"
> (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-<return>") nil)
> (local-set-key (kbd "C-<return>") '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")))
> ;; )
> ))))
> ========================================
>
> I want to execute my shells/python/ruby scirpts this way by writing out them first, then `C-<return>' doing the rest.
>
> Does anyone know a better or more native `org' way to do this?
> Thank you for your help.
prev parent reply other threads:[~2016-04-19 19:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 8:44 How to execute org babel src block line by line? Xor3
2016-04-19 19:05 ` Eduardo Ochs [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADs++6hYN+edtFjZgG-KjfWWNSprGF3gvm7DxhamuL5iCrA8vg@mail.gmail.com \
--to=eduardoochs@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.