Appendix A. Editing CFEngine 3 Configurations in Emacs
If you are an Emacs user, you will not be surprised to learn that there is an Emacs mode for editing CFEngine configuration files. In this Appendix you will learn how to set up and use the CFEngine editing mode in Emacs.
Setting Up
You need GNU Emacs 23.1 or higher. Earlier versions or XEmacs may work as well, but have not been extensively tested.
First, you need to download cfengine.el from https://raw.github.com/cfengine/core/master/contrib/cfengine.el. Emacs currently includes an older version of this file. Emacs 24.2 and higher, when released, will include the latest version, but 24.1 and earlier do not, so you need to manually download it.
Assuming you have downloaded the library to your computer, you can add it to your load path. Follow the generic instructions from the Emacs wiki, or just put the following code in your .emacs file:
(autoload
'cfengine-mode"cfengine"
"cfengine editing"
t) (add-to-list
'load-path"/directory/where/the/library/lives/"
)
You will probably want to tell Emacs to associate .cf files with the cfengine-mode
, although that could cause
problems if you use other files ending with .cf. See http://www.emacswiki.org/emacs/AutoModeAlist for more
information or just add the following line to your .emacs file:
(add-to-list
'auto-mode-alist'
("\\.cf\\'"
.
cfengine-mode
))
If you use other files ending with .cf and would prefer not to associate this
extension with cfengine-mode
by default, ...
Get Learning CFEngine 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.