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.
This commit is contained in:
parent
ebd6e9d591
commit
526ffaaeca
1 changed files with 2 additions and 0 deletions
|
@ -183,6 +183,8 @@ The body of the advice is in BODY."
|
||||||
"Set buffer major mode according to `auto-mode-alist'."
|
"Set buffer major mode according to `auto-mode-alist'."
|
||||||
(let* ((name (buffer-name buffer))
|
(let* ((name (buffer-name buffer))
|
||||||
(mode (assoc-default name auto-mode-alist 'string-match)))
|
(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)))))
|
(with-current-buffer buffer (if mode (funcall mode)))))
|
||||||
|
|
||||||
;; highlight the current line
|
;; highlight the current line
|
||||||
|
|
Loading…
Reference in a new issue