emacs-diffs
[Top][All Lists]
Advanced

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

emacs-30 45a78ec6c57: * lisp/files.el (require-with-check): Improve erro


From: Pip Cet
Subject: emacs-30 45a78ec6c57: * lisp/files.el (require-with-check): Improve error messages.
Date: Thu, 15 Aug 2024 12:32:45 -0400 (EDT)

branch: emacs-30
commit 45a78ec6c57ab7d88846a143f81087d5575d0422
Author: Pip Cet <pipcet@protonmail.com>
Commit: Pip Cet <pipcet@protonmail.com>

    * lisp/files.el (require-with-check): Improve error messages.
---
 lisp/files.el | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index eadb4a9d0b1..6cbb1b5c632 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1274,9 +1274,17 @@ NOERROR is equal to `reload'), or otherwise emit a 
warning."
         (cond
          ((assoc fn load-history) nil)  ;We loaded the right file.
          ((eq noerror 'reload) (load fn nil 'nomessage))
-         (t (funcall (if noerror #'warn #'error)
-                     "Feature `%S' is now provided by a different file %s"
-                     feature fn)))))
+         ((and fn (memq feature features))
+          (funcall (if noerror #'warn #'error)
+                   "Feature `%S' is now provided by a different file %s"
+                   feature fn))
+         (fn
+          (funcall (if noerror #'warn #'error)
+                   "Could not load file %s" fn))
+         (t
+          (funcall (if noerror #'warn #'error)
+                   "Could not locate file %s in load path"
+                   (or filename (symbol-name feature)))))))
     res))
 
 (defun file-remote-p (file &optional identification connected)



reply via email to

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