Skip to content

Commit

Permalink
Add support for pony-stable
Browse files Browse the repository at this point in the history
If you use the pony-stable dependency management tool then
the flycheck checker that existed before this commit wouldn't
work for you because it couldn't find your dependencies.
This commit introduces a 2nd (and now default) syntax checker that
will use pony-stable to drive syntax checking if pony-stable is
installed. See README.md for full details.
  • Loading branch information
SeanTAllen committed May 1, 2016
1 parent 33a299d commit 3d33871
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 25 deletions.
66 changes: 44 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,56 @@
flycheck-pony
=============
# Flycheck-pony

A [Flycheck][] syntax checker for [Pony][].
Flycheck-pony is an Emacs mode that supports on the fly syntax checking of
[Pony](http://www.ponylang.org/) files. If you are an Emacs user and aren't
familiar with [Flycheck](http://www.flycheck.org/en/latest/), we strongly
suggest you check it out as it will change your development experience.

## Installation

Installation
------------
This package can be obtain from
[MELPA](http://melpa.org/#/flycheck-pony or
[MELPA Stable](http://stable.melpa.org/#/flycheck-pony). The `master`
branch is continuously deployed to MELPA, and released versions are
deployed to MELPA Stable.

(add-to-list 'load-path "/home/you/path/to/flycheck-pony")
(require 'flycheck-pony)
<kbd>M-x package-install [RET] flycheck-pony [RET]</kbd>

Then somewhere in your Emacs configuration, call:

License
-------
```elisp
(use-package flycheck-pony)
```

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
## Configuration

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
At the moment, Emacs lockfiles cause errors with the Pony compiler, until this
is fixed, be sure to add the following to your configuration:

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
```elisp
;; turn off lockfiles as it causes errors with ponyc at the moment
(setq create-lockfiles nil)
```

See the file `COPYING` in this directory for details.
### Pick your syntax checker

Flycheck-pony supports 2 different syntax checkers. Most people will probably
want to use the default `pony` syntax checker. It works by calling
`ponyc -rexpr` on your source.

[Flycheck]: https://github.com/flycheck/flycheck
[Pony]: http://www.ponylang.org/
If you are using [pony-stable](https://github.com/jemc/pony-stable) to do
dependency management, then the `pony` syntax checker won't work for you as it
won't be able to find all your dependencies. For this eventuality, we provide a
`pony-stable` syntax checker that works by running `stable env ponyc -rexpr`.
Note that the `pony-stable` syntax checker won't update your dependencies for
you as they change. For this, you will need to use the actual `pony-stable`
command `stable fetch`. The `pony-stable` syntax checker is merely to allow you
to do syntax checking for users of the `pony-stable` dependency tool.

You can use the `flycheck-select-checker` function to switch between the two
different Pony syntax checkers. By default, `pony-stable` will be used if the
corresponding `stable` command is installed on your machine.

## Attribution

Big thanks to Richard M. Loveland who did the first version of flycheck-pony.
We wouldn't be where we are now without your initial work Richard!
17 changes: 14 additions & 3 deletions flycheck-pony.el
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;; flycheck-pony.el --- Pony support in Flycheck
;;
;; Authors: Sean T Allen <[email protected]>
;; Version: 0.1.1
;; Version: 0.2.1
;; URL: https://github.com/seantallen/flycheck-pony
;; Keywords: tools, convenience
;; Package-Requires: ((flycheck "0.25.1"))
Expand Down Expand Up @@ -45,7 +45,7 @@
"Pony support for Flycheck."
:prefix "flycheck-pony-"
:group 'flycheck
:link '(url-link :tag "Github" "https://github.com/rmloveland/flycheck-pony"))
:link '(url-link :tag "Github" "https://github.com/seantallen/flycheck-pony"))

(flycheck-define-checker pony
"A Pony syntax checker using the ponyc compiler.
Expand All @@ -58,7 +58,18 @@ See URL `http://www.ponylang.org'."
(zero-or-more (or digit ":")) (message) line-end))
:modes ponylang-mode)

(add-to-list 'flycheck-checkers 'pony)
(flycheck-define-checker pony-stable
"A Pony syntax checker using pony-stable dependency management tool.
See URL `https://github.com/jemc/pony-stable'."
:command ("stable" "env" "ponyc" "-rexpr")
:standard-input nil
:error-patterns
((error line-start (file-name) ":" line ":" column
(zero-or-more (or digit ":")) (message) line-end))
:modes ponylang-mode)

(add-to-list 'flycheck-checkers 'pony-stable 'pony)

(provide 'flycheck-pony)

Expand Down

0 comments on commit 3d33871

Please sign in to comment.