From 01e4a4fa0349d23595f61f531fec66d8f3c11c65 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 29 Jul 2005 19:54:18 +0000 Subject: (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. --- lisp/emacs-lisp/bytecomp.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e21a7ccb4a0..6ccf65b1fd9 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3790,6 +3790,19 @@ that suppresses all warnings during execution of BODY." (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 -- cgit v1.2.3