changeset 64681:12ea7ab25f7c

(byte-compile-make-variable-buffer-local) (byte-compile-form-make-variable-buffer-local): New functions to warn about misuses of make-variable-buffer-local where make-local-variable was meant.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 29 Jul 2005 19:54:18 +0000
parents 32b32ccdedc0
children ddfb3e6e7046
files lisp/ChangeLog lisp/emacs-lisp/bytecomp.el
diffstat 2 files changed, 25 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Jul 29 18:05:51 2005 +0000
+++ b/lisp/ChangeLog	Fri Jul 29 19:54:18 2005 +0000
@@ -1,3 +1,10 @@
+2005-07-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/bytecomp.el (byte-compile-make-variable-buffer-local)
+	(byte-compile-form-make-variable-buffer-local): New functions to warn
+	about misuses of make-variable-buffer-local where make-local-variable
+	was meant.
+
 2005-07-29  Juanma Barranquero  <lekktu@gmail.com>
 
 	* bs.el (bs-attributes-list): Doc fix.
@@ -21,8 +28,8 @@
 
 2005-07-29  Kenichi Handa  <handa@m17n.org>
 
-	* international/mule-cmds.el (select-message-coding-system): Be
-	sure to use LF for end-of-line.  If no coding system is decided,
+	* international/mule-cmds.el (select-message-coding-system):
+	Be sure to use LF for end-of-line.  If no coding system is decided,
 	return iso-8859-1-unix.
 
 2005-07-28  Stefan Monnier  <monnier@iro.umontreal.ca>
@@ -89,17 +96,15 @@
 
 	* term/README: Describe the terminal-init-* functionality.
 
-	* startup.el (command-line): After loading the terminal
-	initialization file call the corresponding terminal initialization
-	function.
+	* startup.el (command-line): After loading the terminal initialization
+	file call the corresponding terminal initialization function.
 
 2005-07-27  Kenichi Handa  <handa@m17n.org>
 
 	* ps-bdf.el (bdf-read-font-info): Ignore glyphs whose ENCODING is
 	negative.
 
-	* ps-mule.el (ps-mule-bitmap-prologue): Fix arguments to
-	setcharwidth.
+	* ps-mule.el (ps-mule-bitmap-prologue): Fix arguments to setcharwidth.
 	(ps-mule-composition-prologue): Fix for the case that
 	RelativeCompose is false.
 
--- a/lisp/emacs-lisp/bytecomp.el	Fri Jul 29 18:05:51 2005 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Fri Jul 29 19:54:18 2005 +0000
@@ -3790,6 +3790,19 @@
 (defun byte-compile-no-warnings (form)
   (let (byte-compile-warnings)
     (byte-compile-form (cons 'progn (cdr form)))))
+
+;; Warn about misuses of make-variable-buffer-local.
+(byte-defop-compiler-1 make-variable-buffer-local byte-compile-make-variable-buffer-local)
+(defun byte-compile-make-variable-buffer-local (form)
+  (if (eq (car-safe (car-safe (cdr-safe form))) 'quote)
+      (byte-compile-warn
+       "`make-variable-buffer-local' should be called at toplevel"))
+  (byte-compile-normal-call form))
+(put 'make-variable-buffer-local
+     'byte-hunk-handler 'byte-compile-form-make-variable-buffer-local)
+(defun byte-compile-form-make-variable-buffer-local (form)
+  (byte-compile-keep-pending form 'byte-compile-normal-call))
+
 
 ;;; tags