* add some babel supports (PHP, Lua, Redis)
@ 2016-05-10 8:07 numbchild
2016-05-10 9:42 ` Rasmus
0 siblings, 1 reply; 12+ messages in thread
From: numbchild @ 2016-05-10 8:07 UTC (permalink / raw)
To: Org-mode
[-- Attachment #1: Type: text/plain, Size: 430 bytes --]
I created three branches on my personal public org-mode repo on GitHub.
- ob-lua
- ob-php
- ob-redis
https://github.com/stardiviner/org-mode
Hope maintainer can merge those branches.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
[-- Attachment #2: Type: text/html, Size: 1575 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-10 8:07 add some babel supports (PHP, Lua, Redis) numbchild
@ 2016-05-10 9:42 ` Rasmus
2016-05-10 15:23 ` numbchild
0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2016-05-10 9:42 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Thanks for your patches.
Some comments follow.
"numbchild@gmail.com" <numbchild@gmail.com> writes:
> - ob-lua
> - ob-php
> - ob-redis
>
> https://github.com/stardiviner/org-mode
>
> Hope maintainer can merge those branches.
First, do you have copyright assignment to the FSF or would you be willing
to? This is necessary to merge the patches. Please refer to,
http://orgmode.org/worg/org-contribute.html
Second, could you send your work as patches? I.e. use git format-patch.
Note the format of the commit message should be in the ChangeLog format
(refer to the link above).
Thanks,
Rasmus
--
History is what should never happen again
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-10 9:42 ` Rasmus
@ 2016-05-10 15:23 ` numbchild
2016-05-10 15:44 ` Rasmus
2016-05-22 17:20 ` Rasmus
0 siblings, 2 replies; 12+ messages in thread
From: numbchild @ 2016-05-10 15:23 UTC (permalink / raw)
To: Rasmus; +Cc: Org-mode
[-- Attachment #1.1: Type: text/plain, Size: 1291 bytes --]
I tried to sign the FSF copyright assignment before, but it is very
difficult for me. So I give up. Is there other ways to merge this patches
without signing the assignment? (I can give up this right)
Second: I updated branch commit messages in the ChangeLog format.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Tue, May 10, 2016 at 5:42 PM, Rasmus <rasmus@gmx.us> wrote:
> Hi,
>
> Thanks for your patches.
>
> Some comments follow.
>
> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > - ob-lua
> > - ob-php
> > - ob-redis
> >
> > https://github.com/stardiviner/org-mode
> >
> > Hope maintainer can merge those branches.
>
> First, do you have copyright assignment to the FSF or would you be willing
> to? This is necessary to merge the patches. Please refer to,
>
> http://orgmode.org/worg/org-contribute.html
>
> Second, could you send your work as patches? I.e. use git format-patch.
> Note the format of the commit message should be in the ChangeLog format
> (refer to the link above).
>
> Thanks,
> Rasmus
>
> --
> History is what should never happen again
>
>
>
[-- Attachment #1.2: Type: text/html, Size: 2529 bytes --]
[-- Attachment #2: 0001-ob-lua.el-add-Lua-src-block-executing-support.patch --]
[-- Type: text/x-patch, Size: 1734 bytes --]
From 2589d4e7d28016fb515d2131cbd9ff52797e50eb Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Tue, 10 May 2016 16:03:32 +0800
Subject: [PATCH] ob-lua.el: add Lua src block executing support
* contrib/lisp/ob-lua.el (org-babel-execute:lua): support executing Lua src block.
---
contrib/lisp/ob-lua.el | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 contrib/lisp/ob-lua.el
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
--
2.8.2
[-- Attachment #3: 0001-ob-php.el-Add-PHP-src-block-executing-support.patch --]
[-- Type: text/x-patch, Size: 1610 bytes --]
From d2e7202930fcf24e7c90826e69bb768094463a0c Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Tue, 10 May 2016 16:05:38 +0800
Subject: [PATCH] ob-php.el: Add PHP src block executing support
* contrib/lisp/ob-php.el (org-babel-execute:php): support executing PHP
src block.
---
contrib/lisp/ob-php.el | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 contrib/lisp/ob-php.el
diff --git a/contrib/lisp/ob-php.el b/contrib/lisp/ob-php.el
new file mode 100644
index 0000000..31960a5
--- /dev/null
+++ b/contrib/lisp/ob-php.el
@@ -0,0 +1,44 @@
+;;; 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)
+
+;; todo
+(defcustom ob-php:inf-php-buffer "*php*"
+ "Default PHP inferior buffer."
+ :group 'ob-php
+ :type 'string)
+
+;;;###autoload
+(defun org-babel-execute:php (body params)
+ "org-babel PHP hook."
+ ;; todo
+ (let* ((cmd (mapconcat 'identity (list "php") " -r ")))
+ (org-babel-eval cmd body)
+ ))
+
+;;;###autoload
+(eval-after-load "org"
+ '(add-to-list 'org-src-lang-modes '("php" . php)))
+
+(provide 'ob-php)
+
+;;; ob-php.el ends here
--
2.8.2
[-- Attachment #4: 0001-ob-redis.el-Add-Redis-src-block-executing-support.patch --]
[-- Type: text/x-patch, Size: 1746 bytes --]
From eb3c0cb1467416d141a633c49e1c9050311d92ab Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Tue, 10 May 2016 16:06:19 +0800
Subject: [PATCH] ob-redis.el: Add Redis src block executing support
* contrib/lisp/ob-redis.el (org-babel-execute:redis): support for
executing redis src block.
---
contrib/lisp/ob-redis.el | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 contrib/lisp/ob-redis.el
diff --git a/contrib/lisp/ob-redis.el b/contrib/lisp/ob-redis.el
new file mode 100644
index 0000000..340b050
--- /dev/null
+++ b/contrib/lisp/ob-redis.el
@@ -0,0 +1,44 @@
+;;; ob-redis.el --- Execute Redis queries within org-mode blocks.
+;; Copyright 2016 stardiviner
+
+;; Author: stardiviner <numbchild@gmail.com>
+;; Maintainer: stardiviner <numbchild@gmail.com>
+;; Keywords: org babel redis
+;; URL: https://github.com/stardiviner/ob-redis
+;; Created: 28th Feb 2016
+;; Version: 0.0.1
+;; Package-Requires: ((org "8"))
+
+;;; Commentary:
+;;
+;; Execute Redis queries within org-mode blocks.
+
+;;; Code:
+(require 'org)
+(require 'ob)
+
+(defgroup ob-redis nil
+ "org-mode blocks for Redis."
+ :group 'org)
+
+(defcustom ob-redis:default-db "127.0.0.1:6379"
+ "Default Redis database."
+ :group 'ob-redis
+ :type 'string)
+
+;;;###autoload
+(defun org-babel-execute:redis (body params)
+ "org-babel redis hook."
+ (let* ((db (or (cdr (assoc :db params))
+ ob-redis:default-db))
+ (cmd (mapconcat 'identity (list "redis-cli") " ")))
+ (org-babel-eval cmd body)
+ ))
+
+;;;###autoload
+(eval-after-load "org"
+ '(add-to-list 'org-src-lang-modes '("redis" . redis)))
+
+(provide 'ob-redis)
+
+;;; ob-redis.el ends here
--
2.8.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-10 15:23 ` numbchild
@ 2016-05-10 15:44 ` Rasmus
2016-05-10 15:47 ` Ken Mankoff
2016-05-11 1:42 ` numbchild
2016-05-22 17:20 ` Rasmus
1 sibling, 2 replies; 12+ messages in thread
From: Rasmus @ 2016-05-10 15:44 UTC (permalink / raw)
To: numbchild; +Cc: emacs-orgmode
"numbchild@gmail.com" <numbchild@gmail.com> writes:
> I tried to sign the FSF copyright assignment before, but it is very
> difficult for me. So I give up. Is there other ways to merge this patches
> without signing the assignment? (I can give up this right)
Normally you "only" need to sign a piece of paper and send it by snail
mail to the FSF office in the US of A. But you may be referring to the
terms of the assignment.
Depending on the issues you faced, it might be best to discuss them with
assign@gnu.org, who will have the legal knowledge to give you proper
advice.
Meanwhile, your files could be added to contrib, which does not require
you to do the paperwork. Contrib files are not part of Emacs and would
not come as part of the default Org package. To me, Contrib is more
convenient than MELPA, but I’m not sure everyone would agree.
> Second: I updated branch commit messages in the ChangeLog format.
Thanks.
Rasmus
--
However beautiful the theory, one should occasionally look at the evidence
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-10 15:44 ` Rasmus
@ 2016-05-10 15:47 ` Ken Mankoff
2016-05-10 15:58 ` Rasmus
2016-05-11 1:42 ` numbchild
1 sibling, 1 reply; 12+ messages in thread
From: Ken Mankoff @ 2016-05-10 15:47 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
On 2016-05-10 at 11:44, Rasmus <rasmus@gmx.us> wrote:
> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> Normally you "only" need to sign a piece of paper and send it by snail
> mail to the FSF office in the US of A.
It is easier than this - it can be done via email. Print sign and scan (photograph w/ phone), or don't even print and just sign digitally.
-k.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-10 15:47 ` Ken Mankoff
@ 2016-05-10 15:58 ` Rasmus
2016-05-10 16:12 ` Ken Mankoff
0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2016-05-10 15:58 UTC (permalink / raw)
To: emacs-orgmode
Ken Mankoff <mankoff@gmail.com> writes:
> On 2016-05-10 at 11:44, Rasmus <rasmus@gmx.us> wrote:
>> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>>
>> Normally you "only" need to sign a piece of paper and send it by snail
>> mail to the FSF office in the US of A.
>
> It is easier than this - it can be done via email. Print sign and scan
> (photograph w/ phone), or don't even print and just sign digitally.
Isn’t this only available to residents of the USA? Maybe not. It would
be cool if it’s generally available now.
Rasmus
--
And when I’m finished thinking, I have to die a lot
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-10 15:58 ` Rasmus
@ 2016-05-10 16:12 ` Ken Mankoff
0 siblings, 0 replies; 12+ messages in thread
From: Ken Mankoff @ 2016-05-10 16:12 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
On 2016-05-10 at 11:58, Rasmus <rasmus@gmx.us> wrote:
> Ken Mankoff <mankoff@gmail.com> writes:
>
>> On 2016-05-10 at 11:44, Rasmus <rasmus@gmx.us> wrote:
>>> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>>>
>>> Normally you "only" need to sign a piece of paper and send it by
>>> snail mail to the FSF office in the US of A.
>>
>> It is easier than this - it can be done via email. Print sign and
>> scan (photograph w/ phone), or don't even print and just sign
>> digitally.
>
> Isn’t this only available to residents of the USA? Maybe not. It would
> be cool if it’s generally available now.
Hm. I don't know. It didn't occur to me that the signature process was different based on where someone lives, but that may be the case.
-k.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-10 15:44 ` Rasmus
2016-05-10 15:47 ` Ken Mankoff
@ 2016-05-11 1:42 ` numbchild
1 sibling, 0 replies; 12+ messages in thread
From: numbchild @ 2016-05-11 1:42 UTC (permalink / raw)
To: Rasmus; +Cc: Org-mode
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
I moved files to contrib/lisp/. I live in China, hope FSF can assign the
copyright assignment digitally.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Tue, May 10, 2016 at 11:44 PM, Rasmus <rasmus@gmx.us> wrote:
> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > I tried to sign the FSF copyright assignment before, but it is very
> > difficult for me. So I give up. Is there other ways to merge this patches
> > without signing the assignment? (I can give up this right)
>
> Normally you "only" need to sign a piece of paper and send it by snail
> mail to the FSF office in the US of A. But you may be referring to the
> terms of the assignment.
>
> Depending on the issues you faced, it might be best to discuss them with
> assign@gnu.org, who will have the legal knowledge to give you proper
> advice.
>
> Meanwhile, your files could be added to contrib, which does not require
> you to do the paperwork. Contrib files are not part of Emacs and would
> not come as part of the default Org package. To me, Contrib is more
> convenient than MELPA, but I’m not sure everyone would agree.
>
> > Second: I updated branch commit messages in the ChangeLog format.
>
> Thanks.
>
> Rasmus
> --
> However beautiful the theory, one should occasionally look at the evidence
>
[-- Attachment #2: Type: text/html, Size: 2422 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-10 15:23 ` numbchild
2016-05-10 15:44 ` Rasmus
@ 2016-05-22 17:20 ` Rasmus
2016-05-23 3:09 ` numbchild
1 sibling, 1 reply; 12+ messages in thread
From: Rasmus @ 2016-05-22 17:20 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Thanks for your patches. Sorry about the delay. I was hoping that
someone with more ob knowledge would step in.
Please find some comments below. I think some more work is needed before
your libraries are
"numbchild@gmail.com" <numbchild@gmail.com> writes:
> From 2589d4e7d28016fb515d2131cbd9ff52797e50eb Mon Sep 17 00:00:00 2001
> From: stardiviner <numbchild@gmail.com>
> Date: Tue, 10 May 2016 16:03:32 +0800
> Subject: [PATCH] ob-lua.el: add Lua src block executing support
>
> * contrib/lisp/ob-lua.el (org-babel-execute:lua): support executing Lua
> src block.
Please capitalize after the colon.
> ---
> +;;; 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
For whatever reason this seems to be
;; Keywords: literate programming, reproducible research
In most ob files.
> +;; URL: https://github.com/stardiviner/ob-lua
> +;; Created: 12th April 2016
This header is unnecessary, but if you like it, it’s fine.
> +;; Version: 0.0.1
> +;; Package-Requires: ((org "8"))
> +;;; Commentary:
> +;;
> +;; Execute Lua code within org-mode blocks.
Maybe,
The file provides Org-Babel support for evaluating Lua code.
> +;;; Code:
> +(require 'org)
This is unnecessary. Ob implies Org.
> +(require 'ob)
> +
> +(defgroup ob-lua nil
> + "org-mode blocks for Lua."
> + :group 'org)
It seems that ob languages do not typically define new groups.
Also, ob is the filename. Variables are org-babel.
> +(defcustom ob-lua:default-session "*lua*"
> + "Default Lua session.
> +
> +It is lua inferior process from `run-lua'."
> + :group 'ob-lua
> + :type 'string)
I don’t think this is necessary to have as a defcustom. There’s already
:session. Also, you are missing :type. Per above, group is org-babel.
> +;;;###autoload
This is normally not autoloaded. Babel languages are loaded via
org-babel-do-load-languages.
> +(defun org-babel-execute:lua (body params)
> + "org-babel lua hook."
Please capitalize sentences.
> + (let* ((session (or (cdr (assoc :session params))
> + ob-lua:default-session))
> + (cmd (mapconcat 'identity (list "lua -") " ")))
Is something missing here? AFAIK cmd → "lua -" always.
Also, what if my lua is not in my PATH? I got a felling that you might
make a more robust mode by hooking into lua-mode
https://immerrr.github.io/lua-mode/
> + (org-babel-eval cmd body)))
How are various return values handled? E.g. will a table be correctly
interpreted as such? (It’s a while since I coded in lua).
> +;;;###Autoload
> +(eval-after-load "org"
> + '(add-to-list 'org-src-lang-modes '("lua" . lua)))
This should be unnecessary as the lua-mode is presumably lua-mode. Also,
I think your code depends on lua-mode in order to be able to edit it. You
need to declare that as a dependency.
> +(provide 'ob-lua)
> +
> +;;; ob-lua.el ends here
> --
> 2.8.2
>
>
> From d2e7202930fcf24e7c90826e69bb768094463a0c Mon Sep 17 00:00:00 2001
> From: stardiviner <numbchild@gmail.com>
> Date: Tue, 10 May 2016 16:05:38 +0800
> Subject: [PATCH] ob-php.el: Add PHP src block executing support
>
> * contrib/lisp/ob-php.el (org-babel-execute:php): support executing PHP
> src block.
Capitalize.
> ---
> contrib/lisp/ob-php.el | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
> create mode 100644 contrib/lisp/ob-php.el
>
> diff --git a/contrib/lisp/ob-php.el b/contrib/lisp/ob-php.el
> new file mode 100644
> index 0000000..31960a5
> --- /dev/null
> +++ b/contrib/lisp/ob-php.el
> @@ -0,0 +1,44 @@
> +;;; 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)
See comments above.
> +;; Todo
Remove.
> +(defcustom ob-php:inf-php-buffer "*php*"
> + "Default PHP inferior buffer."
> + :group 'ob-php
> + :type 'string)
:Type is missing and this buffer should not be a defcustom.
> +;;;###Autoload
Remove.
> +(defun org-babel-execute:php (body params)
> + "org-babel PHP hook."
> + ;; Todo
Remove.
> + (let* ((cmd (mapconcat 'identity (list "php") " -r ")))
> + (org-babel-eval cmd body)
> + ))
See comments above re docstring, and robustness.
What sort of return values can I expect from this? I don’t know php, but
I assume it’s mainly "log messages".
> +;;;###autoload
> +(eval-after-load "org"
> + '(add-to-list 'org-src-lang-modes '("php" . php)))
Unnecessary. Also, it seems there’s an undeclared decency on some sort of
php mode.
> +
> +(provide 'ob-php)
> From eb3c0cb1467416d141a633c49e1c9050311d92ab Mon Sep 17 00:00:00 2001
> From: stardiviner <numbchild@gmail.com>
> Date: Tue, 10 May 2016 16:06:19 +0800
> Subject: [PATCH] ob-redis.el: Add Redis src block executing support
>
> * contrib/lisp/ob-redis.el (org-babel-execute:redis): support for
> executing redis src block.
Capitalize
> ---
> contrib/lisp/ob-redis.el | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
> create mode 100644 contrib/lisp/ob-redis.el
>
> diff --git a/contrib/lisp/ob-redis.el b/contrib/lisp/ob-redis.el
> new file mode 100644
> index 0000000..340b050
> --- /dev/null
> +++ b/contrib/lisp/ob-redis.el
> @@ -0,0 +1,44 @@
> +;;; ob-redis.el --- Execute Redis queries within org-mode blocks.
> +;; Copyright 2016 stardiviner
> +
> +;; Author: stardiviner <numbchild@gmail.com>
> +;; Maintainer: stardiviner <numbchild@gmail.com>
> +;; Keywords: org babel redis
> +;; URL: https://github.com/stardiviner/ob-redis
> +;; Created: 28th Feb 2016
> +;; Version: 0.0.1
> +;; Package-Requires: ((org "8"))
> +
> +;;; Commentary:
> +;;
> +;; Execute Redis queries within org-mode blocks.
> +
> +;;; Code:
> +(require 'org)
> +(require 'ob)
> +
> +(defgroup ob-redis nil
> + "org-mode blocks for Redis."
> + :group 'org)
As above.
> +(defcustom ob-redis:default-db "127.0.0.1:6379"
> + "Default Redis database."
> + :group 'ob-redis
> + :type 'string)
Does redis support login and different ports and all that jazz?
If so, please compare the configurability to the needs of ob-sql.
Is it possible to extend ob-sql with another engine? (I don’t know
anything about redis).
Or are these "NoSQL" databases similar enough that it would be possible to
have "unite" them in a single library. Does ob have support for any
"NoSQL" databases ATM?
I’m not implying that this is necessarily the right way to go. I’m just
trying to understand the nature of this.
> +;;;###Autoload
Remove.
> +(defun org-babel-execute:redis (body params)
> + "org-babel redis hook."
> + (let* ((db (or (cdr (assoc :db params))
> + ob-redis:default-db))
> + (cmd (mapconcat 'identity (list "redis-cli") " ")))
> + (org-babel-eval cmd body)
> + ))
My guess is that connectivity support is not comprehensive enough.
> +;;;###autoload
> +(eval-after-load "org"
> + '(add-to-list 'org-src-lang-modes '("redis" . redis)))
Remove.
> +(provide 'ob-redis)
> +
> +;;; ob-redis.el ends here
Thanks,
Rasmus
--
Vote for proprietary math!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-22 17:20 ` Rasmus
@ 2016-05-23 3:09 ` numbchild
2016-05-27 16:52 ` Rasmus
0 siblings, 1 reply; 12+ messages in thread
From: numbchild @ 2016-05-23 3:09 UTC (permalink / raw)
To: Rasmus; +Cc: Org-mode
[-- Attachment #1: Type: text/plain, Size: 9274 bytes --]
I modified most part of my files.
- There are some places I can't improve because I'm not good at elisp.
(maybe other people can improve it later) Like ob-redis.el implement
ob-sql style configuration. and ob-lua.el make use of lua-mode's running
process.
- I guess ob-php.el is the only one branch can be merged.
- Anyway, check out my updates, if no one can be merged, I will still keep
my github repositories.
Thanks for your detail reviews.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Mon, May 23, 2016 at 1:20 AM, Rasmus <rasmus@gmx.us> wrote:
> Hi,
>
> Thanks for your patches. Sorry about the delay. I was hoping that
> someone with more ob knowledge would step in.
>
> Please find some comments below. I think some more work is needed before
> your libraries are
>
> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > From 2589d4e7d28016fb515d2131cbd9ff52797e50eb Mon Sep 17 00:00:00 2001
> > From: stardiviner <numbchild@gmail.com>
> > Date: Tue, 10 May 2016 16:03:32 +0800
> > Subject: [PATCH] ob-lua.el: add Lua src block executing support
> >
> > * contrib/lisp/ob-lua.el (org-babel-execute:lua): support executing Lua
> > src block.
>
> Please capitalize after the colon.
>
> > ---
> > +;;; 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
>
> For whatever reason this seems to be
>
> ;; Keywords: literate programming, reproducible research
>
> In most ob files.
>
> > +;; URL: https://github.com/stardiviner/ob-lua
>
>
> > +;; Created: 12th April 2016
>
> This header is unnecessary, but if you like it, it’s fine.
>
> > +;; Version: 0.0.1
> > +;; Package-Requires: ((org "8"))
>
> > +;;; Commentary:
> > +;;
> > +;; Execute Lua code within org-mode blocks.
>
>
> Maybe,
>
> The file provides Org-Babel support for evaluating Lua code.
>
>
>
> > +;;; Code:
> > +(require 'org)
>
> This is unnecessary. Ob implies Org.
>
> > +(require 'ob)
> > +
> > +(defgroup ob-lua nil
> > + "org-mode blocks for Lua."
> > + :group 'org)
>
> It seems that ob languages do not typically define new groups.
>
> Also, ob is the filename. Variables are org-babel.
>
> > +(defcustom ob-lua:default-session "*lua*"
> > + "Default Lua session.
> > +
> > +It is lua inferior process from `run-lua'."
> > + :group 'ob-lua
> > + :type 'string)
>
> I don’t think this is necessary to have as a defcustom. There’s already
> :session. Also, you are missing :type. Per above, group is org-babel.
>
> > +;;;###autoload
> This is normally not autoloaded. Babel languages are loaded via
> org-babel-do-load-languages.
>
> > +(defun org-babel-execute:lua (body params)
> > + "org-babel lua hook."
>
> Please capitalize sentences.
>
> > + (let* ((session (or (cdr (assoc :session params))
> > + ob-lua:default-session))
> > + (cmd (mapconcat 'identity (list "lua -") " ")))
>
> Is something missing here? AFAIK cmd → "lua -" always.
>
> Also, what if my lua is not in my PATH? I got a felling that you might
> make a more robust mode by hooking into lua-mode
>
> https://immerrr.github.io/lua-mode/
>
> > + (org-babel-eval cmd body)))
>
> How are various return values handled? E.g. will a table be correctly
> interpreted as such? (It’s a while since I coded in lua).
>
> > +;;;###Autoload
> > +(eval-after-load "org"
> > + '(add-to-list 'org-src-lang-modes '("lua" . lua)))
>
>
> This should be unnecessary as the lua-mode is presumably lua-mode. Also,
> I think your code depends on lua-mode in order to be able to edit it. You
> need to declare that as a dependency.
>
> > +(provide 'ob-lua)
> > +
> > +;;; ob-lua.el ends here
> > --
> > 2.8.2
> >
> >
> > From d2e7202930fcf24e7c90826e69bb768094463a0c Mon Sep 17 00:00:00 2001
> > From: stardiviner <numbchild@gmail.com>
> > Date: Tue, 10 May 2016 16:05:38 +0800
> > Subject: [PATCH] ob-php.el: Add PHP src block executing support
> >
> > * contrib/lisp/ob-php.el (org-babel-execute:php): support executing PHP
> > src block.
>
> Capitalize.
>
> > ---
> > contrib/lisp/ob-php.el | 44 ++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 44 insertions(+)
> > create mode 100644 contrib/lisp/ob-php.el
> >
> > diff --git a/contrib/lisp/ob-php.el b/contrib/lisp/ob-php.el
> > new file mode 100644
> > index 0000000..31960a5
> > --- /dev/null
> > +++ b/contrib/lisp/ob-php.el
> > @@ -0,0 +1,44 @@
> > +;;; 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)
>
>
> See comments above.
>
> > +;; Todo
>
> Remove.
>
> > +(defcustom ob-php:inf-php-buffer "*php*"
> > + "Default PHP inferior buffer."
> > + :group 'ob-php
> > + :type 'string)
>
> :Type is missing and this buffer should not be a defcustom.
>
> > +;;;###Autoload
>
> Remove.
>
> > +(defun org-babel-execute:php (body params)
> > + "org-babel PHP hook."
> > + ;; Todo
>
> Remove.
>
> > + (let* ((cmd (mapconcat 'identity (list "php") " -r ")))
> > + (org-babel-eval cmd body)
> > + ))
>
> See comments above re docstring, and robustness.
>
> What sort of return values can I expect from this? I don’t know php, but
> I assume it’s mainly "log messages".
>
> > +;;;###autoload
> > +(eval-after-load "org"
> > + '(add-to-list 'org-src-lang-modes '("php" . php)))
>
> Unnecessary. Also, it seems there’s an undeclared decency on some sort of
> php mode.
>
> > +
> > +(provide 'ob-php)
>
> > From eb3c0cb1467416d141a633c49e1c9050311d92ab Mon Sep 17 00:00:00 2001
> > From: stardiviner <numbchild@gmail.com>
> > Date: Tue, 10 May 2016 16:06:19 +0800
> > Subject: [PATCH] ob-redis.el: Add Redis src block executing support
> >
> > * contrib/lisp/ob-redis.el (org-babel-execute:redis): support for
> > executing redis src block.
>
> Capitalize
>
>
> > ---
> > contrib/lisp/ob-redis.el | 44
> ++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 44 insertions(+)
> > create mode 100644 contrib/lisp/ob-redis.el
> >
> > diff --git a/contrib/lisp/ob-redis.el b/contrib/lisp/ob-redis.el
> > new file mode 100644
> > index 0000000..340b050
> > --- /dev/null
> > +++ b/contrib/lisp/ob-redis.el
> > @@ -0,0 +1,44 @@
> > +;;; ob-redis.el --- Execute Redis queries within org-mode blocks.
> > +;; Copyright 2016 stardiviner
> > +
> > +;; Author: stardiviner <numbchild@gmail.com>
> > +;; Maintainer: stardiviner <numbchild@gmail.com>
> > +;; Keywords: org babel redis
> > +;; URL: https://github.com/stardiviner/ob-redis
> > +;; Created: 28th Feb 2016
> > +;; Version: 0.0.1
> > +;; Package-Requires: ((org "8"))
> > +
> > +;;; Commentary:
> > +;;
> > +;; Execute Redis queries within org-mode blocks.
> > +
> > +;;; Code:
> > +(require 'org)
> > +(require 'ob)
> > +
> > +(defgroup ob-redis nil
> > + "org-mode blocks for Redis."
> > + :group 'org)
>
> As above.
>
> > +(defcustom ob-redis:default-db "127.0.0.1:6379"
> > + "Default Redis database."
> > + :group 'ob-redis
> > + :type 'string)
>
> Does redis support login and different ports and all that jazz?
> If so, please compare the configurability to the needs of ob-sql.
>
> Is it possible to extend ob-sql with another engine? (I don’t know
> anything about redis).
>
> Or are these "NoSQL" databases similar enough that it would be possible to
> have "unite" them in a single library. Does ob have support for any
> "NoSQL" databases ATM?
>
> I’m not implying that this is necessarily the right way to go. I’m just
> trying to understand the nature of this.
>
> > +;;;###Autoload
>
> Remove.
>
> > +(defun org-babel-execute:redis (body params)
> > + "org-babel redis hook."
> > + (let* ((db (or (cdr (assoc :db params))
> > + ob-redis:default-db))
> > + (cmd (mapconcat 'identity (list "redis-cli") " ")))
> > + (org-babel-eval cmd body)
> > + ))
>
>
> My guess is that connectivity support is not comprehensive enough.
>
> > +;;;###autoload
> > +(eval-after-load "org"
> > + '(add-to-list 'org-src-lang-modes '("redis" . redis)))
>
> Remove.
>
> > +(provide 'ob-redis)
> > +
> > +;;; ob-redis.el ends here
>
> Thanks,
> Rasmus
>
> --
> Vote for proprietary math!
>
>
>
>
[-- Attachment #2: Type: text/html, Size: 13214 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-23 3:09 ` numbchild
@ 2016-05-27 16:52 ` Rasmus
2016-05-28 0:50 ` numbchild
0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2016-05-27 16:52 UTC (permalink / raw)
To: emacs-orgmode
Hi,
"numbchild@gmail.com" <numbchild@gmail.com> writes:
> I modified most part of my files.
Thanks.
> - There are some places I can't improve because I'm not good at elisp.
> (maybe other people can improve it later) Like ob-redis.el implement
> ob-sql style configuration. and ob-lua.el make use of lua-mode's running
> process.
OK.
> - I guess ob-php.el is the only one branch can be merged.
Maybe we should wait until it is a bit less bare-bone or there’s a
copyright assignment in place.
BTW there’s also this ob-php,
https://github.com/steckerhalter/ob-php
> - Anyway, check out my updates, if no one can be merged, I will still keep
> my github repositories.
Note that there was already one ob-lua.el that was never commiteed for
some reason...
https://lists.gnu.org/archive/html/emacs-orgmode/2014-05/msg01149.html
Rasmus
--
Slowly unravels in a ball of yarn and the devil collects it
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: add some babel supports (PHP, Lua, Redis)
2016-05-27 16:52 ` Rasmus
@ 2016-05-28 0:50 ` numbchild
0 siblings, 0 replies; 12+ messages in thread
From: numbchild @ 2016-05-28 0:50 UTC (permalink / raw)
To: Rasmus; +Cc: Org-mode
[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]
I see, I will check out them, and merge them if possible.
I will PR after they are good enough.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Sat, May 28, 2016 at 12:52 AM, Rasmus <rasmus@gmx.us> wrote:
> Hi,
>
>
> "numbchild@gmail.com" <numbchild@gmail.com> writes:
>
> > I modified most part of my files.
>
> Thanks.
>
> > - There are some places I can't improve because I'm not good at elisp.
> > (maybe other people can improve it later) Like ob-redis.el implement
> > ob-sql style configuration. and ob-lua.el make use of lua-mode's running
> > process.
>
> OK.
>
> > - I guess ob-php.el is the only one branch can be merged.
>
> Maybe we should wait until it is a bit less bare-bone or there’s a
> copyright assignment in place.
>
> BTW there’s also this ob-php,
>
> https://github.com/steckerhalter/ob-php
>
> > - Anyway, check out my updates, if no one can be merged, I will still
> keep
> > my github repositories.
>
> Note that there was already one ob-lua.el that was never commiteed for
> some reason...
>
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2014-05/msg01149.html
>
> Rasmus
>
> --
> Slowly unravels in a ball of yarn and the devil collects it
>
>
>
[-- Attachment #2: Type: text/html, Size: 2721 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-05-28 0:50 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-10 8:07 add some babel supports (PHP, Lua, Redis) numbchild
2016-05-10 9:42 ` Rasmus
2016-05-10 15:23 ` numbchild
2016-05-10 15:44 ` Rasmus
2016-05-10 15:47 ` Ken Mankoff
2016-05-10 15:58 ` Rasmus
2016-05-10 16:12 ` Ken Mankoff
2016-05-11 1:42 ` numbchild
2016-05-22 17:20 ` Rasmus
2016-05-23 3:09 ` numbchild
2016-05-27 16:52 ` Rasmus
2016-05-28 0:50 ` numbchild
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).