emacs/layers.personal/orgtools/packages.el
2018-04-07 10:54:04 +08:00

170 lines
5.3 KiB
EmacsLisp

;;; packages.el --- orgtools layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Rongsong Shen <rshen@pc13x.cn.ibm.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Commentary:
;; See the Spacemacs documentation and FAQs for instructions on how to implement
;; a new layer:
;;
;; SPC h SPC layers RET
;;
;;
;; Briefly, each package to be installed or configured by this layer should be
;; added to `orgtools-packages'. Then, for each package PACKAGE:
;;
;; - If PACKAGE is not referenced by any other Spacemacs layer, define a
;; function `orgtools/init-PACKAGE'mythemes to load and initialize the package.
;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so
;; define the functions `orgtools/pre-init-PACKAGE' and/or
;; `orgtools/post-init-PACKAGE' to customize the package as it is loaded.
;;; Code:
(defconst orgtools-packages
'((org-templates :location local)
(org-lsf-theme :location local)
(org-tufte-theme :location local)
(ob-tikz :location local)
(ob-metapost :location local)
(ob-mermaid :location local)
(ox-epub :location (recipe :fetcher github :repo "ofosos/org-epub"))
(ox-tufte :location (recipe :fetcher github :repo "dakrone/ox-tufte"))
(ox-ravel :location local)
cdlatex)
"The list of Lisp packages required by the orgtools layer.
Each entry is either:
1. A symbol, which is interpreted as a package to be installed, or
2. A list of the form (PACKAGE KEYS...), where PACKAGE is the
name of the package to be installed or loaded, and KEYS are
any number of keyword-value-pairs.
The following keys are accepted:
- :excluded (t or nil): Prevent the package from being loaded
if value is non-nil
- :location: Specify a custom installation location.
The following values are legal:
- The symbol `elpa' (default) means PACKAGE will be
installed using the Emacs package manager.
- The symbol `local' dilibrary(animation)
rects Spacemacs to load the file at
`./local/PACKAGE/PACKAGE.el'
- A list beginning with the symbol `recipe' is a melpa
recipe. See: https://github.com/milkypostman/melpa#recipe-format")
(defun orgtools/init-org-templates ()
(use-package org-templates
:defer t
:if (configuration-layer/package-usedp 'org)
:commands org-use-template))
(defun orgtools/init-org-lsf-theme ()
(use-package org-lsf-theme
:defer t
:if (configuration-layer/package-usedp 'org)
:commands org-lsf-theme-latex-template
:init (progn
(orgtools-register-theme "mythemes"
#'org-lsf-theme-latex-template))))
(defun orgtools/init-org-tufte-theme ()
(use-package org-tufte-theme
:defer t
:if (configuration-layer/package-usedp 'org)
:commands (org-tufte-theme-latex-template org-tufte-register-classes)
:init (progn
(add-hook 'org-mode-hook #'org-tufte-register-classes)
(orgtools-register-theme "tufte-handout"
#'org-tufte-theme-latex-template)
(orgtools-register-theme "tufte-book"
#'org-tufte-theme-latex-template))))
(defun orgtools/init-ob-tikz ()
(use-package ob-tikz
:defer t
:if (configuration-layer/package-usedp 'org)
:init (progn
(autoload 'org-babel-execute:tikz "ob-tikz.el")
(autoload 'org-babel-prep-session:tikz "ob-tikz.el")
(autoload 'org-babel-variable-assignments:tikz "ob-tikz.el"))
:config (progn
(add-to-list 'org-babel-load-languages
'(tikz . t))
(add-to-list 'org-babel-tangle-lang-exts
'("tikz" . "tikz")))))
(defun orgtools/init-ob-metapost ()
(use-package ob-metapost
:defer t
:if (configuration-layer/package-usedp 'org)
:init (progn
(autoload 'org-babel-execute:metapost "ob-metapost.el")
(autoload 'org-babel-prep-session:metapost "ob-metapost.el")
(autoload 'org-babel-variable-assignments:metapost "ob-metapost.el"))
:config (progn
(add-to-list 'org-babel-load-languages
'(metapost . t))
(add-to-list 'org-babel-tangle-lang-exts
'("metapost" . "mp")))))
(defun orgtools/init-ox-epub ()
(spacemacs|use-package-add-hook org :post-config (require 'ox-epub)))
(defun orgtools/init-ox-tufte ()
(spacemacs|use-package-add-hook org :post-config (require 'ox-tufte)))
(defun orgtools/init-ox-ravel ()
(spacemacs|use-package-add-hook org :post-config (require 'ox-ravel)))
(defun orgtools/init-org-html-themes ()
t)
(defun orgtools/post-init-org-templates ()
t)
(defun orgtools/post-init-org-lsf-theme ()
t)
(defun orgtools/post-init-ob-tikz ()
t)
(defun orgtools/post-init-ob-metapost ()
t)
(defun orgtools/post-init-org-html-themes ()
t)
(defun orgtools/init-cdlatex ()
(use-package cdlatex
:defer t
:commands 'turn-on-cdlatex
:config (progn
(add-hook 'org-mode-hook
'turn-on-cdlatex))))
(defun orgtools/post-init-ox-tufte ()
t)
(defun orgtools/post-init-ox-epub ()
t)
(defun orgtools/init-ob-mermaid ()
t)
;;; packages.el ends here