unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tim Chambers <tim.chambers@viavisolutions.com>
To: 23762@debbugs.gnu.org
Cc: Tim Chambers <tbc@alum.mit.edu>
Subject: bug#23762: [PATCH] * lisp/generic-x.el (ansible-inventory-generic-mode): New mode. (generic-unix-modes): Add it.
Date: Mon, 13 Jun 2016 11:09:40 -0600	[thread overview]
Message-ID: <20160613170940.13268-1-tim.chambers@viavisolutions.com> (raw)

From: Tim Chambers <tbc@alum.mit.edu>

---
 lisp/generic-x.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index 71ba1f7..bedb100 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,25 @@ 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
+  '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face)
+    ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
+     (1 font-lock-function-name-face)
+     (2 font-lock-variable-name-face)))
+  '("inventory")
+  (list
+   (function
+    (lambda ()
+      (setq imenu-generic-expression
+	    '((nil "^\\[\\(.*\\)\\]" 1)
+	      ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 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)
-- 
1.9.1






             reply	other threads:[~2016-06-13 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 17:09 Tim Chambers [this message]
2016-06-14 16:43 ` bug#23762: [PATCH] * lisp/generic-x.el (ansible-inventory-generic-mode): New mode. (generic-unix-modes): Add it Ted Zlatanov
2016-06-14 19:26   ` Tim Chambers
2016-06-15 13:36     ` Ted Zlatanov
2016-06-15 20:02       ` Tim Chambers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160613170940.13268-1-tim.chambers@viavisolutions.com \
    --to=tim.chambers@viavisolutions.com \
    --cc=23762@debbugs.gnu.org \
    --cc=tbc@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).