emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master e6f2f5a 1/2: Make do-after-load-evaluation check wh


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master e6f2f5a 1/2: Make do-after-load-evaluation check whether warnings are enabled.
Date: Mon, 17 Jun 2019 06:37:20 -0400 (EDT)

branch: master
commit e6f2f5ace17fa752194f94f6762d3684d0d5b40a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Make do-after-load-evaluation check whether warnings are enabled.
    
    * lisp/subr.el (do-after-load-evaluation): Heed
    `byte-compile-warning-enabled-p', if defined.  This allows
    suppressing the warning about packages being obsolete.
---
 lisp/subr.el | 39 +++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index d505eb3..66568b7 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4442,25 +4442,28 @@ This function is called directly from the C code."
   (when (string-match-p "/obsolete/\\([^/]*\\)\\'" abs-file)
     ;; Maybe we should just use display-warning?  This seems yucky...
     (let* ((file (file-name-nondirectory abs-file))
-          (msg (format "Package %s is obsolete!"
-                       (substring file 0
-                                  (string-match "\\.elc?\\>" file)))))
+           (package (intern (substring file 0
+                                      (string-match "\\.elc?\\>" file))
+                            obarray))
+          (msg (format "Package %s is obsolete" package)))
       ;; Cribbed from cl--compiling-file.
-      (if (and (boundp 'byte-compile--outbuffer)
-              (bufferp (symbol-value 'byte-compile--outbuffer))
-              (equal (buffer-name (symbol-value 'byte-compile--outbuffer))
-                     " *Compiler Output*"))
-         ;; Don't warn about obsolete files using other obsolete files.
-         (unless (and (stringp byte-compile-current-file)
-                      (string-match-p "/obsolete/[^/]*\\'"
-                                      (expand-file-name
-                                       byte-compile-current-file
-                                       byte-compile-root-dir)))
-           (byte-compile-warn "%s" msg))
-       (run-with-timer 0 nil
-                       (lambda (msg)
-                         (message "%s" msg))
-                        msg))))
+      (when (or (not (fboundp 'byte-compile-warning-enabled-p))
+                (byte-compile-warning-enabled-p 'obsolete package))
+        (if (and (boundp 'byte-compile--outbuffer)
+                (bufferp (symbol-value 'byte-compile--outbuffer))
+                (equal (buffer-name (symbol-value 'byte-compile--outbuffer))
+                       " *Compiler Output*"))
+           ;; Don't warn about obsolete files using other obsolete files.
+           (unless (and (stringp byte-compile-current-file)
+                        (string-match-p "/obsolete/[^/]*\\'"
+                                        (expand-file-name
+                                         byte-compile-current-file
+                                         byte-compile-root-dir)))
+             (byte-compile-warn "%s" msg))
+         (run-with-timer 0 nil
+                         (lambda (msg)
+                           (message "%s" msg))
+                          msg)))))
 
   ;; Finally, run any other hook.
   (run-hook-with-args 'after-load-functions abs-file))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]