emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101441: * lisp/emacs-lisp/bytecomp.e


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101441: * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types): New type
Date: Wed, 15 Sep 2010 17:30:43 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101441
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2010-09-15 17:30:43 +0200
message:
  * 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.
modified:
  .bzrignore
  lisp/ChangeLog
  lisp/emacs-lisp/bytecomp.el
=== modified file '.bzrignore'
--- a/.bzrignore        2010-08-30 20:34:52 +0000
+++ b/.bzrignore        2010-09-15 15:30:43 +0000
@@ -72,3 +72,4 @@
 src/stamp-oldxmenu
 src/temacs
 test/indent/*.new
++*

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-09-14 23:14:44 +0000
+++ b/lisp/ChangeLog    2010-09-15 15:30:43 +0000
@@ -1,3 +1,11 @@
+2010-09-15  Stefan Monnier  <address@hidden>
+
+       * 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.
+
 2010-09-14  Lars Magne Ingebrigtsen  <address@hidden>
 
        * net/imap.el: Revert back to version
@@ -106,8 +114,8 @@
        * Makefile.in (TRAMP_SRC): Remove tramp-fish.el.  Add tramp-sh.el.
 
        * net/tramp.el (top): Don't show loading message.  Require just
-       'tramp-compat, everything else is required there.  Use
-       `ignore-errors' where appropriate.
+       'tramp-compat, everything else is required there.
+       Use `ignore-errors' where appropriate.
        (tramp-inline-compress-start-size, tramp-copy-size-limit)
        (tramp-terminal-type, tramp-end-of-output)
        (tramp-initial-end-of-output, tramp-completion-function-alist-rsh)

=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el       2010-09-11 19:33:52 +0000
+++ b/lisp/emacs-lisp/bytecomp.el       2010-09-15 15:30:43 +0000
@@ -265,7 +265,7 @@
 (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 @@
       ;; 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 @@
 
 (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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]