On Sat, 23 Jun 2012 20:07:25 +0200 Marco Marongiu <[email protected]>
wrote:
MM> On 22/06/12 20:05, Ted Zlatanov wrote:
>> Marco and others, do you want to suggest some good blank templates for
>> the various bundles and bodies? I'll take care of integrating them with
>> cfengine-mode.el. They'll be in the menus somewhere.
MM> Personally, I'd be content with a plain template for all those bundles
MM> that are tied to a normal ordering: press a few keys, and there comes a
MM> skeleton for (e.g.) a bundle agent with just all the naked promises in
MM> normal order to fill out. Should those few keys also require us to
MM> provide a name for the bundle, I wouldn't complain ;)
Yup, that's exactly what skeleton.el does. Could you give me some
templates you'd use and tell me what portions should be parameterized?
I'll do the rest.
MM> One more thing while we are at it: what about a simple mode for cfengine
MM> templates? Marking the BEGIN/END lines with a different background and
MM> highlighting the class names should be more than enough; I expect it to
MM> be fairly simple, due to the limited number of different options and the
MM> syntax. But I am an emacs-internals illiterate and I don't know. Would
MM> that be complicated to make?
It's not complicated. In fact highlighting keywords is trivial; here's
my slightly complicated setup that targets a few modes and installs some
typical programmerish keywords:
(defun tzz-highlighting-install ()
(interactive)
(font-lock-mode -1)
(font-lock-mode 1)
(font-lock-add-keywords nil `( ("\\(FIXME\\|TONOTE\\|TODO\\)" (1
'font-lock-warning-face prepend)))))
(dolist (hook '(prog-mode-hook
text-mode-hook
change-log-mode-hook
message-mode-hook
texinfo-mode-hook))
(add-hook hook 'tzz-highlighting-install))
BTW, `prog-mode-hook' is the ancestor of most programming modes, which
includes cfengine3-mode, C, C++, etc. so this is a pretty comprehensive
list.
The problem is, CFEngine templates don't have their own mode or an
extension I could use to trigger the highlighting. If you are happy
with editing them as plain text, then the above will work through
text-mode-hook. If not, more work is needed.
Ted
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine