emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Xebar Saram <zeltakc@gmail.com>
To: org mode <emacs-orgmode@gnu.org>
Subject: Cool trick on how to eval bash/zsh babel blocks in emacs
Date: Mon, 21 Apr 2014 21:40:14 +0300	[thread overview]
Message-ID: <CAOQHXPrbTP9JVBBQU0dDd9EeCnSBEFejxddWs=geCyDvvmM3Sw@mail.gmail.com> (raw)

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

Hi all

Thanks to the always amazing sacha chua here is a neat way to evaluate/run
bash/zsh command line commands inside the emacs term. i find this very
useful for collecting multiple bash snippets and quickly running them

here is the code

#+begin_src emacs-lisp
(defadvice org-babel-execute:sh (around sacha activate)
  (if (assoc-default :term (ad-get-arg 1) nil)
    (let ((buffer (make-term "babel" "/bin/zsh")))
      (with-current-buffer buffer
        (insert (org-babel-expand-body:generic
             body params (org-babel-variable-assignments:sh params)))
        (term-send-input))
(pop-to-buffer buffer))
    ad-do-it))
#+end_src


i wonder if this would be of interest to other people and perhaps could be
incorporated into org mode and babel

note of warning: sacha says its very hackish..since i have zero coding
knowledge i ill take her word for it even thought it works perfectly here
;-)

would love to know if anyone else has interest in this and if people have
improvements on this

best Z

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

             reply	other threads:[~2014-04-21 18:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 18:40 Xebar Saram [this message]
2014-04-21 18:45 ` Cool trick on how to eval bash/zsh babel blocks in emacs Sacha Chua

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='CAOQHXPrbTP9JVBBQU0dDd9EeCnSBEFejxddWs=geCyDvvmM3Sw@mail.gmail.com' \
    --to=zeltakc@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 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).