Add aid for finding missing dynamic variable declarations
Find lexical use of variables that are dynamically declared in other files by recording 'defvar' declarations in files that can be read in by the compiler in a second compilation. This is particularly useful when converting code to use lexical-binding. The facility is controlled by setting environment variables: EMACS_GENERATE_DYNVARS -- set to non-empty to generate a .dynvars file corresponding to each .elc. EMACS_DYNVARS_FILE -- set to the name of a .dynvars file to use as defvar information during compilation, enabling the new warnings. * lisp/emacs-lisp/bytecomp.el (byte-compile--known-dynamic-vars) (byte-compile--seen-defvars): New variables. (byte-compile-warning-types): Add lexical-dynamic warning. (byte-compile--load-dynvars, byte-compile--warn-lexical-dynamic): New functions. * lisp/emacs-lisp/bytecomp.el (byte-compile-file, byte-compile--declare-var) (byte-compile-lambda, byte-compile-bind): Add dynamic variable loads, dumps and checks. * doc/lispref/variables.texi (Converting to Lexical Binding): Document.
master in 68 minutes and 39 seconds (queued for 8 seconds)1 job for