emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernard Hurley <bernard@marcade.biz>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix to allow ob-babel-shell-names to be customised.
Date: Sat, 23 Jul 2016 01:55:31 +0100	[thread overview]
Message-ID: <87vazxb2bg.fsf@marcade.biz> (raw)

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	other threads:[~2016-07-23  1:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-23  0:55 Bernard Hurley [this message]
2016-07-23  8:48 ` [PATCH] Fix to allow ob-babel-shell-names to be customised Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vazxb2bg.fsf@marcade.biz \
    --to=bernard@marcade.biz \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).