ppareit / graphviz-dot-mode

Emacs mode for the DOT language, used by graphviz.
https://ppareit.github.io/graphviz-dot-mode
GNU General Public License v2.0
217 stars 47 forks source link

graphviz-dot-mode

Emacs package for working with Graphviz DOT-format files.

The features of this package help you to create .dot or .gv files containing syntax compatible with Graphviz and use Graphviz to convert these files to diagrams. Graphviz is a set of open source graph visualization tools created by AT&T Labs Research. A graph is a way of representing information as a network of connected nodes (shapes) and edges (lines).

Installing

Dependencies

This of course depends on Emacs and Graphviz. Installation from the command prompt should be something like

$ sudo dnf install emacs graphviz

Setting up MELPA

Add the MELPA archive to the list of archives used by the Emacs package manager by adding the following lines to your .emacs or other Emacs start-up file.

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(package-initialize)

Evaluate above code or restart Emacs.

Setting up use-package

Add the use-package package to your Emacs by adding the following lines to your start-up file.

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

Evaluate above code or restart Emacs.

Setting up graphviz-dot-mode

Now you can finally add Graphviz support to your Emacs by adding the following lines to your startup file.

(use-package graphviz-dot-mode
  :ensure t
  :config
  (setq graphviz-dot-indent-width 4))

Evaluate above code or restart Emacs.

Using graphviz-dot-mode

Once installation and setup is completed, usage is as simple as creating or opening a .dot file with C-x C-f (find-file). The file will open in dot mode. Syntax should be highlighted, completion should work and viewing your work is only one keystroke away with C-c C-p. Some useful commands are described below.

Indenting

Completion

Is available and makes use of the facilities provided by Emacs. Your preferred completion framework should plug into this.

For instance, if you use company, it can be configured by adding the following line to your startup file.

(add-hook 'graphviz-dot-mode-hook 'company-mode)

Commenting

Choosing layout

Compiling

Viewing

Customizing

You may customize variables by typing

M-x graphviz-dot-customize RET

or by setting them to different values in your startup file.

(add-hook 'graphviz-dot-mode-hook 'my-hook)

Support

Credits

graphviz-dot-mode was written by:

Other contributors are noted in the version history in the graphviz-dot-mode.el file and the commit history on GitHub.

The source code is maintained on GitHub at https://github.com/ppareit/graphviz-dot-mode by Pieter Pareit (pieter.pareit@gmail.com).