Skip to content

Commit 8a296e3

Browse files
committed
Merge pull request #11 from chillum/master
fixed auto-mode-alist
2 parents 81766b7 + bb5d84b commit 8a296e3

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,22 @@ Licensed under the [GPL version 3](http://www.gnu.org/licenses/) or later.
1616
This is a quick mode for editing Nginx config files, as I didn't find
1717
anything else around that did quite this much.
1818

19-
Many thanks to the authors of puppet-mode.el, from where I found a
19+
Many thanks to the authors of `puppet-mode.el`, from where I found a
2020
useful indentation function that I've modified to suit this situation.
2121

22-
Put this file into your load-path and the following into your ~/.emacs:
22+
Put this file into your `load-path` and the following into your `~/.emacs`:
2323
```lisp
2424
(require 'nginx-mode)
2525
```
2626

27-
The mode should automatically activate for files called `nginx.conf` and files under `/etc/nginx` - if not, you can add something like this to your init file:
27+
The mode automatically activates for:
28+
29+
1. Files, called `nginx.conf`
30+
2. Files ending in `.conf` under `nginx` directory
31+
32+
If you want `sites-enabled` dir, add this to `~/.emacs` (not done by
33+
default, because can be shadowed by `apache-mode`):
34+
2835
```lisp
29-
(add-to-list 'auto-mode-alist '("/etc/nginx/sites-available/.*" . nginx-mode))
36+
(add-to-list 'auto-mode-alist '("/nginx/sites-\\(?:available\\|enabled\\)/" . nginx-mode))
3037
```

nginx-mode.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ The variable nginx-indent-level controls the amount of indentation.
185185
(run-hooks 'nginx-mode-hook))
186186

187187
;;;###autoload
188-
(add-to-list 'auto-mode-alist
189-
'("nginx\.conf$" . nginx-mode)
190-
'("/etc/nginx/.*" . nginx-mode))
188+
(add-to-list 'auto-mode-alist '("nginx\\.conf\\'" . nginx-mode))
189+
;;;###autoload
190+
(add-to-list 'auto-mode-alist '("/nginx/.+\\.conf\\'" . nginx-mode))
191191

192192
(provide 'nginx-mode)
193193

0 commit comments

Comments
 (0)