From 4f1e996048a90f1177a98e7856b3250f04399e83 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 15 Sep 2010 17:30:43 +0200 Subject: * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types): New type `lexical' for warnings related to lexical scoping. (byte-compile-file-form-defvar, byte-compile-defvar): Warn about global vars which don't have a prefix and could hence affect lexical scoping in unrelated files. --- lisp/emacs-lisp/bytecomp.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 8b47e0421e0..cf12847d093 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -265,7 +265,7 @@ If it is 'byte, then only byte-level optimizations will be logged." (defconst byte-compile-warning-types '(redefine callargs free-vars unresolved obsolete noruntime cl-functions interactive-only - make-local mapcar constants suspicious) + make-local mapcar constants suspicious lexical) "The list of warning types used when `byte-compile-warnings' is t.") (defcustom byte-compile-warnings t "List of warnings that the byte-compiler should issue (t for all). @@ -2153,6 +2153,11 @@ list that represents a doc string reference. ;; Since there is no doc string, we can compile this as a normal form, ;; and not do a file-boundary. (byte-compile-keep-pending form) + (when (and (symbolp (nth 1 form)) + (not (string-match "[-*:$]" (symbol-name (nth 1 form)))) + (byte-compile-warning-enabled-p 'lexical)) + (byte-compile-warn "Global/dynamic var `%s' lacks a prefix" + (nth 1 form))) (push (nth 1 form) byte-compile-bound-variables) (if (eq (car form) 'defconst) (push (nth 1 form) byte-compile-const-variables)) @@ -3804,6 +3809,11 @@ that suppresses all warnings during execution of BODY." (defun byte-compile-defvar (form) ;; This is not used for file-level defvar/consts with doc strings. + (when (and (symbolp (nth 1 form)) + (not (string-match "[-*:$]" (symbol-name (nth 1 form)))) + (byte-compile-warning-enabled-p 'lexical)) + (byte-compile-warn "Global/dynamic var `%s' lacks a prefix" + (nth 1 form))) (let ((fun (nth 0 form)) (var (nth 1 form)) (value (nth 2 form)) -- cgit v1.2.3 From 3fe6ef4e36bf853b4b99c2520c9bf066023329e0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 17 Sep 2010 16:31:06 +0200 Subject: * lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defvar) (byte-compile-defvar): "foo/bar" does not lack a prefix. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/bytecomp.el | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e1aeae2e17a..8ced74de42a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-09-17 Stefan Monnier + * emacs-lisp/bytecomp.el (byte-compile-file-form-defvar) + (byte-compile-defvar): "foo/bar" does not lack a prefix. + * subr.el (y-or-n-p): Add the "(y or n)" that was lost somehow. 2010-09-17 Stephen Berman diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index cf12847d093..aca3a54d14f 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2154,7 +2154,7 @@ list that represents a doc string reference. ;; and not do a file-boundary. (byte-compile-keep-pending form) (when (and (symbolp (nth 1 form)) - (not (string-match "[-*:$]" (symbol-name (nth 1 form)))) + (not (string-match "[-*/:$]" (symbol-name (nth 1 form)))) (byte-compile-warning-enabled-p 'lexical)) (byte-compile-warn "Global/dynamic var `%s' lacks a prefix" (nth 1 form))) @@ -3810,7 +3810,7 @@ that suppresses all warnings during execution of BODY." (defun byte-compile-defvar (form) ;; This is not used for file-level defvar/consts with doc strings. (when (and (symbolp (nth 1 form)) - (not (string-match "[-*:$]" (symbol-name (nth 1 form)))) + (not (string-match "[-*/:$]" (symbol-name (nth 1 form)))) (byte-compile-warning-enabled-p 'lexical)) (byte-compile-warn "Global/dynamic var `%s' lacks a prefix" (nth 1 form))) -- cgit v1.2.3 From 7a16788be4efbd68b44db1507d963377c96b07ee Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 23 Sep 2010 00:55:01 -0700 Subject: Trivial bytecomp.el change. * lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defvar): (byte-compile-defvar, byte-compile-cl-warn): Start warnings with lower-case, like the majority. --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/bytecomp.el | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f34e5035a42..36775118554 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2010-09-23 Glenn Morris + * emacs-lisp/bytecomp.el (byte-compile-file-form-defvar): + (byte-compile-defvar, byte-compile-cl-warn): + Start warnings with lower-case, like the majority. + * files.el (auto-mode-alist): Add .xa, .xw, .xsw for ld-script-mode. * files.el (auto-mode-alist): Prefer C-mode for .xs. (Bug#7071) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index aca3a54d14f..e6ca7f66546 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1343,7 +1343,7 @@ extra args." (not (and (eq (get func 'byte-compile) 'cl-byte-compile-compiler-macro) (string-match "\\`c[ad]+r\\'" (symbol-name func))))) - (byte-compile-warn "Function `%s' from cl package called at runtime" + (byte-compile-warn "function `%s' from cl package called at runtime" func))) form) @@ -2156,7 +2156,7 @@ list that represents a doc string reference. (when (and (symbolp (nth 1 form)) (not (string-match "[-*/:$]" (symbol-name (nth 1 form)))) (byte-compile-warning-enabled-p 'lexical)) - (byte-compile-warn "Global/dynamic var `%s' lacks a prefix" + (byte-compile-warn "global/dynamic var `%s' lacks a prefix" (nth 1 form))) (push (nth 1 form) byte-compile-bound-variables) (if (eq (car form) 'defconst) @@ -3812,7 +3812,7 @@ that suppresses all warnings during execution of BODY." (when (and (symbolp (nth 1 form)) (not (string-match "[-*/:$]" (symbol-name (nth 1 form)))) (byte-compile-warning-enabled-p 'lexical)) - (byte-compile-warn "Global/dynamic var `%s' lacks a prefix" + (byte-compile-warn "global/dynamic var `%s' lacks a prefix" (nth 1 form))) (let ((fun (nth 0 form)) (var (nth 1 form)) -- cgit v1.2.3