summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-04-26 18:40:09 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2021-04-26 18:40:09 -0400
commit7f03ee8de15df31e57fd86e193901a1cf70cc49d (patch)
treef1903f6d257703d181d57d5022031a7d8c19da4f /lisp/emacs-lisp
parent40c71e574ad27deee003a0850a40171750234d59 (diff)
downloademacs-7f03ee8de15df31e57fd86e193901a1cf70cc49d.tar.gz
emacs-7f03ee8de15df31e57fd86e193901a1cf70cc49d.tar.bz2
emacs-7f03ee8de15df31e57fd86e193901a1cf70cc49d.zip
* lisp/emacs-lisp/package.el: Fix use of `find-library-name`
That function caused a warning for a good reason. Don't just declare it and hope it will be available. (package--list-of-conflicts): Require `find-func` explicitly before declaring the function. Also don't ignore all errors but only the `file-error`s which will be emitted by `find-library-name` in normal circumstances. * lisp/emacs-lisp/find-func.el (find-library-name): Signal a `file-error` Instead of a generic `error`.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/find-func.el2
-rw-r--r--lisp/emacs-lisp/package.el32
2 files changed, 17 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index a0d859b834d..58876a45e19 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -208,7 +208,7 @@ LIBRARY should be a string (the name of the library)."
(or find-function-source-path load-path)
load-file-rep-suffixes)))))
(find-library--from-load-history library)
- (error "Can't find library %s" library)))
+ (signal 'file-error (list "Can't find library" library))))
(defun find-library--from-load-history (library)
;; In `load-history', the file may be ".elc", ".el", ".el.gz", and
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 1ce2940b291..503585079e4 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -835,8 +835,6 @@ correspond to previously loaded files (those returned by
;; Don't return nil.
t)))
-(declare-function find-library-name "find-func" (library))
-
(defun package--files-load-history ()
(delq nil
(mapcar (lambda (x)
@@ -846,20 +844,22 @@ correspond to previously loaded files (those returned by
load-history)))
(defun package--list-of-conflicts (dir history)
- (delq
- nil
- (mapcar
- (lambda (x) (let* ((file (file-relative-name x dir))
- ;; Previously loaded file, if any.
- (previous
- (ignore-errors
- (file-name-sans-extension
- (file-truename (find-library-name file)))))
- (pos (when previous (member previous history))))
- ;; Return (RELATIVE-FILENAME . HISTORY-POSITION)
- (when pos
- (cons (file-name-sans-extension file) (length pos)))))
- (directory-files-recursively dir "\\`[^\\.].*\\.el\\'"))))
+ (require 'find-func)
+ (declare-function find-library-name "find-func" (library))
+ (delq
+ nil
+ (mapcar
+ (lambda (x) (let* ((file (file-relative-name x dir))
+ ;; Previously loaded file, if any.
+ (previous
+ (ignore-error file-error ;"Can't find library"
+ (file-name-sans-extension
+ (file-truename (find-library-name file)))))
+ (pos (when previous (member previous history))))
+ ;; Return (RELATIVE-FILENAME . HISTORY-POSITION)
+ (when pos
+ (cons (file-name-sans-extension file) (length pos)))))
+ (directory-files-recursively dir "\\`[^\\.].*\\.el\\'"))))
(defun package--list-loaded-files (dir)
"Recursively list all files in DIR which correspond to loaded features.