=== modified file 'lisp/progmodes/cfengine.el' *** lisp/progmodes/cfengine.el 2013-03-21 16:11:13 +0000 --- lisp/progmodes/cfengine.el 2013-03-22 14:39:32 +0000 *************** *** 30,40 **** ;; The CFEngine 3.x support doesn't have Imenu support but patches are ;; welcome. ;; You can set it up so either `cfengine2-mode' (2.x and earlier) or ;; `cfengine3-mode' (3.x) will be picked, depending on the buffer ;; contents: ! ;; (add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine-mode)) ;; OR you can choose to always use a specific version, if you prefer ;; it: --- 30,42 ---- ;; The CFEngine 3.x support doesn't have Imenu support but patches are ;; welcome. + ;; By default, CFEngine 3.x syntax is used. + ;; You can set it up so either `cfengine2-mode' (2.x and earlier) or ;; `cfengine3-mode' (3.x) will be picked, depending on the buffer ;; contents: ! ;; (add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine-auto-mode)) ;; OR you can choose to always use a specific version, if you prefer ;; it: *************** *** 181,187 **** ("$(\\([[:alnum:]_]+\\))" 1 font-lock-variable-name-face) ("${\\([[:alnum:]_]+\\)}" 1 font-lock-variable-name-face) ;; Variable definitions. ! ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face) ;; File, acl &c in group: { token ... } ("{[ \t]*\\([^ \t\n]+\\)" 1 font-lock-constant-face))) --- 183,189 ---- ("$(\\([[:alnum:]_]+\\))" 1 font-lock-variable-name-face) ("${\\([[:alnum:]_]+\\)}" 1 font-lock-variable-name-face) ;; Variable definitions. ! ("\\_<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face) ;; File, acl &c in group: { token ... } ("{[ \t]*\\([^ \t\n]+\\)" 1 font-lock-constant-face))) *************** *** 189,197 **** `( ;; Defuns. This happens early so they don't get caught by looser ;; patterns. ! (,(concat "\\<" cfengine3-defuns-regex "\\>" ! "[ \t]+\\<\\([[:alnum:]_.:]+\\)\\>" ! "[ \t]+\\<\\([[:alnum:]_.:]+\\)" ;; Optional parentheses with variable names inside. "\\(?:(\\([^)]*\\))\\)?") (1 font-lock-builtin-face) --- 191,199 ---- `( ;; Defuns. This happens early so they don't get caught by looser ;; patterns. ! (,(concat "\\_<" cfengine3-defuns-regex "\\_>" ! "[ \t]+\\_<\\([[:alnum:]_.:]+\\)\\_>" ! "[ \t]+\\_<\\([[:alnum:]_.:]+\\)" ;; Optional parentheses with variable names inside. "\\(?:(\\([^)]*\\))\\)?") (1 font-lock-builtin-face) *************** *** 212,221 **** ("[@$]{\\([[:alnum:]_.:]+\\)}" 1 font-lock-variable-name-face) ;; Variable definitions. ! ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face) ;; Variable types. ! (,(concat "\\<" (eval-when-compile (regexp-opt cfengine3-vartypes t)) "\\>") 1 font-lock-type-face))) (defvar cfengine2-imenu-expression --- 214,223 ---- ("[@$]{\\([[:alnum:]_.:]+\\)}" 1 font-lock-variable-name-face) ;; Variable definitions. ! ("\\_<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face) ;; Variable types. ! (,(concat "\\_<" (eval-when-compile (regexp-opt cfengine3-vartypes t)) "\\_>") 1 font-lock-type-face))) (defvar cfengine2-imenu-expression *************** *** 223,231 **** (regexp-opt cfengine2-actions t)) ":[^:]") 1) ! ("Variables/classes" "\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1) ! ("Variables/classes" "\\[ \t]+\\([[:alnum:]_]+\\)" 1)) "`imenu-generic-expression' for CFEngine mode.") (defun cfengine2-outline-level () --- 225,233 ---- (regexp-opt cfengine2-actions t)) ":[^:]") 1) ! ("Variables/classes" "\\_<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1) ! ("Variables/classes" "\\_[ \t]+\\([[:alnum:]_]+\\)" 1)) "`imenu-generic-expression' for CFEngine mode.") (defun cfengine2-outline-level () *************** *** 338,344 **** Treats body/bundle blocks as defuns." (unless (<= (current-column) (current-indentation)) (end-of-line)) ! (if (re-search-backward (concat "^[ \t]*" cfengine3-defuns-regex "\\>") nil t) (beginning-of-line) (goto-char (point-min))) t) --- 340,346 ---- Treats body/bundle blocks as defuns." (unless (<= (current-column) (current-indentation)) (end-of-line)) ! (if (re-search-backward (concat "^[ \t]*" cfengine3-defuns-regex "\\_>") nil t) (beginning-of-line) (goto-char (point-min))) t) *************** *** 347,353 **** "`end-of-defun' function for Cfengine 3 mode. Treats body/bundle blocks as defuns." (end-of-line) ! (if (re-search-forward (concat "^[ \t]*" cfengine3-defuns-regex "\\>") nil t) (beginning-of-line) (goto-char (point-max))) t) --- 349,355 ---- "`end-of-defun' function for Cfengine 3 mode. Treats body/bundle blocks as defuns." (end-of-line) ! (if (re-search-forward (concat "^[ \t]*" cfengine3-defuns-regex "\\_>") nil t) (beginning-of-line) (goto-char (point-max))) t) *************** *** 366,372 **** (cond ;; Body/bundle blocks start at 0. ! ((looking-at (concat cfengine3-defuns-regex "\\>")) (indent-line-to 0)) ;; Categories are indented one step. ((looking-at (concat cfengine3-category-regex "[ \t]*\\(#.*\\)*$")) --- 368,374 ---- (cond ;; Body/bundle blocks start at 0. ! ((looking-at (concat cfengine3-defuns-regex "\\_>")) (indent-line-to 0)) ;; Categories are indented one step. ((looking-at (concat cfengine3-category-regex "[ \t]*\\(#.*\\)*$")) *************** *** 516,522 **** (defun cfengine-common-syntax (table) ;; The syntax defaults seem OK to give reasonable word movement. - (modify-syntax-entry ?w "_" table) (modify-syntax-entry ?# "<" table) (modify-syntax-entry ?\n ">#" table) (modify-syntax-entry ?\" "\"" table) ; "string" --- 518,523 ---- *************** *** 584,590 **** (save-restriction (goto-char (point-min)) (while (not (or (eobp) v3)) ! (setq v3 (looking-at (concat cfengine3-defuns-regex "\\>"))) (forward-line))) (if v3 (cfengine3-mode) (cfengine2-mode)))) --- 585,591 ---- (save-restriction (goto-char (point-min)) (while (not (or (eobp) v3)) ! (setq v3 (looking-at (concat cfengine3-defuns-regex "\\_>"))) (forward-line))) (if v3 (cfengine3-mode) (cfengine2-mode))))