emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Fix to allow ob-babel-shell-names to be customised.


From: Bernard Hurley
Subject: [O] [PATCH] Fix to allow ob-babel-shell-names to be customised.
Date: Sat, 23 Jul 2016 01:55:31 +0100
User-agent: Notmuch/0.22 (http://notmuchmail.org) Emacs/25.1.50.1 (x86_64-unknown-linux-gnu)

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" **



reply via email to

[Prev in Thread] Current Thread [Next in Thread]