From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?S=C3=A9bastien_Vauban?= Subject: Re: [babel] Executing sh-code Date: Fri, 27 Nov 2009 10:15:41 +0100 Message-ID: <87ws1cjpky.fsf@mundaneum.com> References: <87k4xey99s.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hi, Can I bump up this thread? > 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: > > * Prerequisites > > #+begin_src sh :session ecm > cd ~/Personal > #+end_src > > If I C-c on the command, Emacs hangs -- just doing nothing (like waiting = for > something that never comes). > > C-g gives this: > > Debugger entered--Lisp error: (quit) > accept-process-output(#) > (while (progn (goto-char comint-last-input-end) (not ...)) (accept-proc= ess-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 bu= ffer) (while ... ...))) > (org-babel-comint-in-buffer buffer (while (progn ... ...) (accept-proce= ss-output ...))) > org-babel-comint-wait-for-output(#) > (progn (setq sh-buffer (current-buffer)) (org-babel-comint-wait-for-out= put 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-buffe= r) (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 sess= ion)) > (if (string=3D session "none") nil (org-babel-sh-session-buffer (org-ba= bel-sh-initiate-session-by-key session))) > (unless (string=3D session "none") (org-babel-sh-session-buffer (org-ba= bel-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") (:n= ocache) (: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 ...) (me= ssage ...) result) (setq result (funcall cmd body params)) (if (eq result-t= ype ...) (setq result ...)) (org-babel-insert-result result result-params i= nfo 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-res= ult result result-params info new-hash) result)) > org-babel-execute-src-block(nil ("sh" "cd ~/Personal\n" ((:exports . "c= ode") (: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) > > and I have an empty Shell buffer: > > > [Wed Nov 25 15:13:10] > [sva@mundaneum] ~> > > What am I doing wrong? Or have I set something wrong (or missing) in my > .emacs file? > > (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) > > Anything interesting in there? Is this Emacs config wrong? Anybody can give me some extract of a working Babel config (for shell code execution)? > BTW, my next question will be: can we have an SSH session? Or, I guess t= hat > it's the difficult part: is there a way to ask the password and go on wit= h my > commands? Best regards, Seb --=20 S=C3=A9bastien 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