GNU bug report logs -
#74040
`require-with-check` signals error for `project`
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Sun, 27 Oct 2024 03:16:02 UTC
Severity: normal
Found in version 30.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 74040 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> 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
[require-with-check.patch (text/x-diff, inline)]
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)
This bug report was last modified 204 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.