Fix org recursive loading issue.
[ob-redis.git] / ob-redis.el
blob9a462756285825145ad8a4afa981c38cf4f52e04
1 ;;; ob-redis.el --- Execute Redis queries within org-mode blocks.
2 ;; Copyright 2016 stardiviner
4 ;; Author: stardiviner <numbchild@gmail.com>
5 ;; Maintainer: stardiviner <numbchild@gmail.com>
6 ;; Keywords: org babel redis
7 ;; URL: https://repo.or.cz/ob-redis.git
8 ;; Created: 28th Feb 2016
9 ;; Version: 0.0.1
10 ;; Package-Requires: ((org "8"))
12 ;;; Commentary:
14 ;; Execute Redis queries within org-mode blocks.
16 ;;; Code:
17 (require 'ob)
19 (defgroup ob-redis nil
20 "org-mode blocks for Redis."
21 :group 'org)
23 (defcustom ob-redis:default-db "127.0.0.1:6379"
24 "Default Redis database."
25 :group 'ob-redis
26 :type 'string)
28 ;;;###autoload
29 (defun org-babel-execute:redis (body params)
30 "org-babel redis hook."
31 (let* ((db (or (cdr (assoc :db params))
32 ob-redis:default-db))
33 (cmd (mapconcat 'identity (list "redis-cli") " ")))
34 (org-babel-eval cmd body)
37 ;;;###autoload
38 (eval-after-load 'org
39 '(add-to-list 'org-src-lang-modes '("redis" . redis)))
41 (provide 'ob-redis)
43 ;;; ob-redis.el ends here