From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
Subject: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x
Date: Fri, 17 Jun 2011 13:11:30 -0500 [thread overview]
Message-ID: <87mxhgl44t.fsf@lifelogs.com> (raw)
[-- 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 --]
next reply other threads:[~2011-06-17 18:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-17 18:11 Ted Zlatanov [this message]
2011-06-17 22:02 ` asking for advice for changing the cfengine.el progmode to support CFEngine 3.x 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mxhgl44t.fsf@lifelogs.com \
--to=tzz@lifelogs.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).