/wavedrom-mode

Wavedrom Major Mode for Emacs

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

MELPA MELPA Stable Build Status

wavedrom.el - Wavedrom Integration for Emacs

This package provides a major mode for editing and rendering WaveJSON files to create timing diagrams using wavedrom.

Demo

Requirements

Installation

MELPA

wavedrom is available on MELPA.

straight.el

To install it via straight with use-package:

(straight-use-package 'use-package)
(use-package wavedrom)

Basic config

The package comes with sensible default values. However, you can tweak it either with M-x customize-group RET wavedrom RET or with the following Elisp code:

(setq wavedrom-output-format "pdf")
(setq wavedrom-output-directory "~/wavedrom")
;; Faces suitable for dark themes
(set-face-attribute 'wavedrom-font-lock-brackets-face nil :foreground "goldenrod")
(set-face-attribute 'wavedrom-font-lock-punctuation-face nil :foreground "burlywood")

Usage

  • Create a file with .wjson extension and wavedrom-mode will automatically be enabled next time it is opened.

  • Fill the file with valid WaveJSON syntax and every time it is saved the function wavedrom-compile will be executed, updating the output file and its associated buffer. This provides a WYSIWYG-like result similar to the one with the web editor.

  • The output file path will be determined from the value of customizable variables wavedrom-output-format and wavedrom-output-directory. For example, if editing the file hello_world.wjson:

    (setq wavedrom-output-format "svg")
    (setq wavedrom-output-directory "~/wavedrom")

    The rendered file will be created at: ~/wavedrom/hello_world.svg

Keybindings

  • C-c C-c: wavedrom-compile
  • C-c C-p: wavedrom-preview-browser

Other packages