emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Executing sh-code
@ 2010-10-15 16:06 Sébastien Vauban
  0 siblings, 0 replies; only message in thread
From: Sébastien Vauban @ 2010-10-15 16:06 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

* Executing sh code

This report is not complete yet (I now really have to go), but comments are
already welcome, and can put things in light for further study...

** No session

#+begin_src sh
echo In $(pwd):
ls *.org
#+end_src

#+results:
| In                          | /cygdrive/c/home/sva/Examples/Org-scraps: |
| Agenda-Sorting-Strategy.org |                                           |
| Clock-Report.org            |                                           |
| Ledger-Scorpios.org         |                                           |
| org-beamer-fpu-rules.org    |                                           |
| org-hist.org                |                                           |

** With session

#+begin_src sh :session sva
echo In $(pwd):
ls *.org
#+end_src

never terminates, echoing:

: executing Sh code block...

in the minibuffer.

** Variable comint-prompt-regexp

Value of the =comint-prompt-regexp= variable in my shell, used by Org-babel to
digest output from the shell:

#+begin_src emacs-lisp
(switch-to-buffer "sva")
(describe-variable 'comint-prompt-regexp)
#+end_src

#+results:
#+begin_example
comint-prompt-regexp is a variable defined in `comint.el'.
Its value is 
"^[^#$%>\n]*[#$%>] *"
Local in buffer sva; 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.
#+end_example

This regexp should match my own prompt as it appears in your *shell*
buffers locally (product of my personal =.bashrc=) configuration.

** What about shell-prompt-pattern?

Browsing along, it seems there is another interesting value to look at:
=shell-prompt-pattern=.

#+begin_src emacs-lisp
(switch-to-buffer "sva")
(describe-variable 'shell-prompt-pattern)
#+end_src

#+results:
#+begin_example
shell-prompt-pattern is a variable defined in `shell.el'.
Its value is 
"^MEDIACENTER [^ ]+ \\[[0-9]+\\] "

Documentation:
Regexp to match prompts in the inferior shell.
Defaults to "^[^#$%>\n]*[#$%>] *", which works pretty well.
This variable is used to initialize `comint-prompt-regexp' in the
shell buffer.

If `comint-use-prompt-regexp' is nil, then this variable is only used
to determine paragraph boundaries.  See Info node `Shell Prompts' for
how Shell mode treats paragraphs.

The pattern should probably not match more than one line.  If it does,
Shell mode may become confused trying to distinguish prompt from input
on lines which don't start with a prompt.

This is a fine thing to set in your `.emacs' file.

You can customize this variable.
#+end_example

** Back to comint's prompt regexp!

#+begin_src emacs-lisp
(switch-to-buffer "sva")
(describe-variable 'comint-use-prompt-regexp)
#+end_src

#+results:
#+begin_example
comint-use-prompt-regexp is a variable defined in `comint.el'.
Its value is nil

Documentation:
If non-nil, use `comint-prompt-regexp' to recognize prompts.
If nil, then program output and user-input are given different `field'
properties, which Emacs commands can use to distinguish them (in
particular, common movement commands such as `beginning-of-line'
respect field boundaries in a natural way).

You can customize this variable.
#+end_example

NIL!?  Do you have this as well?

Thanks!

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-15 16:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-15 16:06 Executing sh-code Sébastien Vauban

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