diff options
author | stardiviner <numbchild@gmail.com> | 2018-02-10 08:13:53 +0800 |
---|---|---|
committer | stardiviner <numbchild@gmail.com> | 2018-02-10 08:13:53 +0800 |
commit | 43c035481126ff68ab1df57a16f0bc67d72cd8f3 (patch) | |
tree | f011aa82cfbf8965b544deaddd41366d6435b045 | |
parent | 6c5f5acf86ef9f561b15f8ca2e7ee3af27a29a3a (diff) | |
download | org-mode-43c035481126ff68ab1df57a16f0bc67d72cd8f3.tar.gz |
* ob-lua.el (supporting Lua in Org-mode Babel): Add.
First version.
-rw-r--r-- | contrib/lisp/ob-lua.el | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/lisp/ob-lua.el b/contrib/lisp/ob-lua.el new file mode 100644 index 0000000..f33090e --- /dev/null +++ b/contrib/lisp/ob-lua.el @@ -0,0 +1,45 @@ +;;; ob-lua.el --- Execute Lua code within org-mode blocks. +;; Copyright 2016 stardiviner + +;; Author: stardiviner <numbchild@gmail.com> +;; Maintainer: stardiviner <numbchild@gmail.com> +;; Keywords: org babel lua +;; URL: https://github.com/stardiviner/ob-lua +;; Created: 12th April 2016 +;; Version: 0.0.1 +;; Package-Requires: ((org "8")) + +;;; Commentary: +;; +;; Execute Lua code within org-mode blocks. + +;;; Code: +(require 'org) +(require 'ob) + +(defgroup ob-lua nil + "org-mode blocks for Lua." + :group 'org) + +(defcustom ob-lua:default-session "*lua*" + "Default Lua session. + +It is lua inferior process from `run-lua'." + :group 'ob-lua + :type 'string) + +;;;###autoload +(defun org-babel-execute:lua (body params) + "org-babel lua hook." + (let* ((session (or (cdr (assoc :session params)) + ob-lua:default-session)) + (cmd (mapconcat 'identity (list "lua -") " "))) + (org-babel-eval cmd body))) + +;;;###autoload +(eval-after-load "org" + '(add-to-list 'org-src-lang-modes '("lua" . lua))) + +(provide 'ob-lua) + +;;; ob-lua.el ends here |