diff options
| author | Glenn Morris | 2013-10-15 18:33:16 -0700 |
|---|---|---|
| committer | Glenn Morris | 2013-10-15 18:33:16 -0700 |
| commit | 012e2f9fdaf39b5f913b5560be3986e2bc599186 (patch) | |
| tree | 495ab882e3b8e325b4e575539f51d63c256bd5c3 | |
| parent | 62ad85e6af83a70576642219bef4d147410d2f73 (diff) | |
| download | emacs-012e2f9fdaf39b5f913b5560be3986e2bc599186.tar.gz emacs-012e2f9fdaf39b5f913b5560be3986e2bc599186.zip | |
* files.el (hack-local-variables): Warn about misplaced lexical-binding.
(hack-local-variables--warned-lexical): New.
Fixes: debbugs:15616
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/files.el | 22 |
2 files changed, 19 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 50ef17cfef1..476c0593855 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2013-10-16 Glenn Morris <rgm@gnu.org> | 1 | 2013-10-16 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * files.el (hack-local-variables--warned-lexical): New. | ||
| 4 | (hack-local-variables): | ||
| 5 | Warn about misplaced lexical-binding. (Bug#15616) | ||
| 6 | |||
| 3 | * net/eww.el (eww-render): Always set eww-current-url, | 7 | * net/eww.el (eww-render): Always set eww-current-url, |
| 4 | and update header line. (Bug#15622) | 8 | and update header line. (Bug#15622) |
| 5 | (eww-display-html): ... Rather than just doing it here. | 9 | (eww-display-html): ... Rather than just doing it here. |
diff --git a/lisp/files.el b/lisp/files.el index ab62be295f0..cf3356014a1 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3154,6 +3154,9 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil." | |||
| 3154 | (assq-delete-all (car elt) file-local-variables-alist))) | 3154 | (assq-delete-all (car elt) file-local-variables-alist))) |
| 3155 | (push elt file-local-variables-alist))))) | 3155 | (push elt file-local-variables-alist))))) |
| 3156 | 3156 | ||
| 3157 | ;; TODO? Warn once per file rather than once per session? | ||
| 3158 | (defvar hack-local-variables--warned-lexical nil) | ||
| 3159 | |||
| 3157 | (defun hack-local-variables (&optional mode-only) | 3160 | (defun hack-local-variables (&optional mode-only) |
| 3158 | "Parse and put into effect this buffer's local variables spec. | 3161 | "Parse and put into effect this buffer's local variables spec. |
| 3159 | Uses `hack-local-variables-apply' to apply the variables. | 3162 | Uses `hack-local-variables-apply' to apply the variables. |
| @@ -3275,13 +3278,18 @@ local variables, but directory-local variables may still be applied." | |||
| 3275 | "-minor\\'" | 3278 | "-minor\\'" |
| 3276 | (setq val2 (downcase (symbol-name val))))) | 3279 | (setq val2 (downcase (symbol-name val))))) |
| 3277 | (setq result (intern (concat val2 "-mode")))) | 3280 | (setq result (intern (concat val2 "-mode")))) |
| 3278 | (unless (eq var 'coding) | 3281 | (cond ((eq var 'coding)) |
| 3279 | (condition-case nil | 3282 | ((eq var 'lexical-binding) |
| 3280 | (push (cons (if (eq var 'eval) | 3283 | (unless hack-local-variables--warned-lexical |
| 3281 | 'eval | 3284 | (setq hack-local-variables--warned-lexical t) |
| 3282 | (indirect-variable var)) | 3285 | (display-warning :warning |
| 3283 | val) result) | 3286 | "Specify `lexical-binding' on the first line, not at the end"))) |
| 3284 | (error nil))))) | 3287 | (t |
| 3288 | (ignore-errors | ||
| 3289 | (push (cons (if (eq var 'eval) | ||
| 3290 | 'eval | ||
| 3291 | (indirect-variable var)) | ||
| 3292 | val) result)))))) | ||
| 3285 | (forward-line 1)))))))) | 3293 | (forward-line 1)))))))) |
| 3286 | ;; Now we've read all the local variables. | 3294 | ;; Now we've read all the local variables. |
| 3287 | ;; If MODE-ONLY is non-nil, return whether the mode was specified. | 3295 | ;; If MODE-ONLY is non-nil, return whether the mode was specified. |