This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+config-files/cfengine
syl20bnr f3639da09e cfengine: reformat readme and various fixes
- Simplify README.org to follow the conventions and better integrate
with the other READMEs
- Remove unnecessary comments in code
- Add explicitly cfengine3-mode to the list of package
- Move eldoc hook to an eldoc post init function
- Defer loading of cfengine3-mode
- Move auto-mode-alist to init function
2016-04-21 22:22:02 -04:00
..
img Add: CFEngine config-files layer 2016-04-21 22:01:58 -04:00
config.el cfengine: reformat readme and various fixes 2016-04-21 22:22:02 -04:00
packages.el cfengine: reformat readme and various fixes 2016-04-21 22:22:02 -04:00
README.org cfengine: reformat readme and various fixes 2016-04-21 22:22:02 -04:00

CFEngine layer

/TakeV/spacemacs/media/commit/7ca7f2827a02223dcefde7f3d15865bc9f5ff178/layers/+config-files/cfengine/img/agent.png

Description

This layer makes working with CFEngine policy easier:

  • Syntax highlighting
  • On the fly syntax checks (via syntax-checking layer)
  • Auto completion (via auto-completion layer)

Install

Add cfengine to the dotspacemacs-configuration-layers in your ~/.spacemacs to use this layer.

Configuration

Set file permission on save

Here is a function to set permissions to 600 on save, this can help avoid errors like:

File ./example.cf (owner 1000) is writable by others (security exception)

(defun cfengine-permissions-policy-owner-only ()
  "If file starts with a shebang, make `buffer-file-name' executable"
  (save-excursion
    (set-file-modes buffer-file-name #o600)
    (message (concat "Made " buffer-file-name " accessibly only by the owner (600)."))))

(add-hook 'after-save-hook 'cfengine-permissions-policy-owner-only nil 'make-it-local)

Indendation

If you like attributes to be intended from the promiser set Indentation amount from anchor to 2. For example:

  bundle agent main
  {
    vars:

        "promiser"
          string => "value",
          comment => "Indented 2 spaces from promiser";
  }

Key bindings

Key Binding Description
<SPC> m j Reformats JSON string