ob-php.el 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ;;; ob-php.el --- Execute PHP within org-mode blocks.
  2. ;; Copyright 2016 stardiviner
  3. ;; Author: stardiviner <numbchild@gmail.com>
  4. ;; Maintainer: stardiviner <numbchild@gmail.com>
  5. ;; Keywords: org babel php
  6. ;; URL: https://github.com/stardiviner/ob-php
  7. ;; Created: 04th May 2016
  8. ;; Version: 0.0.1
  9. ;; Package-Requires: ((org "8"))
  10. ;;; Commentary:
  11. ;;
  12. ;; Execute PHP within org-mode blocks.
  13. ;;; Code:
  14. (require 'org)
  15. (require 'ob)
  16. (defgroup ob-php nil
  17. "org-mode blocks for PHP."
  18. :group 'org)
  19. (defcustom ob-php:inf-php-buffer "*php*"
  20. "Default PHP inferior buffer."
  21. :group 'ob-php
  22. :type 'string)
  23. ;;;###autoload
  24. (defun org-babel-execute:php (body params)
  25. "Orgmode Babel PHP evaluate function for `BODY' with `PARAMS'."
  26. (let* ((cmd "php")
  27. (body (concat "<?php\n" body "\n?>")))
  28. (org-babel-eval cmd body)
  29. ))
  30. ;;;###autoload
  31. (eval-after-load "org"
  32. '(add-to-list 'org-src-lang-modes '("php" . php)))
  33. (defvar org-babel-default-header-args:php '())
  34. (add-to-list 'org-babel-default-header-args:php
  35. '(:results . "output"))
  36. (provide 'ob-php)
  37. ;;; ob-php.el ends here