emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Cool trick on how to eval bash/zsh babel blocks in emacs
@ 2014-04-21 18:40 Xebar Saram
  2014-04-21 18:45 ` Sacha Chua
  0 siblings, 1 reply; 2+ messages in thread
From: Xebar Saram @ 2014-04-21 18:40 UTC (permalink / raw)
  To: org mode

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-21 18:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21 18:40 Cool trick on how to eval bash/zsh babel blocks in emacs Xebar Saram
2014-04-21 18:45 ` Sacha Chua

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).