From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: [PATCH] support change ob-php.el default PHP command and specifying command options Date: Thu, 20 Feb 2020 23:21:01 +0800 Message-ID: <874kvl8eua.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:48857) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4nkM-00045o-1X for emacs-orgmode@gnu.org; Thu, 20 Feb 2020 10:28:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j4nkK-00041Z-OT for emacs-orgmode@gnu.org; Thu, 20 Feb 2020 10:28:13 -0500 Received: from [112.17.247.17] (port=62105 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j4nkC-0003wM-Ht for emacs-orgmode@gnu.org; Thu, 20 Feb 2020 10:28:12 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I first created a very simple ob-php.el because it does not exist in Org Mo= de. But it's really just a very simple code. Now a friend of mine is using it, I wish to improve it. Seems current ob-php.el does not support some cases lik= e PHP code "include ". Current patch is a more flexible solution. Might provide some freedom for u= ser to adopt. =2D-=20 [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 =20=20=20=20=20=20 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-contrib-lisp-ob-php.el-Support-change-evaluate-comma.patch Content-Transfer-Encoding: quoted-printable From=20b158232fdc418437aebe2baacabeef289e0537c3 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Thu, 20 Feb 2020 23:14:15 +0800 Subject: [PATCH] contrib/lisp/ob-php.el: Support change evaluate command specify options. * contrib/lisp/ob-php.el (org-babel-php-command): Add new customizable option `org-babel-php-command` to change default command. * contrib/lisp/ob-php.el (org-babel-php-command-options): Add new customizable option `org-babel-php-command-options` to specify command options. * contrib/lisp/ob-php.el (org-babel-execute:php): Use new commands in execute function. =2D-- contrib/lisp/ob-php.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/lisp/ob-php.el b/contrib/lisp/ob-php.el index 1befbd248..43aede26c 100644 =2D-- a/contrib/lisp/ob-php.el +++ b/contrib/lisp/ob-php.el @@ -21,6 +21,16 @@ (defgroup ob-php nil "org-mode blocks for PHP." :group 'org) =20 +(defcustom org-babel-php-command "php" + "The command to execute babel body code." + :group 'ob-php + :type 'string) + +(defcustom org-babel-php-command-options nil + "The php command options to use when execute code." + :group 'ob-php + :type 'string) + (defcustom ob-php:inf-php-buffer "*php*" "Default PHP inferior buffer." :group 'ob-php @@ -29,10 +39,9 @@ (defcustom ob-php:inf-php-buffer "*php*" ;;;###autoload (defun org-babel-execute:php (body params) "Orgmode Babel PHP evaluate function for `BODY' with `PARAMS'." =2D (let* ((cmd "php") + (let* ((cmd (concat org-babel-php-command " " org-babel-php-command-opti= ons)) (body (concat ""))) =2D (org-babel-eval cmd body) =2D )) + (org-babel-eval cmd body))) =20 ;;;###autoload (eval-after-load "org" =2D-=20 2.25.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5Oo90UHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsOURAf/btAjDhzdRscStKz1YV2ZqNrHK1JW WaEFTWvT0W63hRQ41m+bbaTnuRtsga2QE6PH9FId7IlzlbW2YHJ7vNTjvidA7XIp W05Qin5KZkQAuqKOSXLiOYh1tsslpWt/hq07jTxGCqR4K9LxlrYYnuAEril/v00z pD9n2+6wF9I4CdnrM27uIurt6NICLVEHCENZJSIJdMrWbDYOA/4awxkjI8A+B2Oa hoo1Oe/bnRS1FLT1uCBxIAqnNnndYJ+iekzLi93UZherd8NMwRsfjHM7s/ri+mcY X7B3pcSGzhlJ+1mMlbQmOQupqCdWCTE4JwT+KQmf11mMdnepWvDf5D0dpw== =cZw6 -----END PGP SIGNATURE----- --==-=-=--