emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: [babel] Executing sh-code
Date: Wed, 25 Nov 2009 15:22:07 +0100	[thread overview]
Message-ID: <87k4xey99s.fsf@mundaneum.com> (raw)

Hi,

I'm trying to execute code through babel, for the first time -- I did use it
for small examples of LP, but not yet for enhanced work.

This is my first file:

--8<---------------cut here---------------start------------->8---
* Prerequisites

#+begin_src sh :session ecm
    cd ~/Personal
#+end_src
--8<---------------cut here---------------end--------------->8---

If I C-c on the command, Emacs hangs -- just doing nothing (like waiting for
something that never comes).

C-g gives this:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (quit)
  accept-process-output(#<process shell>)
  (while (progn (goto-char comint-last-input-end) (not ...)) (accept-process-output (get-buffer-process buffer)))
  (progn (unless (org-babel-comint-buffer-livep buffer) (error ...)) (set-buffer buffer) (while (progn ... ...) (accept-process-output ...)))
  (unwind-protect (progn (unless ... ...) (set-buffer buffer) (while ... ...)) (set-match-data save-match-data-internal (quote evaporate)))
  (let ((save-match-data-internal ...)) (unwind-protect (progn ... ... ...) (set-match-data save-match-data-internal ...)))
  (save-match-data (unless (org-babel-comint-buffer-livep buffer) (error ...)) (set-buffer buffer) (while (progn ... ...) (accept-process-output ...)))
  (save-window-excursion (save-match-data (unless ... ...) (set-buffer buffer) (while ... ...)))
  (org-babel-comint-in-buffer buffer (while (progn ... ...) (accept-process-output ...)))
  org-babel-comint-wait-for-output(#<buffer *shell*>)
  (progn (setq sh-buffer (current-buffer)) (org-babel-comint-wait-for-output sh-buffer))
  (if newp (progn (setq sh-buffer ...) (org-babel-comint-wait-for-output sh-buffer)))
  (when newp (setq sh-buffer (current-buffer)) (org-babel-comint-wait-for-output sh-buffer))
  (let* ((session ...) (sh-buffer ...) (newp ...)) (if (and sh-buffer ... ...) (setq sh-buffer nil)) (shell sh-buffer) (when newp (setq sh-buffer ...) (org-babel-comint-wait-for-output sh-buffer)) (setq org-babel-sh-buffers (cons ... ...)) session)
  (save-window-excursion (let* (... ... ...) (if ... ...) (shell sh-buffer) (when newp ... ...) (setq org-babel-sh-buffers ...) session))
  org-babel-sh-initiate-session-by-key("ecm")
  (org-babel-sh-session-buffer (org-babel-sh-initiate-session-by-key session))
  (if (string= session "none") nil (org-babel-sh-session-buffer (org-babel-sh-initiate-session-by-key session)))
  (unless (string= session "none") (org-babel-sh-session-buffer (org-babel-sh-initiate-session-by-key session)))
  org-babel-sh-initiate-session("ecm")
  (let* ((processed-params ...) (session ...) (vars ...) (result-type ...) (full-body ...)) (org-babel-sh-evaluate session full-body result-type))
  org-babel-execute:sh("cd ~/Personal\n" ((:exports . "code") (:nocache) (:results . "replace") (:session . "ecm") (:tangle . "")))
  funcall(org-babel-execute:sh "cd ~/Personal\n" ((:exports . "code") (:nocache) (:results . "replace") (:session . "ecm") (:tangle . "")))
  (setq result (funcall cmd body params))
  (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char ...) (move-end-of-line 1) (forward-char 1) (setq result ...) (message ...) result) (setq result (funcall cmd body params)) (if (eq result-type ...) (setq result ...)) (org-babel-insert-result result result-params info new-hash) result)
  (let* ((info ...) (lang ...) (params ...) (new-hash ...) (old-hash ...) (body ...) (result-params ...) (result-type ...) (cmd ...) result) (unless (member lang org-babel-interpreters) (error "Language is not in `org-babel-interpreters': %s" lang)) (if (and ... new-hash ...) (save-excursion ... ... ... ... ... result) (setq result ...) (if ... ...) (org-babel-insert-result result result-params info new-hash) result))
  org-babel-execute-src-block(nil ("sh" "cd ~/Personal\n" ((:exports . "code") (:nocache) (:results . "replace") (:session . "ecm") (:tangle . "")) ""))
  (progn (org-babel-execute-src-block current-prefix-arg info) t)
  (if info (progn (org-babel-execute-src-block current-prefix-arg info) t) nil)
  (let ((info ...)) (if info (progn ... t) nil))
  org-babel-execute-src-block-maybe()
  run-hook-with-args-until-success(org-babel-execute-src-block-maybe)
  org-ctrl-c-ctrl-c(nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
--8<---------------cut here---------------end--------------->8---

and I have an empty Shell buffer:

--8<---------------cut here---------------start------------->8---

[Wed Nov 25 15:13:10]
[sva@mundaneum] ~>
--8<---------------cut here---------------end--------------->8---

What am I doing wrong?  Or have I set something wrong (or missing) in my
.emacs file?

--8<---------------cut here---------------start------------->8---
(require 'org-babel-init)

;; activate a subset of languages
(require 'org-babel-R)
(require 'org-babel-sh)

;; make pre-built helper functions available
(org-babel-load-library-of-babel)
--8<---------------cut here---------------end--------------->8---

Anything interesting in there?

BTW, my next question will be: can we have an SSH session?  Or, I guess that
it's the difficult part: is there a way to ask the password and go on with my
commands?

Best regards,
  Seb

-- 
Sébastien Vauban



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2009-11-25 14:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 14:22 Sébastien Vauban [this message]
2009-11-27  9:15 ` [babel] Executing sh-code Sébastien Vauban
2009-11-27 10:46   ` Eric S Fraga
2009-11-27 10:00 ` Torsten Wagner
2009-11-27 10:43   ` Sébastien Vauban
2009-11-27 19:32     ` Eric Schulte
2009-11-27 19:46     ` Dan Davison
2009-11-29 21:03       ` Sébastien Vauban
2009-11-30 15:44         ` Eric Schulte
2009-11-30 16:02           ` Nick Dokos
2009-11-30 16:16             ` Eric Schulte
2009-12-01  8:37               ` Sébastien Vauban
2009-12-01 10:01           ` Sébastien Vauban
2009-12-02 19:09             ` Eric Schulte
2009-12-04 13:25               ` Sébastien Vauban
2009-12-04 14:09                 ` Sébastien Vauban
2009-12-04 17:04                   ` Eric Schulte
2009-12-07  1:10                   ` Torsten Wagner
2009-12-07  9:59                     ` Sébastien Vauban
2009-12-04 17:03                 ` Eric Schulte
2009-12-02 14:55           ` Sébastien Vauban
2009-12-02 20:16             ` Eric Schulte
2009-12-03  9:27               ` Sébastien Vauban
2009-12-03 16:06                 ` Eric Schulte

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=87k4xey99s.fsf@mundaneum.com \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.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).