summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2005-07-29 19:54:18 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2005-07-29 19:54:18 +0000
commit01e4a4fa0349d23595f61f531fec66d8f3c11c65 (patch)
treead1aded31b11d02f1e3f2347fa930156ad2b7af1 /lisp/emacs-lisp/bytecomp.el
parentd0278ce84522bdbc650e00e91137904e001b5de9 (diff)
downloademacs-01e4a4fa0349d23595f61f531fec66d8f3c11c65.tar.gz
(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.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el13
1 files changed, 13 insertions, 0 deletions
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