From: Pip Cet Date: Thu, 15 Aug 2024 16:28:07 +0000 (+0000) Subject: * lisp/files.el (require-with-check): Improve error messages. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=215331fc15716703b859763d8fdc0def8cb80e9d;p=emacs.git * lisp/files.el (require-with-check): Improve error messages. (cherry picked from commit 45a78ec6c57ab7d88846a143f81087d5575d0422) --- diff --git a/lisp/files.el b/lisp/files.el index 113da6b6be3..aa58a40253e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1286,9 +1286,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)