Commit 012e2f9f authored by Glenn Morris's avatar Glenn Morris
Browse files

* files.el (hack-local-variables): Warn about misplaced lexical-binding.

(hack-local-variables--warned-lexical): New.

Fixes: debbugs:15616
parent 62ad85e6
2013-10-16 Glenn Morris <rgm@gnu.org> 2013-10-16 Glenn Morris <rgm@gnu.org>
* files.el (hack-local-variables--warned-lexical): New.
(hack-local-variables):
Warn about misplaced lexical-binding. (Bug#15616)
* net/eww.el (eww-render): Always set eww-current-url, * net/eww.el (eww-render): Always set eww-current-url,
and update header line. (Bug#15622) and update header line. (Bug#15622)
(eww-display-html): ... Rather than just doing it here. (eww-display-html): ... Rather than just doing it here.
......
...@@ -3154,6 +3154,9 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil." ...@@ -3154,6 +3154,9 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil."
(assq-delete-all (car elt) file-local-variables-alist))) (assq-delete-all (car elt) file-local-variables-alist)))
(push elt file-local-variables-alist))))) (push elt file-local-variables-alist)))))
;; TODO? Warn once per file rather than once per session?
(defvar hack-local-variables--warned-lexical nil)
(defun hack-local-variables (&optional mode-only) (defun hack-local-variables (&optional mode-only)
"Parse and put into effect this buffer's local variables spec. "Parse and put into effect this buffer's local variables spec.
Uses `hack-local-variables-apply' to apply the variables. Uses `hack-local-variables-apply' to apply the variables.
...@@ -3275,13 +3278,18 @@ local variables, but directory-local variables may still be applied." ...@@ -3275,13 +3278,18 @@ local variables, but directory-local variables may still be applied."
"-minor\\'" "-minor\\'"
(setq val2 (downcase (symbol-name val))))) (setq val2 (downcase (symbol-name val)))))
(setq result (intern (concat val2 "-mode")))) (setq result (intern (concat val2 "-mode"))))
(unless (eq var 'coding) (cond ((eq var 'coding))
(condition-case nil ((eq var 'lexical-binding)
(unless hack-local-variables--warned-lexical
(setq hack-local-variables--warned-lexical t)
(display-warning :warning
"Specify `lexical-binding' on the first line, not at the end")))
(t
(ignore-errors
(push (cons (if (eq var 'eval) (push (cons (if (eq var 'eval)
'eval 'eval
(indirect-variable var)) (indirect-variable var))
val) result) val) result))))))
(error nil)))))
(forward-line 1)))))))) (forward-line 1))))))))
;; Now we've read all the local variables. ;; Now we've read all the local variables.
;; If MODE-ONLY is non-nil, return whether the mode was specified. ;; If MODE-ONLY is non-nil, return whether the mode was specified.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment