diff options
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 197df3b8815..db200f3c504 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -397,7 +397,7 @@ invoked interactively are excluded from this list." "Alist of functions and their call tree. Each element looks like - \(FUNCTION CALLERS CALLS\) + (FUNCTION CALLERS CALLS) where CALLERS is a list of functions that call FUNCTION, and CALLS is a list of functions for which calls were generated while compiling @@ -973,7 +973,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (print-level 4) (print-length 4)) (byte-compile-log-1 - (format + (format-message ,format-string ,@(mapcar (lambda (x) (if (symbolp x) (list 'prin1-to-string x) x)) @@ -1120,7 +1120,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." pt) (when dir (unless was-same - (insert (format "Leaving directory `%s'\n" default-directory)))) + (insert (format-message "Leaving directory `%s'\n" + default-directory)))) (unless (bolp) (insert "\n")) (setq pt (point-marker)) @@ -1135,8 +1136,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (when dir (setq default-directory dir) (unless was-same - (insert (format "Entering directory `%s'\n" - default-directory)))) + (insert (format-message "Entering directory `%s'\n" + default-directory)))) (setq byte-compile-last-logged-file byte-compile-current-file byte-compile-last-warned-form nil) ;; Do this after setting default-directory. @@ -1154,7 +1155,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (defun byte-compile-warn (format &rest args) "Issue a byte compiler warning; use (format FORMAT ARGS...) for message." - (setq format (apply 'format format args)) + (setq format (apply #'format-message format args)) (if byte-compile-error-on-warn (error "%s" format) ; byte-compile-file catches and logs it (byte-compile-log-warning format t :warning))) @@ -1900,7 +1901,10 @@ With argument ARG, insert value in current buffer after the form." (let ((read-with-symbol-positions (current-buffer)) (read-symbol-positions-list nil)) (displaying-byte-compile-warnings - (byte-compile-sexp (read (current-buffer))))) + (byte-compile-sexp + (eval-sexp-add-defvars + (read (current-buffer)) + byte-compile-read-position)))) lexical-binding))) (cond (arg (message "Compiling from buffer... done.") @@ -2584,7 +2588,9 @@ If FORM is a lambda or a macro, byte-compile it as a function." (if (symbolp form) form "provided")) fun) (t - (when (symbolp form) + (when (or (symbolp form) (eq (car-safe fun) 'closure)) + ;; `fun' is a function *value*, so try to recover its corresponding + ;; source code. (setq lexical-binding (eq (car fun) 'closure)) (setq fun (byte-compile--reify-function fun))) ;; Expand macros. @@ -2979,7 +2985,7 @@ for symbols generated by the byte compiler itself." (`(',var . ,_) (when (assq var byte-compile-lexical-variables) (byte-compile-log-warning - (format "%s cannot use lexical var `%s'" fn var) + (format-message "%s cannot use lexical var `%s'" fn var) nil :error))))) (when (macroexp--const-symbol-p fn) (byte-compile-warn "`%s' called as a function" fn)) @@ -2988,11 +2994,13 @@ for symbols generated by the byte compiler itself." (byte-compile-warn "`%s' is for interactive use only%s" fn (cond ((stringp interactive-only) - (format "; %s" interactive-only)) + (format "; %s" + (substitute-command-keys + interactive-only))) ((and (symbolp 'interactive-only) (not (eq interactive-only t))) - (format "; use `%s' instead." - interactive-only)) + (format-message "; use `%s' instead." + interactive-only)) (t ".")))) (if (eq (car-safe (symbol-function (car form))) 'macro) (byte-compile-log-warning @@ -3124,7 +3132,7 @@ for symbols generated by the byte compiler itself." (cond ((or (not (symbolp var)) (macroexp--const-symbol-p var)) (when (byte-compile-warning-enabled-p 'constants) (byte-compile-warn (if (eq access-type 'let-bind) - "attempt to let-bind %s `%s`" + "attempt to let-bind %s `%s'" "variable reference to %s `%s'") (if (symbolp var) "constant" "nonvariable") (prin1-to-string var)))) @@ -3612,8 +3620,8 @@ discarding." (defun byte-compile-quo (form) (let ((len (length form))) - (cond ((<= len 2) - (byte-compile-subr-wrong-args form "2 or more")) + (cond ((< len 2) + (byte-compile-subr-wrong-args form "1 or more")) ((= len 3) (byte-compile-two-args form)) (t @@ -3824,11 +3832,11 @@ discarding." "Execute forms in BODY, potentially guarded by CONDITION. CONDITION is a variable whose value is a test in an `if' or `cond'. BODY is the code to compile in the first arm of the if or the body of -the cond clause. If CONDITION's value is of the form (fboundp 'foo) -or (boundp 'foo), the relevant warnings from BODY about foo's +the cond clause. If CONDITION's value is of the form (fboundp \\='foo) +or (boundp \\='foo), the relevant warnings from BODY about foo's being undefined (or obsolete) will be suppressed. -If CONDITION's value is (not (featurep 'emacs)) or (featurep 'xemacs), +If CONDITION's value is (not (featurep \\='emacs)) or (featurep \\='xemacs), that suppresses all warnings during execution of BODY." (declare (indent 1) (debug t)) `(let* ((fbound-list (byte-compile-find-bound-condition @@ -4524,11 +4532,11 @@ whose definitions have been compiled in this Emacs session, as well as all functions called by those functions. The call graph does not include macros, inline functions, or -primitives that the byte-code interpreter knows about directly \(eq, -cons, etc.\). +primitives that the byte-code interpreter knows about directly +\(`eq', `cons', etc.). The call tree also lists those functions which are not known to be called -\(that is, to which no calls have been compiled\), and which cannot be +\(that is, to which no calls have been compiled), and which cannot be invoked interactively." (interactive) (message "Generating call tree...") |