emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-30 b585826a65e: ; * lisp/files.el (require-with-check): Fix do


From: Eli Zaretskii
Subject: Re: emacs-30 b585826a65e: ; * lisp/files.el (require-with-check): Fix doc string and error text.
Date: Tue, 13 Aug 2024 20:47:12 +0300

> Date: Tue, 13 Aug 2024 17:28:09 +0000
> From: Pip Cet <pipcet@protonmail.com>
> Cc: emacs-devel@gnu.org, monnier@iro.umontreal.ca
> 
> "Eli Zaretskii" <eliz@gnu.org> writes:
> 
> > I'm not sure I see any direction here towards improving the
> > diagnostic.  Did you mean to suggest something concrete?
> 
> How about just saying what we know, that loading the file failed to
> provide the feature, for whatever reason?  Alternatively, we can keep
> your message, like this, but restrict it to when we (almost) know it's
> accurate.
> 
> diff --git a/lisp/files.el b/lisp/files.el
> index eadb4a9d0b1..629e7841af4 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -1274,9 +1274,14 @@ require-with-check
>          (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))
> +         ((funcall (if noerror #'warn #'error)
> +                   "Could not load file %s to provide feature `%S'"
> +                   (or filename (symbol-name feature))
> +                   feature)))))

The second message is not accurate, AFAIU.  If NOEROR is equal to
'reload', and the file for FEATURE could not be found,
require-with-check will signal an error from here:

  (let ((lh load-history)
        (res (require feature filename (if (eq noerror 'reload) nil noerror))))

Also, if FILENAME was found, but it doesn't provide FEATURE, the
message text again doesn't provide accurate diagnostic.

So I think we need 3 different messages, not 2.



reply via email to

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