From 299f194aaff664fa60b5fd3d06d555f07755b3ba Mon Sep 17 00:00:00 2001 From: Tim Chambers Date: Sat, 11 Jun 2016 23:13:40 -0600 Subject: [PATCH] Add new ansible-inventory-generic-mode (Bug#23762) * lisp/generic-x.el (ansible-inventory-generic-mode): Add new mode. Copyright-paperwork-exempt: yes --- lisp/generic-x.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lisp/generic-x.el b/lisp/generic-x.el index 71ba1f7d002..bd0d8318859 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -215,6 +215,7 @@ This hook will be installed if the variable (defconst generic-unix-modes '(alias-generic-mode + ansible-inventory-generic-mode etc-fstab-generic-mode etc-modules-conf-generic-mode etc-passwd-generic-mode @@ -646,6 +647,26 @@ like an INI file. You can add this hook to `find-file-hook'." '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))))) "Generic mode for C Shell alias files.")) +;; Ansible inventory files +(when (memq 'ansible-inventory-generic-mode generic-extras-enable-list) + +(define-generic-mode ansible-inventory-generic-mode + '(?#) + nil + '(("^\\s-*\\(\\[.*\\]\\)" 1 font-lock-constant-face) + ("^\\s-*\\([^ \n\r]*\\)" 1 font-lock-function-name-face) + ("\\([^ =\n\r]+\\)=\\([^ \n\r]*\\)" + (1 font-lock-variable-name-face) + (2 font-lock-keyword-face))) + '("inventory") + (list + (function + (lambda () + (setq imenu-generic-expression + '((nil "^\\s-*\\[\\(.*\\)\\]" 1) + ("*Variables*" "\\s-+\\([^ =\n\r]+\\)=" 1)))))) + "Generic mode for Ansible inventory files.")) + ;;; Windows RC files ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira) (when (memq 'rc-generic-mode generic-extras-enable-list) -- 2.39.2