From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 74040@debbugs.gnu.org
Subject: bug#74040: `require-with-check` signals error for `project`
Date: Sun, 27 Oct 2024 12:43:27 -0400 [thread overview]
Message-ID: <jwvy129o5xv.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <jwv4j4xpl8j.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 27 Oct 2024 12:25:53 -0400")
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
> One approach is to expose the `prefer` option of `openp` to
> `locate-file` so we can use it in `require-with-check`, as in the
> patch below.
Another is to replace the `assoc` check with one that is more lenient,
ignoring difference in file extensions. E.g. the patch below.
This makes the change more localized, at the cost of making
`require-with-check` slower and less strict.
WDYT?
Stefan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: require-with-check.patch --]
[-- Type: text/x-diff, Size: 1293 bytes --]
diff --git a/lisp/files.el b/lisp/files.el
index a81f742bbb4..a5177250f45 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1277,10 +1280,19 @@ require-with-check
;; file, so we're done.
(when (eq lh load-history)
;; If `require' did nothing, we need to make sure that was warranted.
- (let ((fn (locate-file (or filename (symbol-name feature))
- load-path (get-load-suffixes))))
+ (let* ((fn (locate-file (or filename (symbol-name feature))
+ load-path (get-load-suffixes) nil
+ )) ;; load-prefer-newer
+ (fn (if (string-match
+ (concat (regexp-opt (get-load-suffixes)) "\\'") fn)
+ (concat (substring fn 0 (match-end 0)) ".")
+ fn))
+ (lh load-history))
+ (while (and lh (let ((file (car-safe (car lh))))
+ (not (and file (string-prefix-p fn file)))))
+ (setq lh (cdr lh)))
(cond
- ((assoc fn load-history) nil) ;We loaded the right file.
+ (lh nil) ;We loaded the right file.
((eq noerror 'reload) (load fn nil 'nomessage))
((and fn (memq feature features))
(funcall (if noerror #'warn #'error)
next prev parent reply other threads:[~2024-10-27 16:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-27 3:15 bug#74040: `require-with-check` signals error for `project` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 16:25 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 16:43 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-10-27 21:24 ` Stefan Kangas
2024-10-29 2:42 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvy129o5xv.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=74040@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).