fxbois/web-mode — pull request #166 by mgalgs (2014-01-11 22:52:52+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.

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)))