From: Andrea Corallo Date: Fri, 26 Feb 2021 18:54:59 +0000 (+0100) Subject: Merge remote-tracking branch 'savannah/master' into native-comp X-Git-Tag: emacs-28.0.90~2727^2~118 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5c922cc3a4b0677805a678267df2b7598e92bb83;p=emacs.git Merge remote-tracking branch 'savannah/master' into native-comp --- 5c922cc3a4b0677805a678267df2b7598e92bb83 diff --cc lisp/emacs-lisp/bytecomp.el index 25e1920cb90,7aae8c0c6a4..4169b0756df --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@@ -1776,12 -1727,13 +1776,17 @@@ It is too wide if it has any lines long ;; (byte-compile-generate-emacs19-bytecodes ;; byte-compile-generate-emacs19-bytecodes) (byte-compile-warnings byte-compile-warnings) + ;; Indicate that we're not currently loading some file. + ;; This is used in `macroexp-file-name' to make sure that + ;; loading file A which does (byte-compile-file B) won't + ;; cause macro calls in B to think they come from A. + (current-load-list (list nil)) ) - ,@body)) + (prog1 + (progn ,@body) + (when byte-native-compiling + (setq byte-to-native-plist-environment + overriding-plist-environment))))) (defmacro displaying-byte-compile-warnings (&rest body) (declare (debug t)) diff --cc lisp/emacs-lisp/cl-macs.el index 709085a6d9e,b852d825c76..0184fd57e25 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@@ -2455,15 -2455,7 +2455,15 @@@ values. For compatibility, (cl-values (defmacro cl-the (type form) "Return FORM. If type-checking is enabled, assert that it is of TYPE." (declare (indent 1) (debug (cl-type-spec form))) + ;; When native compiling possibly add the appropriate type hint. + (when (and (boundp 'byte-native-compiling) + byte-native-compiling) + (setf form + (cl-case type + (fixnum `(comp-hint-fixnum ,form)) + (cons `(comp-hint-cons ,form)) + (otherwise form)))) - (if (not (or (not (cl--compiling-file)) + (if (not (or (not (macroexp-compiling-p)) (< cl--optimize-speed 3) (= cl--optimize-safety 3))) form diff --cc lisp/progmodes/elisp-mode.el index 2dd2702acb7,20c7f20d040..408da8a9628 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@@ -194,13 -195,8 +194,13 @@@ All commands in `lisp-mode-shared-map' ;; Recompile if file or buffer has changed since last compilation. (if (and (buffer-modified-p) (y-or-n-p (format "Save buffer %s first? " (buffer-name)))) - (save-buffer)) + (save-buffer))) + +(defun emacs-lisp-byte-compile-and-load () + "Byte-compile the current file (if it has changed), then load compiled code." - (interactive) ++ (interactive nil emacs-lisp-mode) + (emacs-lisp--before-compile-buffer) + (require 'bytecomp) (byte-recompile-file buffer-file-name nil 0) (load buffer-file-name))