2016-01-29 08:35:56 +00:00
|
|
|
;;; packages.el --- graphviz layer packages file for Spacemacs.
|
|
|
|
;;
|
2020-09-16 21:34:40 +00:00
|
|
|
;; Copyright (c) 2012-2020 Sylvain Benner & Contributors
|
2016-01-29 08:35:56 +00:00
|
|
|
;;
|
2016-03-25 01:54:54 +00:00
|
|
|
;; Author: luxbock <opieppo@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
2016-01-29 08:35:56 +00:00
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(defconst graphviz-packages
|
2018-11-20 19:55:37 +00:00
|
|
|
'(
|
2018-12-26 22:11:23 +00:00
|
|
|
graphviz-dot-mode
|
2016-03-26 16:17:11 +00:00
|
|
|
org
|
2018-11-20 19:55:37 +00:00
|
|
|
smartparens
|
|
|
|
))
|
2016-01-29 08:35:56 +00:00
|
|
|
|
|
|
|
(defun graphviz/init-graphviz-dot-mode ()
|
|
|
|
(use-package graphviz-dot-mode
|
2016-03-25 01:54:54 +00:00
|
|
|
:mode (("\\.diag\\'" . graphviz-dot-mode)
|
|
|
|
("\\.blockdiag\\'" . graphviz-dot-mode)
|
|
|
|
("\\.nwdiag\\'" . graphviz-dot-mode)
|
|
|
|
("\\.rackdiag\\'" . graphviz-dot-mode)
|
|
|
|
("\\.dot\\'" . graphviz-dot-mode)
|
|
|
|
("\\.gv\\'" . graphviz-dot-mode))
|
2017-05-14 16:35:14 +00:00
|
|
|
:init (setq graphviz-dot-indent-width tab-width)
|
2016-01-29 08:35:56 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs|add-toggle graphviz-live-reload
|
|
|
|
:status graphviz-dot-auto-preview-on-save
|
|
|
|
:on (graphviz-turn-on-live-preview)
|
|
|
|
:off (graphviz-turn-off-live-preview)
|
|
|
|
:documentation "Enable Graphviz live reload.")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'graphviz-dot-mode
|
2016-03-25 01:54:54 +00:00
|
|
|
"=" 'graphviz-dot-indent-graph
|
2016-01-29 08:35:56 +00:00
|
|
|
"c" 'compile
|
2016-03-25 01:54:54 +00:00
|
|
|
"t" 'spacemacs/toggle-graphviz-live-reload)
|
|
|
|
(when dotspacemacs-major-mode-emacs-leader-key
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'graphviz-dot-mode
|
|
|
|
dotspacemacs-major-mode-emacs-leader-key 'graphviz-dot-preview))
|
|
|
|
(when dotspacemacs-major-mode-leader-key
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'graphviz-dot-mode
|
|
|
|
dotspacemacs-major-mode-leader-key 'graphviz-dot-preview)))))
|
2016-01-29 08:35:56 +00:00
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun graphviz/pre-init-smartparens ()
|
2016-03-25 01:54:54 +00:00
|
|
|
(spacemacs|use-package-add-hook graphviz-dot-mode
|
|
|
|
:post-config
|
|
|
|
(progn
|
|
|
|
;; allow smartparens to work properly
|
|
|
|
(define-key graphviz-dot-mode-map "{" nil)
|
|
|
|
(define-key graphviz-dot-mode-map "}" nil))))
|
2016-03-26 16:17:11 +00:00
|
|
|
|
2017-08-28 17:34:15 +00:00
|
|
|
(defun graphviz/pre-init-org ()
|
2016-04-30 02:47:03 +00:00
|
|
|
(spacemacs|use-package-add-hook org
|
|
|
|
:post-config
|
|
|
|
(progn
|
|
|
|
(add-to-list 'org-babel-load-languages '(dot . t))
|
|
|
|
;; replace fundamental mode by graphiz one
|
|
|
|
(setq org-src-lang-modes
|
|
|
|
(append '(("dot" . graphviz-dot))
|
|
|
|
(delete '("dot" . fundamental) org-src-lang-modes))))))
|