Skip to content

Commit

Permalink
move org essentials to spacemacs distro
Browse files Browse the repository at this point in the history
  • Loading branch information
d12frosted committed Mar 5, 2016
1 parent 39a3c19 commit 6e5ba72
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 67 deletions.
3 changes: 2 additions & 1 deletion layers/+distribution/spacemacs/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
spacemacs-evil
spacemacs-language
spacemacs-ui
spacemacs-ui-visual))
spacemacs-ui-visual
spacemacs-org))
;; If the user has not explicitly declared spacemacs-helm or spacemacs-ivy and
;; they are using the standard distribution, assume they want helm completion.
(unless (or (configuration-layer/layer-usedp 'spacemacs-ivy)
Expand Down
96 changes: 96 additions & 0 deletions layers/+spacemacs/spacemacs-org/packages.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
;;; packages.el --- spacemacs-org layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Boris Buliga <d12frosted@d12frosted.local>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

;;; Commentary:

;;; Code:

(defconst spacemacs-org-packages
'(
(evil-org :location local)
flyspell
;; org is installed by `org-plus-contrib'
(org :location built-in)
(org-plus-contrib :step pre)
org-bullets
toc-org
))

(defun spacemacs-org/init-evil-org ()
(use-package evil-org
:commands evil-org-mode
:init
(add-hook 'org-mode-hook 'evil-org-mode)
:config
(progn
(evil-define-key 'normal evil-org-mode-map
"O" 'evil-open-above)
(spacemacs|diminish evil-org-mode "" " e"))))

(defun spacemacs-org/post-init-flyspell ()
(spell-checking/add-flyspell-hook 'org-mode-hook))

;; dummy init function to force installation of `org-plus-contrib'
(defun spacemacs-org/post-init-org-plus-contrib ())

(defun spacemacs-org/init-org ()
(use-package org
:mode ("\\.org$" . org-mode)
:commands (org-clock-out org-occur-in-agenda-files org-agenda-files)
:defer t
:init
(progn
;; FIXME: This check has been disabled pending a resolution of
;; https://github.com/syl20bnr/spacemacs/issues/3933
;; (when (featurep 'org)
;; (configuration-layer//set-error)
;; (spacemacs-buffer/append
;; (concat
;; "Org features were loaded before the `org' layer initialized.\n"
;; "Try removing org code from user initialization and private layers.") t))

(setq org-startup-with-inline-images t
org-src-fontify-natively t
;; this is consistent with the value of
;; `helm-org-headings-max-depth'.
org-imenu-depth 8)

(with-eval-after-load 'org-indent
(spacemacs|hide-lighter org-indent-mode))

;; Add global evil-leader mappings. Used to access org-agenda
;; functionalities – and a few others commands – from any other mode.
(spacemacs/declare-prefix "ao" "org")
:config
(progn
(font-lock-add-keywords
'org-mode '(("\\(@@html:<kbd>@@\\) \\(.*\\) \\(@@html:</kbd>@@\\)"
(1 font-lock-comment-face prepend)
(2 font-lock-function-name-face)
(3 font-lock-comment-face prepend))))

;; Open links and files with RET in normal state
(evil-define-key 'normal org-mode-map (kbd "RET") 'org-open-at-point)))))

(defun spacemacs-org/init-org-bullets ()
(use-package org-bullets
:defer t
:init (add-hook 'org-mode-hook 'org-bullets-mode)))

(defun spacemacs-org/init-toc-org ()
(use-package toc-org
:defer t
:init
(progn
(setq toc-org-max-depth 10)
(add-hook 'org-mode-hook 'toc-org-enable))))

;;; packages.el ends here
80 changes: 14 additions & 66 deletions layers/org/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,22 @@
company
company-emoji
emoji-cheat-sheet-plus
(evil-org :location local)
evil-org
evil-surround
flyspell
gnuplot
htmlize
mu4e
;; org and org-agenda are installed by `org-plus-contrib'
(org :location built-in)
(org-agenda :location built-in)
(org-plus-contrib :step pre)
org-bullets
;; org-mime is installed by `org-plus-contrib'
(org-mime :location built-in)
org-pomodoro
org-present
org-repo-todo
(ox-gfm :location local)
persp-mode
toc-org
))

(when (configuration-layer/layer-usedp 'auto-completion)
Expand All @@ -45,18 +42,13 @@
(defun org/post-init-emoji-cheat-sheet-plus ()
(add-hook 'org-mode-hook 'spacemacs/delay-emoji-cheat-sheet-hook))

(defun org/init-evil-org ()
(defun org/post-init-evil-org ()
(use-package evil-org
:commands evil-org-mode
:init
(add-hook 'org-mode-hook 'evil-org-mode)
:defer t
:config
(progn
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"C" 'evil-org-recompute-clocks)
(evil-define-key 'normal evil-org-mode-map
"O" 'evil-open-above)
(spacemacs|diminish evil-org-mode "" " e"))))
"C" 'evil-org-recompute-clocks))))

(defun org/post-init-evil-surround ()
(defun spacemacs/add-org-surrounds ()
Expand All @@ -66,9 +58,6 @@
(let ((dname (read-from-minibuffer "" "")))
(cons (format ":%s:\n" (or dname "")) "\n:END:"))))

(defun org/post-init-flyspell ()
(spell-checking/add-flyspell-hook 'org-mode-hook))

(defun org/init-gnuplot ()
(use-package gnuplot
:defer t
Expand All @@ -81,43 +70,17 @@
:post-config (require 'org-mu4e nil 'noerror)))

;; dummy init function to force installation of `org-plus-contrib'
(defun org/init-org-plus-contrib ())
(defun org/post-init-org-plus-contrib ())

(defun org/init-org ()
(defun org/post-init-org ()
(use-package org
:mode ("\\.org$" . org-mode)
:commands (org-clock-out org-occur-in-agenda-files org-agenda-files)
:defer t
:init
(progn
;; FIXME: This check has been disabled pending a resolution of
;; https://github.com/syl20bnr/spacemacs/issues/3933
;; (when (featurep 'org)
;; (configuration-layer//set-error)
;; (spacemacs-buffer/append
;; (concat
;; "Org features were loaded before the `org' layer initialized.\n"
;; "Try removing org code from user initialization and private layers.") t))

(setq org-clock-persist-file
(concat spacemacs-cache-directory "org-clock-save.el")
org-id-locations-file
(concat spacemacs-cache-directory ".org-id-locations")
org-log-done t
org-startup-with-inline-images t
org-src-fontify-natively t
;; this is consistent with the value of
;; `helm-org-headings-max-depth'.
org-imenu-depth 8)

(with-eval-after-load 'org-indent
(spacemacs|hide-lighter org-indent-mode))
(let ((dir (configuration-layer/get-layer-property 'org :dir)))
(setq org-export-async-init-file (concat dir "org-async-init.el")))
(defmacro spacemacs|org-emphasize (fname char)
"Make function for setting the emphasis in org mode"
`(defun ,fname () (interactive)
(org-emphasize ,char)))
org-log-done t)

;; Follow the confirm and abort conventions
(with-eval-after-load 'org-capture
Expand All @@ -135,6 +98,13 @@
"a" 'org-edit-src-abort
"k" 'org-edit-src-abort))

(let ((dir (configuration-layer/get-layer-property 'org :dir)))
(setq org-export-async-init-file (concat dir "org-async-init.el")))
(defmacro spacemacs|org-emphasize (fname char)
"Make function for setting the emphasis in org mode"
`(defun ,fname () (interactive)
(org-emphasize ,char)))

;; Insert key for org-mode and markdown a la C-h k
;; from SE endless http://emacs.stackexchange.com/questions/2206/i-want-to-have-the-kbd-tags-for-my-blog-written-in-org-mode/2208#2208
(defun spacemacs/insert-keybinding-org (key)
Expand Down Expand Up @@ -250,7 +220,6 @@ Will work on both org-mode and any mode that accepts plain html."

;; Add global evil-leader mappings. Used to access org-agenda
;; functionalities – and a few others commands – from any other mode.
(spacemacs/declare-prefix "ao" "org")
(spacemacs/set-leader-keys
;; org-agenda
"ao#" 'org-agenda-list-stuck-projects
Expand All @@ -272,14 +241,6 @@ Will work on both org-mode and any mode that accepts plain html."
:config
(progn
(setq org-default-notes-file "notes.org")
(font-lock-add-keywords
'org-mode '(("\\(@@html:<kbd>@@\\) \\(.*\\) \\(@@html:</kbd>@@\\)"
(1 font-lock-comment-face prepend)
(2 font-lock-function-name-face)
(3 font-lock-comment-face prepend))))

;; Open links and files with RET in normal state
(evil-define-key 'normal org-mode-map (kbd "RET") 'org-open-at-point)

;; We add this key mapping because an Emacs user can change
;; `dotspacemacs-major-mode-emacs-leader-key' to `C-c' and the key binding
Expand Down Expand Up @@ -420,11 +381,6 @@ Headline^^ Visit entry^^ Filter^^ Da
(kbd "M-SPC") 'spacemacs/org-agenda-transient-state/body
(kbd "s-M-SPC") 'spacemacs/org-agenda-transient-state/body)))

(defun org/init-org-bullets ()
(use-package org-bullets
:defer t
:init (add-hook 'org-mode-hook 'org-bullets-mode)))

(defun org/init-org-mime ()
(use-package org-mime
:defer t
Expand Down Expand Up @@ -533,14 +489,6 @@ a Markdown buffer and use this command to convert it.
:body
(find-file (first (org-agenda-files)))))

(defun org/init-toc-org ()
(use-package toc-org
:defer t
:init
(progn
(setq toc-org-max-depth 10)
(add-hook 'org-mode-hook 'toc-org-enable))))

(defun org/init-htmlize ()
(use-package htmlize
:defer t))

0 comments on commit 6e5ba72

Please sign in to comment.