From 6b5bfd1328898e6d12a110e2c9ca771b2a63c37e Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Fri, 16 Nov 2018 14:16:49 +0900 Subject: [PATCH] Fix --- emacs.el | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/emacs.el b/emacs.el index 84826b5..1d23d03 100644 --- a/emacs.el +++ b/emacs.el @@ -731,7 +731,7 @@ found, otherwise returns nil." (add-hook 'editorconfig-hack-properties-functions '(lambda (props) (when (derived-mode-p 'makefile-mode) - (puthash 'indent_style \"tab\" props)))) + (puthash 'indent_style "tab" props)))) ;; (when (fboundp 'editorconfig-charset-extras) ;; (add-hook 'editorconfig-custom-hooks @@ -895,7 +895,7 @@ found, otherwise returns nil." (lambda () (setq imenu-generic-expression `(("Sections" ";;;\+\n;; \\(.*\\)\n" 1) - ,@imenu-generic-expression)))) + ,@imenu-generic-expression)))) (with-eval-after-load 'compile (defvar compilation-filter-start) @@ -2818,17 +2818,19 @@ If target path is not found in COMMITISH tree, go up path and try again until fo This assumes that file name should be in a format like BASE.EXT.j2 ." (require 'mmm-mode) (require 'mmm-jinja2) - (let ((withoutj2 (replace-regexp-in-string "\\.j2\\'" - "" - buffer-file-name))) - (let ((mode (assoc-default withoutj2 - auto-mode-alist - 'string-match))) - (when mode - (funcall mode))) - (add-to-list 'mmm-classes - 'jinja2) - (mmm-mode-on))) + ;; Sometimes buffer-file-name is set to nil... Why? + (when buffer-file-name + (let ((withoutj2 (replace-regexp-in-string "\\.j2\\'" + "" + buffer-file-name))) + (let ((mode (assoc-default withoutj2 + auto-mode-alist + 'string-match))) + (when mode + (funcall mode))) + (add-to-list 'mmm-classes + 'jinja2) + (mmm-mode-on)))) (add-to-list 'auto-mode-alist '("\\.j2\\'" . jinja2-mmm-mode))