lisp/org-table.el: fix table alignment
[org-mode/org-tableheadings.git] / contrib / lisp / ob-redis.el
blob340b0502994d123614065636ee52905af1e3bee5
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://github.com/stardiviner/ob-redis
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 'org)
18 (require 'ob)
20 (defgroup ob-redis nil
21 "org-mode blocks for Redis."
22 :group 'org)
24 (defcustom ob-redis:default-db "127.0.0.1:6379"
25 "Default Redis database."
26 :group 'ob-redis
27 :type 'string)
29 ;;;###autoload
30 (defun org-babel-execute:redis (body params)
31 "org-babel redis hook."
32 (let* ((db (or (cdr (assoc :db params))
33 ob-redis:default-db))
34 (cmd (mapconcat 'identity (list "redis-cli") " ")))
35 (org-babel-eval cmd body)
38 ;;;###autoload
39 (eval-after-load "org"
40 '(add-to-list 'org-src-lang-modes '("redis" . redis)))
42 (provide 'ob-redis)
44 ;;; ob-redis.el ends here