Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move org essentials to spacemacs distro #5372

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
53 changes: 13 additions & 40 deletions layers/+emacs/org/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
company
company-emoji
emoji-cheat-sheet-plus
(evil-org :location local)
evil-org
evil-surround
flyspell
gnuplot
htmlize
mu4e
Expand All @@ -25,7 +24,6 @@
(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
Expand All @@ -47,18 +45,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 @@ -68,9 +61,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 @@ -83,7 +73,7 @@
: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-ob ()
(use-package ob
Expand All @@ -96,11 +86,8 @@
org-babel-load-languages))
(add-hook 'org-mode-hook 'spacemacs//org-babel-do-load-languages))))

(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
Expand Down Expand Up @@ -150,6 +137,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 @@ -287,14 +281,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 @@ -444,11 +430,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 @@ -557,14 +538,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))
Expand Down
89 changes: 89 additions & 0 deletions layers/+spacemacs/spacemacs-org/packages.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
;;; 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)
: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