diff options
author | stardiviner <numbchild@gmail.com> | 2018-02-10 08:17:36 +0800 |
---|---|---|
committer | stardiviner <numbchild@gmail.com> | 2018-02-10 08:17:36 +0800 |
commit | f643a75bd13c9c8d04452512b0452489a999c112 (patch) | |
tree | 0223726c6f0d670a81d12c362fe38b2545f6a5b0 | |
parent | 8a58a9fd46485b7f27f006af306b792baa887776 (diff) | |
download | org-mode-f643a75bd13c9c8d04452512b0452489a999c112.tar.gz |
* ob-redis.el (supporting Redis in Org-mode Babel): Add.
First version.
-rw-r--r-- | contrib/lisp/ob-redis.el | 44 |
1 files changed, 44 insertions, 0 deletions
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 |