1
0

More than 5 years have passed since last update.

Let's write CWL with Emacs!

Posted at

Hi!

I need a good editor to write CWL.
Here are my requirements for good editor for CWL:
- syntax highlight
- on-the-fly syntax checking (if possible)

Therefore I developed cwl-mode to write CWL with Emacs.

How to install

Add MELPA repository for package.el

You can find cwl-mode in MELPA repository.
To add MELPA to your package repository, add the following code to init.el.

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

Install cwl-mode

You can install it by M-x package-install cwl-mode.

(optional) Install Flycheck

Emacs can provide on-the-fly syntax checking for CWL after installing Flycheck.
You can install it by M-x package-install flycheck because it is also provided in MELPA repository.

Install syntax checking tools

CWL checker in Flycheck uses schema-salad-tool and CWL syntax definition written in SALAD format.

You can install schema-salad-tool from PyPI by using the following command.

$ pip install schema_salad

The syntax definition file is provided in CWL repository in Github.
This article uses the definition file that is bundled with cwltool, that is a reference implementation of workflow engine for CWL.

You can install it using the following command:

$ pip install cwltool

Set up CWL checker

Set the path for CommonWorkflowLanguage.yml to flycheck-cwl-schema-path.
Please fix the path for CommonWorkflowLanguage.yml if needed.

init.el
(setq flycheck-cwl-schema-path "/Users/tom-tan/.pyenv/versions/3.6.2/lib/python3.6/site-packages/cwltool/schemas/v1.0/CommonWorkflowLanguage.yml")

Done!

You can see the contents of CWL file highlighted when you open files whose names are ended with .cwl.
Also, your Emacs can provide on-the-fly syntax checking feature after you install Flycheck.
Have fun!

See also: Emacs でも CWL を編集したい! (same article in Japanese)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0