# HG changeset patch # User Aidan Kehoe # Date 1271347268 -3600 # Node ID 733f067a73ce257c274e5bac1c225beb5c33a6e5 # Parent 1c615eb1e4b2257413e9ddb545540cba87d73978 Check that MODENAME-mode is fboundp before calling it, files.el 2010-04-15 Aidan Kehoe * files.el (hack-local-variables-prop-line) (hack-one-local-variable): Only attempt to call MODENAME-mode on encountering a -*-MODENAME-*- line if the corresponding symbol has a function binding, avoiding an error if, for example, opening a log file with XLFDs and wild cards. Thanks for the bug report, Henrique Martins! diff -r 1c615eb1e4b2 -r 733f067a73ce lisp/ChangeLog --- a/lisp/ChangeLog Mon Apr 12 01:41:38 2010 -0500 +++ b/lisp/ChangeLog Thu Apr 15 17:01:08 2010 +0100 @@ -1,3 +1,13 @@ +2010-04-15 Aidan Kehoe + + * files.el (hack-local-variables-prop-line) + (hack-one-local-variable): + Only attempt to call MODENAME-mode on encountering a + -*-MODENAME-*- line if the corresponding symbol has a function + binding, avoiding an error if, for example, opening a log file + with XLFDs and wild cards. Thanks for the bug report, Henrique + Martins! + 2010-04-09 Didier Verna * hyper-apropos.el (hyper-apropos-get-doc): Use [not available] diff -r 1c615eb1e4b2 -r 733f067a73ce lisp/files.el --- a/lisp/files.el Mon Apr 12 01:41:38 2010 -0500 +++ b/lisp/files.el Thu Apr 15 17:01:08 2010 +0100 @@ -2044,7 +2044,7 @@ ;; Without this guard, `normal-mode' would potentially run ;; the major mode function twice: once via `set-auto-mode' ;; and once via `hack-local-variables'. - (if (not (eq mode major-mode)) + (if (and (not (eq mode major-mode)) (fboundp mode)) (funcall mode)) )) (set-any-p @@ -2091,8 +2091,9 @@ "\"Set\" one variable in a local variables spec. A few variable names are treated specially." (cond ((eq var 'mode) - (funcall (intern (concat (downcase (symbol-name val)) - "-mode")))) + (and (fboundp (setq val (intern (concat (downcase (symbol-name val)) + "-mode")))) + (funcall val))) ((eq var 'coding) ;; We have already handled coding: tag in set-auto-coding. nil)