From 526ffaaeca7bd2f0e82208e14ac6593b35585602 Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Sat, 13 Feb 2016 12:10:03 +0900 Subject: [PATCH] Fix non dotted pair element issue Every element of auto-mode-list are not dotted pair. For example .gpg, .gz etc. assoc-default returns list for such buffer names and funcall raises error because it is not function. --- core/prelude-editor.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/prelude-editor.el b/core/prelude-editor.el index 6db7677..4d50c27 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -183,6 +183,8 @@ The body of the advice is in BODY." "Set buffer major mode according to `auto-mode-alist'." (let* ((name (buffer-name buffer)) (mode (assoc-default name auto-mode-alist 'string-match))) + (when (and mode (consp mode)) + (setq mode (car mode))) (with-current-buffer buffer (if mode (funcall mode))))) ;; highlight the current line