diff options
author | stardiviner <numbchild@gmail.com> | 2018-02-10 08:16:29 +0800 |
---|---|---|
committer | stardiviner <numbchild@gmail.com> | 2018-02-10 08:16:29 +0800 |
commit | 8a58a9fd46485b7f27f006af306b792baa887776 (patch) | |
tree | 47c910f35ace373319d81dafb3f9c7deaf166f43 | |
parent | 43c035481126ff68ab1df57a16f0bc67d72cd8f3 (diff) | |
download | org-mode-8a58a9fd46485b7f27f006af306b792baa887776.tar.gz |
* ob-php.el (supporting PHP in Org-mode Babel): Add.
First version.
-rw-r--r-- | contrib/lisp/ob-php.el | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/lisp/ob-php.el b/contrib/lisp/ob-php.el new file mode 100644 index 0000000..1befbd2 --- /dev/null +++ b/contrib/lisp/ob-php.el @@ -0,0 +1,48 @@ +;;; ob-php.el --- Execute PHP within org-mode blocks. +;; Copyright 2016 stardiviner + +;; Author: stardiviner <numbchild@gmail.com> +;; Maintainer: stardiviner <numbchild@gmail.com> +;; Keywords: org babel php +;; URL: https://github.com/stardiviner/ob-php +;; Created: 04th May 2016 +;; Version: 0.0.1 +;; Package-Requires: ((org "8")) + +;;; Commentary: +;; +;; Execute PHP within org-mode blocks. + +;;; Code: +(require 'org) +(require 'ob) + +(defgroup ob-php nil + "org-mode blocks for PHP." + :group 'org) + +(defcustom ob-php:inf-php-buffer "*php*" + "Default PHP inferior buffer." + :group 'ob-php + :type 'string) + +;;;###autoload +(defun org-babel-execute:php (body params) + "Orgmode Babel PHP evaluate function for `BODY' with `PARAMS'." + (let* ((cmd "php") + (body (concat "<?php\n" body "\n?>"))) + (org-babel-eval cmd body) + )) + +;;;###autoload +(eval-after-load "org" + '(add-to-list 'org-src-lang-modes '("php" . php))) + +(defvar org-babel-default-header-args:php '()) + +(add-to-list 'org-babel-default-header-args:php + '(:results . "output")) + +(provide 'ob-php) + +;;; ob-php.el ends here |