branch: elpa/nginx-mode
commit 95cb9169e398b7a62916d6c15bc279f2246861a6
Author: Joe Wreschnig <joe.wresch...@gmail.com>
Commit: Joe Wreschnig <joe.wresch...@gmail.com>

    Add top-level Nginx configuration blocks to magic-fallback-mode-alist.
    
    As mentioned in issue #6, Nginx configuration today is often edited
    indirectly as part of a CMS, and the files are often fragments rather
    than a single nginx.conf.
    
    By adding the common top-level blocks to a magic mode alist, we can
    still automatically detect these files. By choosing the fallback
    alist, we still allow other major modes to make a stronger claim based
    on extension or literal content / interpreter match.
---
 nginx-mode.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/nginx-mode.el b/nginx-mode.el
index 03ec64f..34f1e11 100644
--- a/nginx-mode.el
+++ b/nginx-mode.el
@@ -190,6 +190,11 @@ The variable nginx-indent-level controls the amount of 
indentation.
 (add-to-list 'auto-mode-alist '("nginx\\.conf\\'"  . nginx-mode))
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("/nginx/.+\\.conf\\'" . nginx-mode))
+;;;###autoload
+(add-to-list
+ 'magic-fallback-mode-alist
+ '("\\(?:.*\n\\)*\\(?:http\\|server\\|location .+\\|upstream .+\\)[ \n\t]+{"
+   . nginx-mode))
 
 (provide 'nginx-mode)
 

Reply via email to