emacs-devel
[Top][All Lists]
Advanced

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

Re: asking for advice for changing the cfengine.el progmode to support C


From: Ted Zlatanov
Subject: Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x
Date: Thu, 23 Jun 2011 16:31:06 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

On Wed, 22 Jun 2011 16:24:00 -0500 Ted Zlatanov <address@hidden> wrote: 

TZ> Rather than try to explain the grammar, I'll write it out.  That way the
TZ> terminology is clearer; I should have started there instead of giving
TZ> you ad-hoc examples.  Sorry about that.  I hope the explanation is
TZ> sufficient to clear things up.

I included this "grammar" of sorts in cfengine3.el as comments.  The
SMIE stuff is commented out and not functional.  See attached.

A good, fairly large test file is at
http://source.cfengine.com/svn/copbl/trunk/cfengine_stdlib.cf 

This version does:

- much better font-lock (I only need to do in-string highlighting,
  e.g. "this is $(interpolated)" but haven't figured that part out
  yet).  The right faces are applied everywhere otherwise.

- intelligent indentation: 1 indent to "category:"; 2 indents to
  "class_selector::"; 3 indents to actual commands; appropriate
  indentation to nested lists; and 0 indentation to continued strings.
  The results look like this:

#+begin_src cfengine3
bundle edit_line syslog_init_append_oom
{
  delete_lines:
      "CFENGINE_ADD=1.*";

  insert_lines:
    debian::
      "CFENGINE_ADD=1 echo -17 > /proc/$PID/oom_adj" location => 
after("^\h+start\s+\"\$JOB\"");

    redhat::
      "CFENGINE_ADD=1 echo -17 > /proc/`cat /var/run/syslogd.pid`/oom_adj" 
      location => after("^\h+\[ \$RETVAL -eq 0 \] && touch 
/var/lock/subsys/syslog");
}

#+end_src

- everything is based on defuns, which in CFEngine3 are syntax blocks
  (older CFEngine versions didn't have them).

- the syntax table from cfengine.el is adjusted for the new version

As it is, except for highlighting string interpolation, it's great for
everyday work.  So I want to know if there's any reason to pursue
SMIE--what more can it do for this mode--and if there are any other
comments on the code.  If not, I'll remove the unnecessary parts, commit
it, and make a note in cfengine.el about the newer version.

Thanks
Ted

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


reply via email to

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