[Orgmode] Re: [Babel] Executing sh code within sessions

2010-11-17 Thread Sébastien Vauban
Hi Eric,

> "Eric Schulte" wrote:
>> Yes, I've noticed the shell session evaluation problems as well. I think
>> one possible solution is for us to move from the current schema of echoing
>> a babel-specific marker to indicate that evaluation has completed (which
>> isn't working very well and is fairly ugly to boot) and move towards
>> something more like what Dan has done with R, where the output is written
>> to a file, and we check for that file to be created to signal the end of
>> session based evaluation.
>
> Will that handle ssh remote execution? I still have no clue to do that via
> the sh code blocks, but that's what I'm targetting to. Therefore, the need
> for a session.:
>
> 1. code block to open the ssh connection
> 2. code block with some code
> 3. code block with other code
> 4. code block with logout
>
>
>> This is certainly something that needs to be addressed, however I for one
>> won't have any time over the next week (I'm attending a conference).
>>
>> Rest assured this issue is in our inbox. :)
>
> Thanks a lot for your continuous support.

Just for your information...

After having chased a problem for making Tramp work -- that was caused by an
overriden PS1 setting --, here is how Tramp does:

Tramp needs a special prompt, in order to distinguish command output and,
hmm, the prompt. It does set PS1 to '$ ' (and $TERM to 'dumb').

Don't know if this could be a solution here: set the prompt (instead of
letting it customizable)?

Best regards,
  Seb

-- 
Sébastien Vauban


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


[Orgmode] Re: [Babel] Executing sh code within sessions

2010-11-06 Thread Sébastien Vauban
Hi Eric,

"Eric Schulte" wrote:
> Yes, I've noticed the shell session evaluation problems as well. I think one
> possible solution is for us to move from the current schema of echoing a
> babel-specific marker to indicate that evaluation has completed (which isn't
> working very well and is fairly ugly to boot) and move towards something
> more like what Dan has done with R, where the output is written to a file,
> and we check for that file to be created to signal the end of session based
> evaluation.

Will that handle ssh remote execution?  I still have no clue to do that via
the sh code blocks, but that's what I'm targetting to. Therefore, the need for
a session.:

1. code block to open the ssh connection
2. code block with some code
3. code block with other code
4. code block with logout


> This is certainly something that needs to be addressed, however I for one
> won't have any time over the next week (I'm attending a conference).
>
> Rest assured this issue is in our inbox. :)

OK, I stop pressuring you ;-)  No, really, I hope you wouldn't feel it like
that.

#+begin_src note
Anyway, next week, I won't have much time either: all the free time will go
into demolishing (part of) my house, before big works scheduled (or
DEADLINEd?) in Feb...
#+end_src

Thanks a lot for your continuous support.

Best regards,
  Seb

-- 
Sébastien Vauban


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


[Orgmode] Re: [babel] Executing sh-code

2009-12-07 Thread Sébastien Vauban
Hi Torsten,

Torsten Wagner wrote:
>> Sébastien Vauban wrote:
>> > "Eric Schulte" wrote:
>> >>
>> >> [...] The following works for me without any hang.
>> >> The only difference I can see between our setups is a matching prompt
>> >> regexp.
>> >
>> > That was it. Fixing my PS1 prompt to be like yours (temporarily keeping
>> > your regexp from the comint-prompt) *did* solve the problem.
>> 
>> Testing that a bit further, I notice that:
>> 
>> - my Bash prompt must be uncolored for the output to be catchable by
>>   Org-babel;
>> 
>> - ls can be colored, but control characters are then passed "as is" to
>>   Org-babel, so better not doing it.
>
> As I said before, the example worked fine for me...
> I like to add that I use a very very colorful prompt but using zsh instead of 
> bash
> Maybe this is somehow interesting for bug-fixing.

What's your value for PS1 under zsh?

What's your value for comint-prompt-regexp under Emacs shell?

Best regards,
  Seb

-- 
Sébastien Vauban



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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-12-06 Thread Torsten Wagner
Hi,

> Hi Eric,
> 
> Sébastien Vauban wrote:
> > "Eric Schulte" wrote:
> >>
> >> [...] The following works for me without any hang.
> >> The only difference I can see between our setups is a matching prompt
> >> regexp.
> >
> > That was it. Fixing my PS1 prompt to be like yours (temporarily keeping 
your
> > regexp from the comint-prompt) *did* solve the problem.
> 
> Testing that a bit further, I notice that:
> 
> - my Bash prompt must be uncolored for the output to be catchable by
>   Org-babel;
> 
> - ls can be colored, but control characters are then passed "as is" to
>   Org-babel, so better not doing it.


As I said before, the example worked fine for me...
I like to add that I use a very very colorful prompt but using zsh instead of 
bash
Maybe this is somehow interesting for bug-fixing.


Best regards

Torsten


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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-12-04 Thread Eric Schulte
Sébastien Vauban  writes:

> Hi Eric,
>
> Sébastien Vauban wrote:
>> "Eric Schulte" wrote:
>>>
>>> [...] The following works for me without any hang.
>>> The only difference I can see between our setups is a matching prompt
>>> regexp.
>>
>> That was it. Fixing my PS1 prompt to be like yours (temporarily keeping your
>> regexp from the comint-prompt) *did* solve the problem.
>
> Testing that a bit further, I notice that:
>
> - my Bash prompt must be uncolored for the output to be catchable by
>   Org-babel;
>
> - ls can be colored, but control characters are then passed "as is" to
>   Org-babel, so better not doing it.
>

Thanks for these notes.  I'll add a task related to this, as it
shouldn't be too difficult to strip out the ansi-color characters.

Thanks -- Eric

>
> Dunno about the multiline prompt. Stopped using this. Causes me too much
> trouble anyway with other configs as well (such as Tramp).
>
> Best regards,
>   Seb


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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-12-04 Thread Eric Schulte
Sébastien Vauban  writes:

> Hi Eric,
>
> "Eric Schulte" wrote:
>> Sébastien Vauban  writes:
>
> #+begin_src sh :session "ecm"
> ls *.org
> #+end_src
>
> Nothing to do with the problem, but better to write `:session ecm' than
> `:session "ecm"', no?
>

Correct, it will be interpreted as a string either way but :session
"ecm" will actually name your buffer '"emc"' quotes included

[...]
> That was it. Fixing my PS1 prompt to be like yours (temporarily keeping your
> regexp from the comint-prompt) *did* solve the problem.
>
>> #+begin_src sh :session eric
>>   cd ~/Desktop/clj/
>>   ls *.clj
>> #+end_src
>>
>> #+results:
>> | "ants.clj" | "" | "concurrent.clj" | "" | "hello.clj" | "" | 
>> "spell-checker.clj" |
>
> Similar results for my directory.
>
> Thanks a lot!!!
>

Excellent, happy this has been resolved -- Eric

>
> Best regards,
>   Seb


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


[Orgmode] Re: [babel] Executing sh-code

2009-12-04 Thread Sébastien Vauban
Hi Eric,

Sébastien Vauban wrote:
> "Eric Schulte" wrote:
>>
>> [...] The following works for me without any hang.
>> The only difference I can see between our setups is a matching prompt
>> regexp.
>
> That was it. Fixing my PS1 prompt to be like yours (temporarily keeping your
> regexp from the comint-prompt) *did* solve the problem.

Testing that a bit further, I notice that:

- my Bash prompt must be uncolored for the output to be catchable by
  Org-babel;

- ls can be colored, but control characters are then passed "as is" to
  Org-babel, so better not doing it.

Dunno about the multiline prompt. Stopped using this. Causes me too much
trouble anyway with other configs as well (such as Tramp).

Best regards,
  Seb

-- 
Sébastien Vauban



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


[Orgmode] Re: [babel] Executing sh-code

2009-12-04 Thread Sébastien Vauban
Hi Eric,

"Eric Schulte" wrote:
> Sébastien Vauban  writes:

 #+begin_src sh :session "ecm"
 ls *.org
 #+end_src

Nothing to do with the problem, but better to write `:session ecm' than
`:session "ecm"', no?


 I C-c C-c the first snippet. Nothing special, except it doesn't hang
 anymore. Second snippet. C-c C-c. There, it still hangs ;-((
>>
>> [...]
>>
>>> So the fix here is to fix the value of the `comint-prompt-regexp'
>>> variable in your shell.  Org-babel uses this variable to digest output
>>> from the shell.  I have mine set with the following
>>>
>>> (defun schulte/set-shell-prompt-regexp ()
>>>   (setq comint-prompt-regexp "^\(.+\)"))
>>> (add-hook 'shell-mode-hook 'schulte/set-shell-prompt-regexp)
>>
>> I've put that in my .emacs file, as you can see (when asking for its value in
>> the shell buffer):
>
> I'm sorry I wasn't clear in my earlier email.  You will need to craft
> your own regexp to replace "^\(.+\)" in the above code.  This is because
> you will need to match your own prompt as it appears in your *shell*
> buffers locally.  This would be the product of your personal .bashrc or
> .zshrc prompt configuration.  The example I pasted above matches my own
> prompt which has a non-standard
>
> ( ~ )
>
> style.
>
>>> You'll have to change the regexp ("^\(.+\)" in my example) to match your
>>> prompt.
>>
>> Nope. Because I'm using your prompt, as you can see in the above shell
>> session.
>
> Nope, I use a different prompt.  To match a prompt like what you have
> above you'd want to use something like closer to the default value of
> "^[^#$%>\n]*[#$%>] *".  Sorry for the confusion here.

Okaaayy. Did not look enough at the regexp... Sorry.


> [...] The following works for me without any hang.
> The only difference I can see between our setups is a matching prompt
> regexp.

That was it. Fixing my PS1 prompt to be like yours (temporarily keeping your
regexp from the comint-prompt) *did* solve the problem.

> #+begin_src sh :session eric
>   cd ~/Desktop/clj/
>   ls *.clj
> #+end_src
>
> #+results:
> | "ants.clj" | "" | "concurrent.clj" | "" | "hello.clj" | "" | 
> "spell-checker.clj" |

Similar results for my directory.

Thanks a lot!!!

Best regards,
  Seb

-- 
Sébastien Vauban



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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-12-03 Thread Eric Schulte
Hi Sébastien,

Sébastien Vauban  writes:

> Hi Eric,
>
> "Eric Schulte" wrote:

[...]

>> Yes, I agree that this should be implemented, patches are welcome :)
>
> I can imagine. My skills are still maybe a bit low to be productive in that
> area. But I really would like to help. Second problem is -- and that must be
> the same for everybody (you included) -- a deep lack of time, with real work
> for real clients to be done during day, and little daughter to be taken care
> of for (almost all) the rest of the time.
>

Yes, lack of sufficient time is very much my limiting factor as well.
I'm looking forward to an extended Christmas break -- after finals --
when I should be able to start to catch up with these accumulating
development tasks.

>
> That's not an excuse. If I get time, I'll try to...
>

Please don't let my flippant reply above make you feel obligated to
learn elisp.  I really do enjoy performing this development myself when
I have time.

>
>> Thanks for the very useful feedback, hopefully we'll be able to make
>> some progress in these areas soon.
>
> For the time I can now spend on Org-mode, I am making a document that uses
> (part of) all the power of Org-babel. My intention is to share my result to
> all of you, when it gets finished. That way, maybe I'll get feedback and
> improvements as well on it...
>
> It will be helpful for both Org-babel'ers (as an example) and for others as
> well, for automating the creation of reports about... sshhht. Will tell when
> it's done.
>
> The plan is to use the best of what you give to us, including tables, shell
> scripts and R plots.
>

I'm intrigued.  Tom Dye has been good enough to start an
org-babel-uses.org file demonstrating some example uses of org-babel.
It is currently available in the Worg git repository at

org-contrib/babel/org-babel-uses.org

however for some reason it isn't surviving the html publication process.
Most likely this is due to the baroque combination of interacting
source-code blocks lurking in the file.

I look forward to your unveiling! -- Eric

>
> Best regards,
>   Seb


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


[Orgmode] Re: [babel] Executing sh-code

2009-12-03 Thread Sébastien Vauban
Hi Eric,

"Eric Schulte" wrote:
> Sébastien Vauban  writes:
>> "Eric Schulte" wrote:
>>> Sébastien Vauban  writes:

 What's the impact of specifying "sh" or "bash" for the snippet?
>>>
>>> While "sh" blocks should work "bash" blocks will not be recognized. In
>>> org-babel "sh" doesn't explicitly mean the "sh" command, but rather means
>>> 'run shell' which will default to whatever shell you have configured.
>>
>> I wonder if it wouldn't be beneficial to make such a feature explicit. I 
>> think
>> the right shell environment cannot be guessed at runtime. Am I right?
>
> Hmm, currently we just use the `shell' command which defaults to the user's
> defined shell. I would have to investigate as to how to explicitly specify a
> particular shell to run, but I certainly do see your point that there are
> times when an explicit shell environment would be desirable.
>
> I'll create a TODO to reflect this need.

OK. Thanks.


>> Let's imagine two use cases:
>>
>> 1. I only have zsh on my machine, and I'm writing a document with bash code
>>blocks. What if the user executing them is using zsh as his default shell?

I meant "I only have bash on my machine". But, whatever, you understood my
point.


>> 2. I have both bash and zsh installed on my machine. I want to write some 
>> code
>>blocks in bash, and other in zsh. How can I make the difference explicit?
>>
>> BTW, a "needed" feature is the executable flag for shell scripts. I found a
>> reference to it ("PROPOSED make tangled files executable? At least if using
>> shebang line") on http://orgmode.org/worg/org-contrib/babel/development.php.
>
> Yes, I agree that this should be implemented, patches are welcome :)

I can imagine. My skills are still maybe a bit low to be productive in that
area. But I really would like to help. Second problem is -- and that must be
the same for everybody (you included) -- a deep lack of time, with real work
for real clients to be done during day, and little daughter to be taken care
of for (almost all) the rest of the time.

That's not an excuse. If I get time, I'll try to...


> Thanks for the very useful feedback, hopefully we'll be able to make
> some progress in these areas soon.

For the time I can now spend on Org-mode, I am making a document that uses
(part of) all the power of Org-babel. My intention is to share my result to
all of you, when it gets finished. That way, maybe I'll get feedback and
improvements as well on it...

It will be helpful for both Org-babel'ers (as an example) and for others as
well, for automating the creation of reports about... sshhht. Will tell when
it's done.

The plan is to use the best of what you give to us, including tables, shell
scripts and R plots.

Best regards,
  Seb

-- 
Sébastien Vauban



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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-12-02 Thread Eric Schulte
Sébastien Vauban  writes:

> Hi Eric,
>
> "Eric Schulte" wrote:
>> Sébastien Vauban  writes:
>>>
>>> What's the impact of specifying "sh" or "bash" for the snippet?
>>
>> While "sh" blocks should work "bash" blocks will not be recognized. In
>> org-babel "sh" doesn't explicitly mean the "sh" command, but rather means
>> 'run shell' which will default to whatever shell you have configured.
>
> I wonder if it wouldn't be beneficial to make such a feature explicit. I think
> the right shell environment cannot be guessed at runtime. Am I right?
>

Hmm, currently we just use the `shell' command which defaults to the
user's defined shell.  I would have to investigate as to how to
explicitly specify a particular shell to run, but I certainly do see
your point that there are times when an explicit shell environment would
be desirable.

I'll create a TODO to reflect this need.

>
> Let's imagine two use cases:
>
> 1. I only have zsh on my machine, and I'm writing a document with bash code
>blocks. What if the user executing them is using zsh as his default shell?
>
> 2. I have both bash and zsh installed on my machine. I want to write some code
>blocks in bash, and other in zsh. How can I make the difference explicit?
>
> BTW, a "needed" feature is the executable flag for shell scripts. I found a
> reference to it ("PROPOSED make tangled files executable? At least if using
> shebang line") on http://orgmode.org/worg/org-contrib/babel/development.php.
>

Yes, I agree that this should be implemented, patches are welcome :)

Thanks for the very useful feedback, hopefully we'll be able to make
some progress in these areas soon.

Best -- Eric

>
> Thanks anyway for your marvelous tool (replacing my need for Nuweb, and giving
> me much more opportunities),
>   Seb


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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-12-02 Thread Eric Schulte
Hi Sébastien,

Sébastien Vauban  writes:

> Hi Eric,
>
> FYI, I just re-did a git pull && make clean && make, before writing this post
> (5 min ago). I also launched a new Emacs.
>
> "Eric Schulte" wrote:
>> Sébastien Vauban  writes:
>>>
>>> Let's assume the following Org file:
>>>
>>> #+begin_src sh :session "ecm"
>>> cd ~/Personal
>>> #+end_src
>>>
>>> #+begin_src sh :session "ecm"
>>> ls *.org
>>> #+end_src
>>>
>>> I C-c C-c the first snippet. Nothing special, except it doesn't hang 
>>> anymore.
>>> So, it already looks much better.
>>>
>>> Second snippet. C-c C-c. There, it still hangs ;-((
>>>
>>> Though, C-x C-b shows me the contents of the "ecm" buffer:
>>>
>>> cd ~/Personal
>>>
>>> ~ % ~/Personal % ls *.org
>>> echo 'org_babel_sh_eoe'
>>> Bookmarks.org  Scorpios.orgTickler.org  
>>> Voice-over-IP.org*
>>> Home.org*  Succession.org  Using-startx-for-Remote-Display.org  
>>> refile.org
>>> ~/Personal % org_babel_sh_eoe
 ~/Personal % 
>
> I am still puzzled by the order the commands are mixed with their output:
>
> 1. ls command
> 2. echo command
> 3. ls output
> 4. echo output
>
> It's like if everything was sent at once, instead of waiting for the prompt to
> appear.
>

Yes, there is no easy way that I know of to wait until a command returns
w/o adding some sort of sleep command or complicated filter, so all
commands are inserted before the shell has a chance to respond.

exactly

>
> Would I write see in Expect (I love it), I would write something like:
>

sadly there is no comparable elisp library that I am aware of.  Luckily
it shouldn't matter as the commands are still input to the shell in the
same order, and the output is still collected directly form the shell
with a filter.

>
> 1. expect prompt
> 2. send ls command
> 3. expect result followed by prompt
> 4. send echo command
> 5. expect result followed by prompt
>
> But, maybe, my observation has nothing to do with my problem...
>

Correct, I don't believe this is related to the problem.

> >
>> So the fix here is to fix the value of the `comint-prompt-regexp'
>> variable in your shell.  Org-babel uses this variable to digest output
>> from the shell.  I have mine set with the following
>>
>> (defun schulte/set-shell-prompt-regexp ()
>>   (setq comint-prompt-regexp "^\(.+\)"))
>> (add-hook 'shell-mode-hook 'schulte/set-shell-prompt-regexp)
>
> I've put that in my .emacs file, as you can see (when asking for its value in
> the shell buffer):
>

I'm sorry I wasn't clear in my earlier email.  You will need to craft
your own regexp to replace "^\(.+\)" in the above code.  This is because
you will need to match your own prompt as it appears in your *shell*
buffers locally.  This would be the product of your personal .bashrc or
.zshrc prompt configuration.  The example I pasted above matches my own
prompt which has a non-standard

( ~ )

style.

>
>> You'll have to change the regexp ("^\(.+\)" in my example) to match your
>> prompt.
>
> Nope. Because I'm using your prompt, as you can see in the above shell
> session.
>

Nope, I use a different prompt.  To match a prompt like what you have
above you'd want to use something like closer to the default value of
"^[^#$%>\n]*[#$%>] *".  Sorry for the confusion here.

>> on a related topic:
>>
>> I've also noticed that org-babel has difficulty digesting shell output
>> when it is ansi-colorized.  I'm not sure what the best fix here would
>> be.  We could probably start piping all org-babel session results
>> through something like `ansi-color-filter-region' but that feels a
>> little bit too heavy.  I'd be interested to hear other peoples
>> thoughts/suggestions.
>
> Good you talk of that. Of course, I was using color in my prompt (but not
> anymore, see above), but I was coloring ls output as well...
>
> Disabled yesterday...
>
> # alias ls="ls --color=yes --classify"  # `--color=auto' tells ls to use color
> #   # iff output is a tty
>
> Though, even while I'm using your prompt definition, your prompt regexp
> definition, bash as shell, and no color in the ls command, I still have the
> same problem: "Emacs" hangs when C-c C-c on the `ls *.org' code block.
>
> Not sure to understand what I can do to go further...
>

I'm not sure, a fixed prompt regexp should solve the problem.  I now
believe that ansi-coloring may have been a red-herring.  I *do* have
colored ls output aswell, however the following works for me without any
hang.  The only difference I can see between our setups is a matching
prompt regexp.

--8<---cut here---start->8---
#+begin_src sh :session eric
  cd ~/Desktop/clj/
  ls *.clj
#+end_src

#+results:
| "ants.clj" | "" | "concurrent.clj" | "" | "hello.clj" | "" | 
"spell-checker.clj" |
--8<---cut here---end--->8---

Hope this is helpful. Best -- Eric

>
> Best regards,
>   Seb


___
Emacs-orgmode mailing

[Orgmode] Re: [babel] Executing sh-code

2009-12-02 Thread Sébastien Vauban
Hi Eric,

"Eric Schulte" wrote:
> Sébastien Vauban  writes:
>>
>> What's the impact of specifying "sh" or "bash" for the snippet?
>
> While "sh" blocks should work "bash" blocks will not be recognized. In
> org-babel "sh" doesn't explicitly mean the "sh" command, but rather means
> 'run shell' which will default to whatever shell you have configured.

I wonder if it wouldn't be beneficial to make such a feature explicit. I think
the right shell environment cannot be guessed at runtime. Am I right?

Let's imagine two use cases:

1. I only have zsh on my machine, and I'm writing a document with bash code
   blocks. What if the user executing them is using zsh as his default shell?

2. I have both bash and zsh installed on my machine. I want to write some code
   blocks in bash, and other in zsh. How can I make the difference explicit?

BTW, a "needed" feature is the executable flag for shell scripts. I found a
reference to it ("PROPOSED make tangled files executable? At least if using
shebang line") on http://orgmode.org/worg/org-contrib/babel/development.php.

Thanks anyway for your marvelous tool (replacing my need for Nuweb, and giving
me much more opportunities),
  Seb

-- 
Sébastien Vauban



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


[Orgmode] Re: [babel] Executing sh-code

2009-12-01 Thread Sébastien Vauban
Hi Eric,

FYI, I just re-did a git pull && make clean && make, before writing this post
(5 min ago). I also launched a new Emacs.

"Eric Schulte" wrote:
> Sébastien Vauban  writes:
>>
>> Let's assume the following Org file:
>>
>> #+begin_src sh :session "ecm"
>> cd ~/Personal
>> #+end_src
>>
>> #+begin_src sh :session "ecm"
>> ls *.org
>> #+end_src
>>
>> I C-c C-c the first snippet. Nothing special, except it doesn't hang anymore.
>> So, it already looks much better.
>>
>> Second snippet. C-c C-c. There, it still hangs ;-((
>>
>> Though, C-x C-b shows me the contents of the "ecm" buffer:
>>
>> cd ~/Personal
>>
>> ~ % ~/Personal % ls *.org
>> echo 'org_babel_sh_eoe'
>> Bookmarks.org  Scorpios.orgTickler.org  
>> Voice-over-IP.org*
>> Home.org*  Succession.org  Using-startx-for-Remote-Display.org  
>> refile.org
>> ~/Personal % org_babel_sh_eoe
>> ~/Personal % 

I am still puzzled by the order the commands are mixed with their output:

1. ls command
2. echo command
3. ls output
4. echo output

It's like if everything was sent at once, instead of waiting for the prompt to
appear.

Would I write see in Expect (I love it), I would write something like:

1. expect prompt
2. send ls command
3. expect result followed by prompt
4. send echo command
5. expect result followed by prompt

But, maybe, my observation has nothing to do with my problem...


> So the fix here is to fix the value of the `comint-prompt-regexp'
> variable in your shell.  Org-babel uses this variable to digest output
> from the shell.  I have mine set with the following
>
> (defun schulte/set-shell-prompt-regexp ()
>   (setq comint-prompt-regexp "^\(.+\)"))
> (add-hook 'shell-mode-hook 'schulte/set-shell-prompt-regexp)

I've put that in my .emacs file, as you can see (when asking for its value in
the shell buffer):

--8<---cut here---start->8---
comint-prompt-regexp's value is "^(.+)"
Local in buffer "ecm"; global value is "^"

Documentation:
Regexp to recognize prompts in the inferior process.
Defaults to "^", the null string at BOL.

This variable is only used if the variable
`comint-use-prompt-regexp' is non-nil.

Good choices:
  Canonical Lisp: "^[^> \n]*>+:? *" (Lucid, franz, kcl, T, cscheme, oaklisp)
  Lucid Common Lisp: "^\\(>\\|\\(->\\)+\\) *"
  franz: "^\\(->\\|<[0-9]*>:\\) *"
  kcl: "^>+ *"
  shell: "^[^#$%>\n]*[#$%>] *"
  T: "^>+ *"

This is a good thing to set in mode hooks.
--8<---cut here---end--->8---


> You'll have to change the regexp ("^\(.+\)" in my example) to match your
> prompt.

Nope. Because I'm using your prompt, as you can see in the above shell
session.


> I was unable to create your prompt locally. I find the `regexp-builder'
> function to be very handy for these situations. If you are unable to build a
> working regexp please send me a string of your prompt and I'd be happy to
> return an appropriate regexp.

N/A, if I understand you correctly, as I'm using your prompt within Emacs
shells:

--8<---cut here---start->8---
PS1="\w % "
--8<---cut here---end--->8---


> on a related topic:
>
> I've also noticed that org-babel has difficulty digesting shell output
> when it is ansi-colorized.  I'm not sure what the best fix here would
> be.  We could probably start piping all org-babel session results
> through something like `ansi-color-filter-region' but that feels a
> little bit too heavy.  I'd be interested to hear other peoples
> thoughts/suggestions.

Good you talk of that. Of course, I was using color in my prompt (but not
anymore, see above), but I was coloring ls output as well...

Disabled yesterday...

--8<---cut here---start->8---
# alias ls="ls --color=yes --classify"  # `--color=auto' tells ls to use color
#   # iff output is a tty
--8<---cut here---end--->8---

Though, even while I'm using your prompt definition, your prompt regexp
definition, bash as shell, and no color in the ls command, I still have the
same problem: "Emacs" hangs when C-c C-c on the `ls *.org' code block.

Not sure to understand what I can do to go further...

Best regards,
  Seb

-- 
Sébastien Vauban



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


[Orgmode] Re: [babel] Executing sh-code

2009-12-01 Thread Sébastien Vauban
Hi Nick and Eric,

"Eric Schulte" wrote:
> Nick Dokos  writes:
>>
>> There are two methods that I use that I think are much more effective than
>> sprinkling message calls all over the place:
>>
>>  o edebug-defun: (in emacs-lisp mode, C-u C-M-x) will mark the function
>>so that when it is called, the interpreter stops and you can then
>>single-step through it with . At each point, you can press
>>"e" and evaluate variables (actually arbitrary expressions).
>>
>>  o Insert a strategically placed (debug) call and then call the
>>function. If/when the debug call is executed, you are dropped into
>>the debugger and you can then evaluate arbitrary expressions.
>
> Excellent.  Thanks Nick, I look forward to the next bug so I can try
> these out. -- Eric

I'd like to be able to enter one level more inside Emacs and its satellites.
But, when I tried to use debuggers, I've always been confused by the multiple
solutions, as there are already 2 different debuggers (with similar names):
debug and edebug.

Plus, I wondered if there wasn't something existing around CEDET or Slime but
for ELisp...

Thanks for your answer,
  Seb

-- 
Sébastien Vauban



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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-11-30 Thread Eric Schulte
Nick Dokos  writes:

>
> There are two methods that I use that I think are much more effective
> than sprinkling message calls all over the place:
>
>  o edebug-defun: (in emacs-lisp mode, C-u C-M-x) will mark the
>  function so that when it is called, the interpreter stops and you can 
> then
>  single-step through it with . At each point, you can
>  press "e" and evaluate variables (actually arbitrary expressions).
>
>  o Insert a strategically placed (debug) call and then call the function.
>  If/when the debug call is executed, you are dropped into the debugger
>  and you can then evaluate arbitrary expressions.
>

Excellent.  Thanks Nick, I look forward to the next bug so I can try
these out. -- Eric

>
> HTH,
> Nick


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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-11-30 Thread Nick Dokos
Eric Schulte  wrote:

> Hi S=C3=A9bastien,
> 
> S=C3=A9bastien Vauban  writes:
> 
> [...]
> >
> > Just for my information (maybe being able to be more accurate next time, =
> or
> > even finding a solution myself), how do you debug such a problem?
> >
> > With which debugger, with tracing/stepping?  With stack trace?
> >
> 
> I'm almost embarrassed to admit that I do most of my elisp debugging
> with the `message' function.  I embed `message' debug statements to
> print the values of key variables at key points, and I run through
> problems looking at the output.
> 
> I'd be interested to hear if anyone can recommend a better elisp
> debugging solution.
> 

There are two methods that I use that I think are much more effective
than sprinkling message calls all over the place:

 o edebug-defun: (in emacs-lisp mode, C-u C-M-x) will mark the
 function so that when it is called, the interpreter stops and you can then
 single-step through it with . At each point, you can
 press "e" and evaluate variables (actually arbitrary expressions).

 o Insert a strategically placed (debug) call and then call the function.
 If/when the debug call is executed, you are dropped into the debugger
 and you can then evaluate arbitrary expressions.

HTH,
Nick



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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-11-30 Thread Eric Schulte
Hi Sébastien,

Sébastien Vauban  writes:

[...]
>
> Just for my information (maybe being able to be more accurate next time, or
> even finding a solution myself), how do you debug such a problem?
>
> With which debugger, with tracing/stepping?  With stack trace?
>

I'm almost embarrassed to admit that I do most of my elisp debugging
with the `message' function.  I embed `message' debug statements to
print the values of key variables at key points, and I run through
problems looking at the output.

I'd be interested to hear if anyone can recommend a better elisp
debugging solution.

>
> Let's assume the following Org file:
>
> #+begin_src sh :session "ecm"
> cd ~/Personal
> #+end_src
>
> #+begin_src sh :session "ecm"
> ls *.org
> #+end_src
>
> I C-c C-c the first snippet. Nothing special, except it doesn't hang anymore.
> So, it already looks much better.
>
> Second snippet. C-c C-c. There, it still hangs ;-((
>
> Though, C-x C-b shows me the contents of the "ecm" buffer:
>
> cd ~/Personal
>
> ~ % ~/Personal % ls *.org
> echo 'org_babel_sh_eoe'
> Bookmarks.org  Scorpios.orgTickler.org  
> Voice-over-IP.org*
> Home.org*  Succession.org  Using-startx-for-Remote-Display.org  refile.org
> ~/Personal % org_babel_sh_eoe
> ~/Personal % 
>
> Looks closer to what it should...
>
> Still a little problem, though, as explained above.
>

So the fix here is to fix the value of the `comint-prompt-regexp'
variable in your shell.  Org-babel uses this variable to digest output
from the shell.  I have mine set with the following

--8<---cut here---start->8---
(defun schulte/set-shell-prompt-regexp ()
  (setq comint-prompt-regexp "^\(.+\)"))
(add-hook 'shell-mode-hook 'schulte/set-shell-prompt-regexp)
--8<---cut here---end--->8---

You'll have to change the regexp ("^\(.+\)" in my example) to match your
prompt.  I was unable to create your prompt locally.  I find the
`regexp-builder' function to be very handy for these situations.  If you
are unable to build a working regexp please send me a string of your
prompt and I'd be happy to return an appropriate regexp.

on a related topic:

I've also noticed that org-babel has difficulty digesting shell output
when it is ansi-colorized.  I'm not sure what the best fix here would
be.  We could probably start piping all org-babel session results
through something like `ansi-color-filter-region' but that feels a
little bit too heavy.  I'd be interested to hear other peoples
thoughts/suggestions.

>
> BTW, what's the impact of specifying "sh" or "bash" for the snippet?
>

While "sh" blocks should work "bash" blocks will not be recognized.  In
org-babel "sh" doesn't explicitly mean the "sh" command, but rather
means 'run shell' which will default to whatever shell you have
configured.

Thanks -- Eric

>
> Best regards,
>   Seb


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


[Orgmode] Re: [babel] Executing sh-code

2009-11-29 Thread Sébastien Vauban
Hi Eric and Dan,

Dan Davison wrote:
> Sébastien Vauban  writes:
>> Torsten Wagner wrote:
>>> This works for me (I changed the folder name). There is a error line in my
>>> message buffer:
>>>
>>> executing Shell source code block
>>> ~/babel 
>>> save-current-buffer: Wrong type argument: char-or-string-p, nil
>>>
>>> but the relevent part runs ok. My shell buffer depict to the new folder
>>> after execution:
>>>
>>> tors...@gaijin ~ % 
>>> cd ~/babel
>>> echo 'org_babel_sh_eoe'
>>> tors...@gaijin ~ % cd ~/babel
>>> tors...@gaijin ~/babel (git)-[master] %
>
>> It stops working only when I add `:session "whatever"' after the `sh'
>> specification.
>>
>> That's the only difference between when it works and when it doesn't.
>
> You discovered a tricky bug in the session-based evaluation of shell blocks.

Just for my information (maybe being able to be more accurate next time, or
even finding a solution myself), how do you debug such a problem?

With which debugger, with tracing/stepping?  With stack trace?


> I've just pushed up a fix which fixes this bug and generally cleans up the
> code executing sh blocks inside of interactive sessions. Please try the
> latest and see if the problem persists.

Just did: git pull && make clean && make.


> I'm also seeing problems with shell session evaluation but having
> trouble debugging. My current suspicion is that the prompt characters
> are the problem here (something which differs between you and Torsten)
> Could you try using a prompt that ends in '% '? E.g. on ubuntu at least
> I can set the prompt in emacs shell sessions with a line like
>
> PS1='\w % '
>
> in ~/.emacs_bash.

I did this in my .bashrc:

--8<---cut here---start->8---
# my format of the prompt
function my_prompt_command ()
{
# colorful prompt, based on whether the previous command succeeded or not
if [[ $? -eq 0 ]]; then
HILIT=${GREEN}
else
HILIT=${RED}
fi

# replace the $HOME prefix by ~ in the current directory
if [[ $HOME == ${PWD:0:${#HOME}} ]]; then
NEWPWD="~${PWD:${#HOME}}"
else
NEWPWD=$PWD
fi

# how many characters of the $PWD should be kept
local pwd_max_length=15

if [[ ${#NEWPWD} -gt $pwd_max_length ]]; then
local pwd_offset=$(( ${#NEWPWD} - $pwd_max_length ))
NEWPWD="...${NEWPWD:$pwd_offset:$pwd_max_length}"
fi

# prompt character
if [[ $(whoami) = "root" ]]; then
local PROMPTCHAR="#"
else
local PROMPTCHAR=">"
fi

case $TERM in
# TODO use `date' instead of escape characters...
dumb)
# Emacs shell mode and Tramp among others
setenv PS1 "[...@\h] ${NEWPWD}${PROMPTCHAR}"
;;
emacs | *)
# Emacs is handled in the same way as other terminals, if it's
# configured to use `ansi-color' to translate ANSI escape
# sequences into colored faces
setenv PS1 "\w % "  ;; <<
;;
esac
}
--8<---cut here---end--->8---


> Also, please pull latest git as we have just fixed an unrelated bug in
> shell session-based evaluation.

Now, with the new version and the prompt change, what's the result?

Let's assume the following Org file:

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

#+begin_src sh :session "ecm"
ls *.org
#+end_src
--8<---cut here---end--->8---

I C-c C-c the first snippet. Nothing special, except it doesn't hang anymore.
So, it already looks much better.

Second snippet. C-c C-c. There, it still hangs ;-((

Though, C-x C-b shows me the contents of the "ecm" buffer:

--8<---cut here---start->8---
cd ~/Personal

~ % ~/Personal % ls *.org
echo 'org_babel_sh_eoe'
Bookmarks.org  Scorpios.orgTickler.org  
Voice-over-IP.org*
Home.org*  Succession.org  Using-startx-for-Remote-Display.org  refile.org
~/Personal % org_babel_sh_eoe
~/Personal % 
--8<---cut here---end--->8---

Looks closer to what it should...

Still a little problem, though, as explained above.

BTW, what's the impact of specifying "sh" or "bash" for the snippet?

Best regards,
  Seb

-- 
Sébastien Vauban



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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-11-27 Thread Dan Davison
Sébastien Vauban  writes:

> Hi Torsten,
>
> Torsten Wagner wrote:
>> I just tried quickly. I use org-babel with python, up to now never with
>> shell scripting.
>>
>>> --8<---cut here---start->8---
>>> * Prerequisites
>>> 
>>> #+begin_src sh :session ecm
>>> cd ~/Personal
>>> #+end_src
>>> --8<---cut here---end--->8---
>>
>> This works for me (I changed the folder name). There is a error line in my
>> message buffer:
>>
>> executing Shell source code block
>> ~/babel 
>> save-current-buffer: Wrong type argument: char-or-string-p, nil
>>
>> but the relevent part runs ok. My shell buffer depict to the new folder
>> after execution:
>>
>> tors...@gaijin ~ % 
>> cd ~/babel
>> echo 'org_babel_sh_eoe'
>> tors...@gaijin ~ % cd ~/babel
>> tors...@gaijin ~/babel (git)-[master] %

Hi Seb,

I'm also seeing problems with shell session evaluation but having
trouble debugging. My current suspicion is that the prompt characters
are the problem here (something which differs between you and Torsten)
Could you try using a prompt that ends in '% '? E.g. on ubuntu at least
I can set the prompt in emacs shell sessions with a line like

PS1='\w % '

in ~/.emacs_bash.

Also, please pull latest git as we have just fixed an unrelated bug in
 shell session-based evaluation.

Dan





>>
>>
>> I used the same init like you
>>
>>> 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---
>>
>> However I didn't use the (org-babel-load-library-of-babel) function.
>
> I removed it. No change.
>
>
>> Which version of org-mode di you use ?
>
> A version of somewhere last week.
>
>
>> org-babel is young and change still heavily. I guess you have to use the
>> latest git-version of org-mode.
>
> Just did:
>
> git pull
> make clean
> make
>
> No change (after Emacs restart).
>
>
>> Furthermore, does the shell iteself (M-x shell) work in emacs as desired ?
>
> Yep.
>
> Though, there is one blank line in front:
>
>
> [...@mundaneum] ~>
>   ^ cursor blinking here
>
> I don't know if that's worth mentionning...
>
> Tried as well this change:
>
> ;; for single shell commands
> (setq shell-file-name "zsh")
>
> Same problem (after Emacs restart).
>
>
>> Sorry not a big help at least a pointer that it should work...
>
> Thanks anyway. It's helpful to know someone gets it working the same way (at
> least, from a first observation).
>
> Just note that the following works well:
>
> #+begin_src sh
> cd ~/Personal
> ls *.org
> #+end_src
>
> #+results:
> | "Bookmarks.org"   |
> | "Home.org"|
> | "refile.org"  |
> | "Scorpios.org"|
> | "Succession.org"  |
> | "Tickler.org" |
> | "Using-startx-for-Remote-Display.org" |
> | "Voice-over-IP.org"   |
>
> It stops working only when I add `:session "whatever"' after the `sh'
> specification.
>
> That's the only difference between when it works and when it doesn't.
>
> Maybe this can help?
>
> Best regards,
>   Seb


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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-11-27 Thread Eric Schulte
Sébastien Vauban  writes:

>
> It stops working only when I add `:session "whatever"' after the `sh'
> specification.
>
> That's the only difference between when it works and when it doesn't.
>

Hi Sébastien,

You discovered a tricky bug in the session-based evaluation of shell
blocks.  I've just pushed up a fix which fixes this bug and generally
cleans up the code executing sh blocks inside of interactive sessions.
Please try the latest and see if the problem persists.

>
> Maybe this can help?
>

Very much so.

Thanks -- Eric

>
> Best regards,
>   Seb


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


Re: [Orgmode] Re: [babel] Executing sh-code

2009-11-27 Thread Eric S Fraga
At Fri, 27 Nov 2009 10:15:41 +0100,
Sébastien Vauban wrote:
> 
> 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

I have the same problem (emacs hangs) but this works just fine without
the session option so I would suggest that the error relates to this
aspect?

Sorry I can't be of any direct help, however. :(


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


[Orgmode] Re: [babel] Executing sh-code

2009-11-27 Thread Sébastien Vauban
Hi Torsten,

Torsten Wagner wrote:
> I just tried quickly. I use org-babel with python, up to now never with
> shell scripting.
>
>> --8<---cut here---start->8---
>> * Prerequisites
>> 
>> #+begin_src sh :session ecm
>> cd ~/Personal
>> #+end_src
>> --8<---cut here---end--->8---
>
> This works for me (I changed the folder name). There is a error line in my
> message buffer:
>
> executing Shell source code block
> ~/babel 
> save-current-buffer: Wrong type argument: char-or-string-p, nil
>
> but the relevent part runs ok. My shell buffer depict to the new folder
> after execution:
>
> tors...@gaijin ~ % 
> cd ~/babel
> echo 'org_babel_sh_eoe'
> tors...@gaijin ~ % cd ~/babel
> tors...@gaijin ~/babel (git)-[master] %
>
>
> I used the same init like you
>
>> 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---
>
> However I didn't use the (org-babel-load-library-of-babel) function.

I removed it. No change.


> Which version of org-mode di you use ?

A version of somewhere last week.


> org-babel is young and change still heavily. I guess you have to use the
> latest git-version of org-mode.

Just did:

--8<---cut here---start->8---
git pull
make clean
make
--8<---cut here---end--->8---

No change (after Emacs restart).


> Furthermore, does the shell iteself (M-x shell) work in emacs as desired ?

Yep.

Though, there is one blank line in front:

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

[...@mundaneum] ~>
  ^ cursor blinking here
--8<---cut here---end--->8---

I don't know if that's worth mentionning...

Tried as well this change:

--8<---cut here---start->8---
;; for single shell commands
(setq shell-file-name "zsh")
--8<---cut here---end--->8---

Same problem (after Emacs restart).


> Sorry not a big help at least a pointer that it should work...

Thanks anyway. It's helpful to know someone gets it working the same way (at
least, from a first observation).

Just note that the following works well:

--8<---cut here---start->8---
#+begin_src sh
cd ~/Personal
ls *.org
#+end_src

#+results:
| "Bookmarks.org"   |
| "Home.org"|
| "refile.org"  |
| "Scorpios.org"|
| "Succession.org"  |
| "Tickler.org" |
| "Using-startx-for-Remote-Display.org" |
| "Voice-over-IP.org"   |
--8<---cut here---end--->8---

It stops working only when I add `:session "whatever"' after the `sh'
specification.

That's the only difference between when it works and when it doesn't.

Maybe this can help?

Best regards,
  Seb

-- 
Sébastien Vauban



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


[Orgmode] Re: [babel] Executing sh-code

2009-11-27 Thread Sébastien Vauban
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-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(#)
>   (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)
>
> and I have an empty Shell buffer:
>
>
> [Wed Nov 25 15:13:10]
> [...@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 that
> it's the difficult part: is there a way to ask the password and g