unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* asking for advice for changing the cfengine.el progmode to support CFEngine 3.x
@ 2011-06-17 18:11 Ted Zlatanov
  2011-06-17 22:02 ` Stefan Monnier
  0 siblings, 1 reply; 20+ messages in thread
From: Ted Zlatanov @ 2011-06-17 18:11 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2357 bytes --]

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.

Ted

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)
{
 insert_lines:
   any::
     "$(data)" insert_type => "preserve_block";
}

bundle agent runthis
{
  commands:

    "$(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
{
  classes:
    "nis_islink" expression => islink("/etc/init.d/nis");

  commands:
    debian.!nis_islink::
      "/etc/init.d/nis stop";
      "/usr/sbin/service cron stop";

  reports:
    !nis_islink::
      "Stopped cron and ypbind for upstart conversion.";
}

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

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


[-- Attachment #2: cfengine.el --]
[-- Type: application/emacs-lisp, Size: 13487 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-07-01 13:03 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-17 18:11 asking for advice for changing the cfengine.el progmode to support CFEngine 3.x Ted Zlatanov
2011-06-17 22:02 ` Stefan Monnier
2011-06-20 20:42   ` Ted Zlatanov
2011-06-21 14:59     ` Stefan Monnier
2011-06-21 19:26       ` Ted Zlatanov
2011-06-22 17:44         ` Stefan Monnier
2011-06-22 21:24           ` Ted Zlatanov
2011-06-23 21:31             ` Ted Zlatanov
2011-06-27 15:44               ` Ted Zlatanov
2011-06-30 12:47                 ` Ted Zlatanov
2011-06-30 16:03                   ` Stefan Monnier
2011-06-30 18:25                     ` Ted Zlatanov
2011-06-30 21:10                       ` Stefan Monnier
2011-06-30 21:29                         ` Ted Zlatanov
2011-07-01  8:19                       ` Eli Zaretskii
2011-07-01 10:15                         ` Ted Zlatanov
2011-07-01 11:22                           ` Eli Zaretskii
2011-07-01 13:03                             ` Ted Zlatanov
2011-06-30 16:11               ` Stefan Monnier
2011-06-30 18:28                 ` Ted Zlatanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).