[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r114678: * files.el (hack-local-variables): Warn abo
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] trunk r114678: * files.el (hack-local-variables): Warn about misplaced lexical-binding. |
Date: |
Wed, 16 Oct 2013 01:33:23 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 114678
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15616
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2013-10-15 18:33:16 -0700
message:
* files.el (hack-local-variables): Warn about misplaced lexical-binding.
(hack-local-variables--warned-lexical): New.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/files.el files.el-20091113204419-o5vbwnq5f7feedwu-265
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-10-16 01:30:55 +0000
+++ b/lisp/ChangeLog 2013-10-16 01:33:16 +0000
@@ -1,5 +1,9 @@
2013-10-16 Glenn Morris <address@hidden>
+ * 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,
and update header line. (Bug#15622)
(eww-display-html): ... Rather than just doing it here.
=== modified file 'lisp/files.el'
--- a/lisp/files.el 2013-09-22 12:23:20 +0000
+++ b/lisp/files.el 2013-10-16 01:33:16 +0000
@@ -3154,6 +3154,9 @@
(assq-delete-all (car 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)
"Parse and put into effect this buffer's local variables spec.
Uses `hack-local-variables-apply' to apply the variables.
@@ -3275,13 +3278,18 @@
"-minor\\'"
(setq val2 (downcase (symbol-name val)))))
(setq result (intern (concat val2 "-mode"))))
- (unless (eq var 'coding)
- (condition-case nil
- (push (cons (if (eq var 'eval)
- 'eval
- (indirect-variable var))
- val) result)
- (error nil)))))
+ (cond ((eq var 'coding))
+ ((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)
+ 'eval
+ (indirect-variable var))
+ val) result))))))
(forward-line 1))))))))
;; Now we've read all the local variables.
;; If MODE-ONLY is non-nil, return whether the mode was specified.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r114678: * files.el (hack-local-variables): Warn about misplaced lexical-binding.,
Glenn Morris <=