about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-org.el
blob: 7a3715d0d3b25d9b38b8e131b4cd39c54cebc1dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
;;; init-org.el --- Org-Mode Configuration File -*- lexical-binding: t -*-
;;; Commentary:
;; Some parts copied from prelude-org.el
;;; Code:

(use-package org
  :ensure nil
  :defer t
  :init
  ;; TODO - can we do this with sp-wrap-with-pair?
  (defmacro define-org-wrap (name char)
    (let ((cmd (intern (concat "org-" name))))
      `(defun ,cmd
           ()
         (interactive)
         (if (use-region-p)
             (let ((re (region-end))
                   (rb (region-beginning)))
               (goto-char re)
               (insert ,char)
               (goto-char rb)
               (insert ,char))
           (beginning-of-thing 'symbol)
           (insert ,char)
           (end-of-thing 'symbol)
           (insert ,char)))
      `(bind-key ,(concat "C-c " (char-to-string char)) ',cmd org-mode-map)))
  :custom
  (org-log-done t)
  (org-special-ctrl-k t)
  (org-special-ctrl-a t)
  :config
  (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
  (define-org-wrap "underline" ?_)
  (define-org-wrap "bold" ?*)
  (define-org-wrap "italic" ?/)
  (define-org-wrap "verbatim" ?=)
  (define-org-wrap "code" ?~)
  (define-org-wrap "strike-through" ?+)
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((shell . t)
     (elasticsearch . t)
     (clojure . t)
     (restclient . t)
     (verb . t)
     (sql . t)))
  :bind
  ("C-c l" . org-store-link)
  ("C-c a" . org-agenda)
  ("C-c b" . org-switchb)
  ;; TODO bindings
  ;("C-c r" . org-refile)
  ;("C-c c" . org-capture)
  )

(use-package ob-restclient
  :after org
  :defer t)

(use-package ob-async
  :after org
  :defer t)

(provide 'init-org)
;;; init-org.el ends here