[erlang-patches] patch: emacs flymake support

Klas Johansson klas.johansson@REDACTED
Thu May 27 23:44:42 CEST 2010


>> >>This patch adds (optional) support for flymake mode
>> >>(on-the-fly syntax checking) on Emacs, for UNIX systems.
>> >>
>> >>This work was originally submitted to the Erlware version
>> >>of the Emacs mode by Mats Cronqvist.

Hi,

I took a different approach, which perhaps is of interest to
someone.  I'll post it here for the record.  This patch is a pure
elisp implementation and seems to work on linux, mac osx and
windows (provided that erlc is in the path).

    ;; Syntax check erlang source code on the fly (integrates with flymake).
    ;;
    ;; Start using flymake with erlang by putting the following somewhere
    ;; in your .emacs file:
    ;;
    ;;     (require 'erlang-flymake)
    ;;
    ;; Flymake is rather eager and does its syntax checks frequently by
    ;; default and if you are bothered by this, you might want to put the
    ;; following in your .emacs as well:
    ;;
    ;;     (erlang-flymake-only-on-save)
    ;;
    ;; There are a couple of variables which control the compilation options:
    ;; * erlang-flymake-get-code-path-dirs-function
    ;; * erlang-flymake-get-include-dirs-function
    ;; * erlang-flymake-extra-opts
    ;;
    ;; This code is inspired by http://www.emacswiki.org/emacs/FlymakeErlang.

There are a few differences that I've spotted.  The previously
posted version adds include and code paths whereas mine are by
default empty (any takers? :-) ).  They are configurable though.
I've used this in a setting where include and code paths are
stated in a special file within the application.  I wrote
functions which produced lists of paths based on that file.  The
following variables can be set to point at such functions:

  * erlang-flymake-get-code-path-dirs-function and
  * erlang-flymake-get-include-dirs-function

The flags used to specify compiler warnings differ as well.
There's another variable that can be used to specify the options
one wants to use:

  * erlang-flymake-extra-opts


Code here:

    git fetch git://github.com/klajo/otp.git erlang-flymake


Cheers,
Klas


More information about the erlang-patches mailing list