Adds Graphviz layer

- Uses a forked version of graphviz-dot-mode.el with a local install.
  Upstream PR: ppareit/graphviz-dot-mode#18
This commit is contained in:
luxbock 2016-01-29 15:35:56 +07:00 committed by syl20bnr
parent 9368cba427
commit 87db0174a2
3 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#+TITLE: graphviz layer
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../css/readtheorg.css" />
#+CAPTION: logo
# The maximum height of the logo should be 200 pixels.
[[img/graphviz.png]]
* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Install][Install]]
- [[Key bindings][Key bindings]]
* Description
This contains a forked version of [[https://github.com/ppareit/graphviz-dot-mode][graphviz-dot-mode]] that enables a live-reload
type work flow for editing `.dot` files. When live-preview is enabled, saving
the file will automatically trigger a compilation and reload of the image buffer
associated with the file.
If the live preview is not always updating the rendered image properly, you can
try to adjust the value of ~graphviz-dot-revert-delay~ higher to give the
compiler more time to finish generating the file before reverting the buffer.
* Install
To use this contribution add it to your =~/.spacemacs=
#+begin_src emacs-lisp
(setq-default dotspacemacs-configuration-layers '(graphviz))
#+end_src
* Key bindings
| Key Binding | Description |
|-------------+--------------------------------------|
| ~<SPC> t~ | Toggle live-preview |
| ~<SPC> c~ | Set compile command and compile file |
| ~<SPC> p~ | Preview file |
| ~<SPC> ,~ | Preview file |

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -0,0 +1,38 @@
;;; packages.el --- graphviz layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Commentary:
;;; Code:
(defconst graphviz-packages
'((graphviz-dot-mode :location (recipe :fetcher github :repo "luxbock/graphviz-dot-mode"))))
(defun graphviz/init-graphviz-dot-mode ()
(use-package graphviz-dot-mode
: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))
: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.")
(define-key graphviz-dot-mode-map (kbd "M-q") 'graphviz-dot-indent-graph)
(spacemacs/set-leader-keys-for-major-mode 'graphviz-dot-mode
"t" 'spacemacs/toggle-graphviz-live-reload
"c" 'compile
"p" 'graphviz-dot-preview
"," 'graphviz-dot-preview))))
;;; packages.el ends here