fxbois/web-mode — pull request #167 by mgalgs (2014-01-11 22:55:53+00:00)
Title: add support for functions in web-mode-engines-alist

Currently, the user must pass a regexp to check against the buffer name
for setting the web-mode engine. However, sometimes it's convenient to
use a function instead. Add support for using a function in addition to
the current regexp method.

Example usage:

(defun my-current-buffer-django-p ()
(save-excursion
(search-forward-regexp "{% base\\|{% if\\|{% include\\|{% block"
nil
t)))

(setq web-mode-engines-alist
'(("django" . "\\.djhtml")
("django" . my-current-buffer-django-p)))