From 05f7fb71bd782222bd3d38ba0820740ee4659a66 Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Mon, 12 Nov 2018 14:17:11 +0900 Subject: [PATCH] Add jinja2-mmm-mode --- emacs.el | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/emacs.el b/emacs.el index 7b0dbd6..4ebc3b2 100644 --- a/emacs.el +++ b/emacs.el @@ -3051,6 +3051,33 @@ If target path is not found in COMMITISH tree, go up path and try again until fo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; j2-mode jinja2-mmm-mode? +(define-derived-mode jinja2-mmm-mode prog-mode + "Jinja2 MMM" + "Major mode to setup mmm-mode for jinja2 files." + (require 'mmm-mode) + (require 'mmm-jinja2) + (let* ((origname buffer-file-name) + (withoutj2 buffer-file-name) + (withoutj2 (replace-regexp-in-string "\\.j2\\'" + "" + withoutj2)) + (withoutj2 (replace-regexp-in-string "\\.j2\\'" + "" + withoutj2))) + (unwind-protect + (progn + (let ((mode (assoc-default withoutj2 + auto-mode-alist + 'string-match))) + (when mode + (funcall mode))) + (add-to-list 'mmm-classes + 'jinja2) + (mmm-mode-on)) + (setq buffer-file-name origname)))) + +;; (add-to-list 'auto-mode-alist +;; '("\\.j2\\'" . jinja2-mmm-mode)) ;; Local Variables: ;; flycheck-disabled-checkers: (emacs-lisp-checkdoc)