Commit 526cb962 authored by Ted Zlatanov's avatar Ted Zlatanov
Browse files

* progmodes/cfengine.el: Update for CFEngine 3.4.2 and higher.

parent 6ff2c8f1
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;; Author: Dave Love <fx@gnu.org> ;; Author: Dave Love <fx@gnu.org>
;; Maintainer: Ted Zlatanov <tzz@lifelogs.com> ;; Maintainer: Ted Zlatanov <tzz@lifelogs.com>
;; Keywords: languages ;; Keywords: languages
;; Version: 1.1 ;; Version: 1.2
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -94,7 +94,7 @@ This includes those for cfservd as well as cfagent.") ...@@ -94,7 +94,7 @@ This includes those for cfservd as well as cfagent.")
(regexp-opt cfengine3-defuns t) (regexp-opt cfengine3-defuns t)
"Regex to match the CFEngine 3.x defuns.") "Regex to match the CFEngine 3.x defuns.")
(defconst cfengine3-class-selector-regex "\\([[:alnum:]_().&|!]+\\)::") (defconst cfengine3-class-selector-regex "\\([[:alnum:]_().&|!:]+\\)::")
(defconst cfengine3-category-regex "\\([[:alnum:]_]+\\):") (defconst cfengine3-category-regex "\\([[:alnum:]_]+\\):")
...@@ -127,7 +127,7 @@ This includes those for cfservd as well as cfagent.") ...@@ -127,7 +127,7 @@ This includes those for cfservd as well as cfagent.")
;; patterns. ;; patterns.
(,(concat "\\<" cfengine3-defuns-regex "\\>" (,(concat "\\<" cfengine3-defuns-regex "\\>"
"[ \t]+\\<\\([[:alnum:]_]+\\)\\>" "[ \t]+\\<\\([[:alnum:]_]+\\)\\>"
"[ \t]+\\<\\([[:alnum:]_]+\\)" "[ \t]+\\<\\([[:alnum:]_:]+\\)"
;; Optional parentheses with variable names inside. ;; Optional parentheses with variable names inside.
"\\(?:(\\([^)]*\\))\\)?") "\\(?:(\\([^)]*\\))\\)?")
(1 font-lock-builtin-face) (1 font-lock-builtin-face)
...@@ -144,8 +144,8 @@ This includes those for cfservd as well as cfagent.") ...@@ -144,8 +144,8 @@ This includes those for cfservd as well as cfagent.")
1 font-lock-builtin-face) 1 font-lock-builtin-face)
;; Variables, including scope, e.g. module.var ;; Variables, including scope, e.g. module.var
("[@$](\\([[:alnum:]_.]+\\))" 1 font-lock-variable-name-face) ("[@$](\\([[:alnum:]_.:]+\\))" 1 font-lock-variable-name-face)
("[@$]{\\([[:alnum:]_.]+\\)}" 1 font-lock-variable-name-face) ("[@$]{\\([[:alnum:]_.:]+\\)}" 1 font-lock-variable-name-face)
;; Variable definitions. ;; Variable definitions.
("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face) ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face)
...@@ -317,6 +317,8 @@ Intended as the value of `indent-line-function'." ...@@ -317,6 +317,8 @@ Intended as the value of `indent-line-function'."
(indent-line-to (save-excursion (indent-line-to (save-excursion
(forward-char) (forward-char)
(backward-sexp) (backward-sexp)
(move-beginning-of-line nil)
(skip-chars-forward " \t")
(current-column))) (current-column)))
(error nil))) (error nil)))
;; Inside a string and it starts before this line. ;; Inside a string and it starts before this line.
...@@ -436,7 +438,8 @@ Intended as the value of `indent-line-function'." ...@@ -436,7 +438,8 @@ Intended as the value of `indent-line-function'."
;; The syntax defaults seem OK to give reasonable word movement. ;; The syntax defaults seem OK to give reasonable word movement.
(modify-syntax-entry ?# "<" table) (modify-syntax-entry ?# "<" table)
(modify-syntax-entry ?\n ">#" table) (modify-syntax-entry ?\n ">#" table)
(modify-syntax-entry ?\" "\"" table) (modify-syntax-entry ?\" "\"" table) ; "string"
(modify-syntax-entry ?\' "\"" table) ; 'string'
;; Variable substitution. ;; Variable substitution.
(modify-syntax-entry ?$ "." table) (modify-syntax-entry ?$ "." table)
;; Doze path separators. ;; Doze path separators.
...@@ -475,7 +478,6 @@ to the action header." ...@@ -475,7 +478,6 @@ to the action header."
;; Shell commands can be quoted by single, double or back quotes. ;; Shell commands can be quoted by single, double or back quotes.
;; It's debatable whether we should define string syntax, but it ;; It's debatable whether we should define string syntax, but it
;; should avoid potential confusion in some cases. ;; should avoid potential confusion in some cases.
(modify-syntax-entry ?\' "\"" cfengine2-mode-syntax-table)
(modify-syntax-entry ?\` "\"" cfengine2-mode-syntax-table) (modify-syntax-entry ?\` "\"" cfengine2-mode-syntax-table)
(set (make-local-variable 'indent-line-function) #'cfengine2-indent-line) (set (make-local-variable 'indent-line-function) #'cfengine2-indent-line)
...@@ -505,7 +507,7 @@ on the buffer contents" ...@@ -505,7 +507,7 @@ on the buffer contents"
(forward-line))) (forward-line)))
(if v3 (cfengine3-mode) (cfengine2-mode)))) (if v3 (cfengine3-mode) (cfengine2-mode))))
(defalias 'cfengine-mode 'cfengine-auto-mode) (defalias 'cfengine-mode 'cfengine3-mode)
(provide 'cfengine3) (provide 'cfengine3)
(provide 'cfengine) (provide 'cfengine)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment