[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

asking for advice for changing the cfengine.el progmode to support CFEng

From: Ted Zlatanov
Subject: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x
Date: Fri, 17 Jun 2011 13:11:30 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

I started work on rewriting cfengine.el for 3.x and realized the syntax
is too different.  In version 2 it was much simpler, while version 3 has
parameterized bundles, many variable types, new functions, etc.  The
cfengine.el code assumes a lot of things are simple and it's a pain to
extend it directly.  This is the first time I've started on a fairly
major progmode so please bear with me.

I wonder what progmode should I use as a starting point to support the
cfengine 3.x syntax; I've appended some samples at the end.  I also
attach my mostly-broken cfengine.el rewrite, which you can examine but
indentation is mostly wrong and as I worked on it I realized it was just
not easy to retrofit the indentation.

Basically there are two indentation-relevant lines:

1) (body|bundle).+ sets the indentation to 0

2) "x:" sets the indentation to `cfengine-indent' and "y::" sets it to
two times `cfengine-indent'.

...but the possibility of nested braces makes it all much more
interesting, and they have to be indented intelligently.

I could use CEDET but am not sure if it makes sense, considering the
existing code in cfengine.el doesn't.  So I'd like some recommendations
on where to start and what mode(s) could do it.


body classes context_sensitive(x)
  promise_repaired => { "$(x)_repaired" };
  promise_kept     => { "$(x)_kept"     };
  repair_failed    => { "$(x)_failed"   };
  repair_denied    => { "$(x)_denied"   };
  repair_timeout   => { "$(x)_timeout"  };

bundle edit_line block_append_if_no_line(data)
     "$(data)" insert_type => "preserve_block";

bundle agent runthis

    "$(init) restart" 
    comment        =>    "Restart service $(s) with the initscript $(init).",
    classes        =>     context_yesnorepaired("$(service)_restart"),
    ifvarclass     =>    "$(service)_not_running&please_enable_$(service)";

bundle agent ypbind_start_conversion
    "nis_islink" expression => islink("/etc/init.d/nis");

      "/etc/init.d/nis stop";
      "/usr/sbin/service cron stop";

      "Stopped cron and ypbind for upstart conversion.";

bundle agent routes
    "partition" slist => { "a", "q", "x" };

    "dummy" usebundle => route_wrap("eth0", "any", "$(partition)");

Attachment: cfengine.el
Description: application/emacs-lisp

reply via email to

[Prev in Thread] Current Thread [Next in Thread]