summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMichael Heerdegen <michael_heerdegen@web.de>2020-04-10 01:21:33 +0200
committerMichael Heerdegen <michael_heerdegen@web.de>2020-04-30 20:50:33 +0200
commit0c899eede338e8e1e349ddcdaf88723569d48f8d (patch)
treef9b987d4481eaef7c6184b11d416f060d696b014 /lisp/emacs-lisp
parent691f19798a228f3d3cd031b9179311c5cf8394f5 (diff)
downloademacs-0c899eede338e8e1e349ddcdaf88723569d48f8d.tar.gz
emacs-0c899eede338e8e1e349ddcdaf88723569d48f8d.tar.bz2
emacs-0c899eede338e8e1e349ddcdaf88723569d48f8d.zip
Make `make-local-variable' declare the var locally dynamic
The only effect of this change is to get rid of some unnecessary "assignment to free variable" warnings. * lisp/emacs-lisp/bytecomp.el (byte-compile-make-local-variable): New function.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 13b72196565..72dbfd74b11 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -4752,6 +4752,14 @@ binding slots have been popped."
(defun byte-compile-form-make-variable-buffer-local (form)
(byte-compile-keep-pending form 'byte-compile-normal-call))
+;; Make `make-local-variable' declare the variable locally
+;; dynamic - this suppresses some unnecessary warnings
+(byte-defop-compiler-1 make-local-variable
+ byte-compile-make-local-variable)
+(defun byte-compile-make-local-variable (form)
+ (pcase form (`(,_ ',var) (byte-compile--declare-var var)))
+ (byte-compile-normal-call form))
+
(put 'function-put 'byte-hunk-handler 'byte-compile-define-symbol-prop)
(put 'define-symbol-prop 'byte-hunk-handler 'byte-compile-define-symbol-prop)
(defun byte-compile-define-symbol-prop (form)