(cons tempfile target-file))
(rename-file tempfile target-file t)))))
+(defvar bytecomp--inhibit-lexical-cookie-warning nil)
+
;;;###autoload
(defun byte-compile-file (filename &optional load)
"Compile a file of Lisp code named FILENAME into a file of byte code.
(setq buffer-read-only nil
filename buffer-file-name))
;; Don't inherit lexical-binding from caller (bug#12938).
- (unless (local-variable-p 'lexical-binding)
+ (unless (or (local-variable-p 'lexical-binding)
+ bytecomp--inhibit-lexical-cookie-warning)
(let ((byte-compile-current-buffer (current-buffer)))
(displaying-byte-compile-warnings
(byte-compile-warn-x
(dolist (path x t) (unless (stringp path)
(throw 'tag nil)))))))
+(defvar bytecomp--inhibit-lexical-cookie-warning)
+
;;;###autoload
(defun elisp-flymake-byte-compile (report-fn &rest _args)
"A Flymake backend for elisp byte compilation.
(save-restriction
(widen)
(write-region (point-min) (point-max) temp-file nil 'nomessage))
- (let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*")))
+ (let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*"))
+ ;; Hack: suppress warning about missing lexical cookie in
+ ;; *scratch* buffers.
+ (warning-suppression-opt
+ (and (derived-mode-p 'lisp-interaction-mode)
+ '("--eval"
+ "(setq bytecomp--inhibit-lexical-cookie-warning t)"))))
(setq
elisp-flymake--byte-compile-process
(make-process
;; "--eval" "(setq load-prefer-newer t)" ; for testing
,@(mapcan (lambda (path) (list "-L" path))
elisp-flymake-byte-compile-load-path)
+ ,@warning-suppression-opt
"-f" "elisp-flymake--batch-compile-for-flymake"
,temp-file)
:connection-type 'pipe