1. tm_tn

    Posted

    tm_tn
Changes in title
+Let's write CWL with Emacs!
Changes in tags
Changes in body
Source | HTML | Preview
@@ -0,0 +1,61 @@
+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](https://github.com/tom-tan/cwl-mode) to write CWL with Emacs.
+
+# How to install
+
+## Add MELPA repository for package.el
+You can find cwl-mode in [MELPA](https://melpa.org) repository.
+To add MELPA to your package repository, add the following code to `init.el`.
+
+```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`](https://github.com/common-workflow-language/schema_salad) and CWL syntax definition written in [SALAD](http://www.commonwl.org/v1.0/SchemaSalad.html) format.
+
+You can install `schema-salad-tool` from [PyPI](https://pypi.python.org/pypi) by using the following command.
+
+```shell-session
+$ pip install schema_salad
+```
+
+The syntax definition file is provided in [CWL repository in Github](https://github.com/common-workflow-language/common-workflow-language).
+This article uses the definition file that is bundled with [`cwltool`](https://github.com/common-workflow-language/cwltool), that is a reference implementation of workflow engine for CWL.
+
+You can install it using the following command:
+
+```shell-session
+$ 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.
+
+```el: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](http://www.flycheck.org).
+Have fun!
+
+See also: [Emacs でも CWL を編集したい!](https://qiita.com/tm_tn/items/79eec754338d152b092d) (same article in Japanese)