emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog emacs-lisp/bytecomp.el


From: Stefan Monnier
Subject: [Emacs-diffs] emacs/lisp ChangeLog emacs-lisp/bytecomp.el
Date: Fri, 27 Nov 2009 22:03:07 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/11/27 22:03:07

Modified files:
        lisp           : ChangeLog 
        lisp/emacs-lisp: bytecomp.el 

Log message:
        (byte-compile-warning-types): New type `suspicious'.
        (byte-compile-warnings): Use byte-compile-warning-types.
        (byte-compile-save-excursion): Warn about use of set-buffer right
        after save-excursion.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16757&r2=1.16758
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/emacs-lisp/bytecomp.el?cvsroot=emacs&r1=2.274&r2=2.275

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16757
retrieving revision 1.16758
diff -u -b -r1.16757 -r1.16758
--- ChangeLog   27 Nov 2009 19:31:57 -0000      1.16757
+++ ChangeLog   27 Nov 2009 22:03:04 -0000      1.16758
@@ -1,5 +1,11 @@
 2009-11-27  Stefan Monnier  <address@hidden>
 
+       * emacs-lisp/bytecomp.el (byte-compile-warning-types): New type
+       `suspicious'.
+       (byte-compile-warnings): Use byte-compile-warning-types.
+       (byte-compile-save-excursion): Warn about use of set-buffer right
+       after save-excursion.
+
        * progmodes/gud.el (gud-basic-call): Don't only save the buffer but
        the excursion as well.
 

Index: emacs-lisp/bytecomp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/bytecomp.el,v
retrieving revision 2.274
retrieving revision 2.275
diff -u -b -r2.274 -r2.275
--- emacs-lisp/bytecomp.el      16 Nov 2009 04:05:51 -0000      2.274
+++ emacs-lisp/bytecomp.el      27 Nov 2009 22:03:06 -0000      2.275
@@ -263,7 +263,7 @@
 (defconst byte-compile-warning-types
   '(redefine callargs free-vars unresolved
             obsolete noruntime cl-functions interactive-only
-            make-local mapcar constants)
+            make-local mapcar constants suspicious)
   "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).
@@ -285,17 +285,15 @@
   make-local  calls to make-variable-buffer-local that may be incorrect.
   mapcar      mapcar called for effect.
   constants   let-binding of, or assignment to, constants/nonvariables.
+  suspicious  constructs that usually don't do what the coder wanted.
 
 If the list begins with `not', then the remaining elements specify warnings to
 suppress.  For example, (not mapcar) will suppress warnings about mapcar."
   :group 'bytecomp
   :type `(choice (const :tag "All" t)
                 (set :menu-tag "Some"
-                     (const free-vars) (const unresolved)
-                     (const callargs) (const redefine)
-                     (const obsolete) (const noruntime)
-                     (const cl-functions) (const interactive-only)
-                     (const make-local) (const mapcar) (const constants))))
+                      ,@(mapcar (lambda (x) `(const ,x))
+                                byte-compile-warning-types))))
 ;;;###autoload(put 'byte-compile-warnings 'safe-local-variable 
'byte-compile-warnings-safe-p)
 
 ;;;###autoload
@@ -3714,6 +3712,9 @@
 
 
 (defun byte-compile-save-excursion (form)
+  (if (and (eq 'set-buffer (car-safe (car-safe (cdr form))))
+           (byte-compile-warning-enabled-p 'suspicious))
+      (byte-compile-warn "`save-excursion' defeated by `set-buffer'."))
   (byte-compile-out 'byte-save-excursion 0)
   (byte-compile-body-do-effect (cdr form))
   (byte-compile-out 'byte-unbind 1))




reply via email to

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