emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix to allow ob-babel-shell-names to be customised.
@ 2016-07-23  0:55 Bernard Hurley
  2016-07-23  8:48 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Bernard Hurley @ 2016-07-23  0:55 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

At present customisation of the variable ob-babel-shell-names in
ob-shell.el doesn't work properly.  You can actually change its value
and save the customisation, but the org-babel-execute:<name> functions
get created for the hard coded value of the variable not the customised
value.

The following patch should fix it:

---------------snip------------
*** ob-shell.el.old	2016-07-22 20:43:43.190100908 +0100
--- ob-shell.el	2016-07-22 22:55:28.730037538 +0100
***************
*** 42,60 ****
  
  (defcustom org-babel-shell-names
    '("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")
!   "List of names of shell supported by babel shell code blocks."
    :group 'org-babel
!   :type 'string
!   :initialize
    (lambda (symbol value)
!     (set-default symbol (second value))
      (mapc
       (lambda (name)
         (eval `(defun ,(intern (concat "org-babel-execute:" name)) (body params)
  		,(format "Execute a block of %s commands with Babel." name)
  		(let ((shell-file-name ,name))
  		  (org-babel-execute:shell body params)))))
!      (second value))))
  
  (defun org-babel-execute:shell (body params)
    "Execute a block of Shell commands with Babel.
--- 42,61 ----
  
  (defcustom org-babel-shell-names
    '("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")
!   "List of names of shell supported by babel shell code blocks.
! Changing this variable outside the Customize interface has no effect."
    :group 'org-babel
!   :type '(repeat string)
!   :set
    (lambda (symbol value)
!     (set-default symbol value)
      (mapc
       (lambda (name)
         (eval `(defun ,(intern (concat "org-babel-execute:" name)) (body params)
  		,(format "Execute a block of %s commands with Babel." name)
  		(let ((shell-file-name ,name))
  		  (org-babel-execute:shell body params)))))
!      value)))
  
  (defun org-babel-execute:shell (body params)
    "Execute a block of Shell commands with Babel.
-----------------------snip----------

I am using Org version 8.3.5 in Emacs  25.1.50.1.

Cheers,

Bernard

-- 

Your fortune cookie for today:

Marriage is low down, but you spend the rest of your life paying for it.
		-- Baskins

** Fortune cookies are brought to you by GNU/Linux "fortunes" **

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix to allow ob-babel-shell-names to be customised.
  2016-07-23  0:55 [PATCH] Fix to allow ob-babel-shell-names to be customised Bernard Hurley
@ 2016-07-23  8:48 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2016-07-23  8:48 UTC (permalink / raw)
  To: Bernard Hurley; +Cc: emacs-orgmode

Hello,

Bernard Hurley <bernard@marcade.biz> writes:

> At present customisation of the variable ob-babel-shell-names in
> ob-shell.el doesn't work properly.  You can actually change its value
> and save the customisation, but the org-babel-execute:<name> functions
> get created for the hard coded value of the variable not the customised
> value.

Thank you for the report. However, this is already fixed in development
version.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-23  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-23  0:55 [PATCH] Fix to allow ob-babel-shell-names to be customised Bernard Hurley
2016-07-23  8:48 ` Nicolas Goaziou

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