Re: [O] [PATCH] ob-shell: honor the specified shell for :session

2014-07-28 Thread Bastien
Hi Achim,

Achim Gratz strom...@nexgo.de writes:

 I've added all user-visible changes from me that will go into 8.3.

Thanks for this.  Any committer can add visible changes from anyone,
so please feel free.

Best,

-- 
 Bastien



Re: [O] [PATCH] ob-shell: honor the specified shell for :session

2014-06-30 Thread Achim Gratz
Bastien writes:
 In the perspective of Org 8.3, we need to start updating etc/ORG-NEWS.

Done.

 Regardless of whether this was documented in the official manual or
 not, a note in ORG-NEWS would be useful -- feel free to start editing
 this file.

I've added all user-visible changes from me that will go into 8.3.


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables




Re: [O] [PATCH] ob-shell: honor the specified shell for :session

2014-06-25 Thread Bastien
Hi Achim,

thanks for this.

Achim Gratz strom...@nexgo.de writes:

 In the case you mention above shell-file-name is used.  Which means that
 if you change it in a running emacs session, then it will be picked up
 for shell blocks (as one might reasonably expect), whereas you would
 have had to change org-babel-sh-command before.  None of that was
 documented anyway (and still isn't).

In the perspective of Org 8.3, we need to start updating etc/ORG-NEWS.

Regardless of whether this was documented in the official manual or
not, a note in ORG-NEWS would be useful -- feel free to start editing
this file.

-- 
 Bastien



Re: [O] [PATCH] ob-shell: honor the specified shell for :session

2014-06-23 Thread Achim Gratz
Eric Schulte writes:
 I thought that `org-babel-sh-command' was still used if code blocks used
 the keyword shell as the language.  If that's not the case and there
 really is no more use for `org-babel-sh-command', then please go ahead
 and apply this patch.

Done on master.

In the case you mention above shell-file-name is used.  Which means that
if you change it in a running emacs session, then it will be picked up
for shell blocks (as one might reasonably expect), whereas you would
have had to change org-babel-sh-command before.  None of that was
documented anyway (and still isn't).


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




[O] [PATCH] ob-shell: honor the specified shell for :session

2014-06-22 Thread Achim Gratz

When using a shell block with a :session, the specified shell is ignored
and the original value of org-babel-sh-command (defaulting to the value
of shell-file-name as set at load-time) gets used.  The following patch
fixes this, however there are still several other problems with how
shells are invoked and how shell sessions are used that need to be
addressed.

From ed034803b9fd87d8f9d382303fc950d83b88711f Mon Sep 17 00:00:00 2001
From: Achim Gratz strom...@stromeko.de
Date: Sun, 22 Jun 2014 11:16:41 +0200
Subject: [PATCH] ob-shell: honor the specified shell for :session

* lisp/ob-shell.el: Remove defcustom `org-babel-sh-command' and
  replace with `shell-file-name' throughout.
  (org-babel-variable-assignments:sh): Make check for bash work in more
  cases.

The original code and the patched version rely on the shell being
available via PATH.  Instead the shell name should be mapped to the
appropriate executable via an alist and invoked via an absolute
filename.  For security reasons the permissible shells should probably
be taken from /etc/shells or equivalent by default.  Instead of
checking for bash, the same or another alist could provide the
information of whether or not the shell supports arrays (which indeed
were introduced by ksh originally).
---
 lisp/ob-shell.el | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el
index 474a8f2..720af8f 100644
--- a/lisp/ob-shell.el
+++ b/lisp/ob-shell.el
@@ -38,13 +38,6 @@
 
 (defvar org-babel-default-header-args:sh '())
 
-(defcustom org-babel-sh-command shell-file-name
-  Command used to invoke a shell.
-Set by default to the value of `shell-file-name'.  This will be
-passed to `shell-command-on-region'
-  :group 'org-babel
-  :type 'string)
-
 (defcustom org-babel-sh-var-quote-fmt
   $(cat 'BABEL_TABLE'\n%s\nBABEL_TABLE\n)
   Format string used to escape variables when passed to shell scripts.
@@ -63,7 +56,7 @@ (defcustom org-babel-shell-names
  (lambda (name)
(eval `(defun ,(intern (concat org-babel-execute: name)) (body params)
 		,(format Execute a block of %s commands with Babel. name)
-		(let ((org-babel-sh-command ,name))
+		(let ((shell-file-name ,name))
 		  (org-babel-execute:shell body params)
  (second value
 
@@ -152,7 +145,7 @@ (defun org-babel-variable-assignments:sh (params)
 		 hline
 (mapcar
  (lambda (pair)
-   (if (string= org-babel-sh-command bash)
+   (if (string-match bash$ shell-file-name)
 	   (org-babel-variable-assignments:bash
 (car pair) (cdr pair) sep hline)
  (org-babel-variable-assignments:sh-generic
@@ -217,7 +210,7 @@ (defun org-babel-sh-evaluate (session body optional params stdin cmdline)
(call-process-shell-command
 (if shebang
 script-file
-  (format %s %s org-babel-sh-command script-file))
+  (format %s %s shell-file-name script-file))
 stdin-file
 (current-buffer) nil cmdline)
(buffer-string
@@ -255,7 +248,7 @@ (defun org-babel-sh-evaluate (session body optional params stdin cmdline)
(insert body))
  (set-file-modes script-file #o755)
  (org-babel-eval script-file ))
- (org-babel-eval org-babel-sh-command (org-babel-trim body)))
+ (org-babel-eval shell-file-name (org-babel-trim body)))
 (when results
   (let ((result-params (cdr (assoc :result-params params
 (org-babel-result-cond result-params
-- 
2.0.0



Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada


Re: [O] [PATCH] ob-shell: honor the specified shell for :session

2014-06-22 Thread Eric Schulte
I thought that `org-babel-sh-command' was still used if code blocks used
the keyword shell as the language.  If that's not the case and there
really is no more use for `org-babel-sh-command', then please go ahead
and apply this patch.

Thanks,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)