aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2021-04-26 18:40:09 -0400
committerStefan Monnier2021-04-26 18:40:09 -0400
commit7f03ee8de15df31e57fd86e193901a1cf70cc49d (patch)
treef1903f6d257703d181d57d5022031a7d8c19da4f
parent40c71e574ad27deee003a0850a40171750234d59 (diff)
downloademacs-7f03ee8de15df31e57fd86e193901a1cf70cc49d.tar.gz
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`.
-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)."
208 (or find-function-source-path load-path) 208 (or find-function-source-path load-path)
209 load-file-rep-suffixes))))) 209 load-file-rep-suffixes)))))
210 (find-library--from-load-history library) 210 (find-library--from-load-history library)
211 (error "Can't find library %s" library))) 211 (signal 'file-error (list "Can't find library" library))))
212 212
213(defun find-library--from-load-history (library) 213(defun find-library--from-load-history (library)
214 ;; In `load-history', the file may be ".elc", ".el", ".el.gz", and 214 ;; 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
835 ;; Don't return nil. 835 ;; Don't return nil.
836 t))) 836 t)))
837 837
838(declare-function find-library-name "find-func" (library))
839
840(defun package--files-load-history () 838(defun package--files-load-history ()
841 (delq nil 839 (delq nil
842 (mapcar (lambda (x) 840 (mapcar (lambda (x)
@@ -846,20 +844,22 @@ correspond to previously loaded files (those returned by
846 load-history))) 844 load-history)))
847 845
848(defun package--list-of-conflicts (dir history) 846(defun package--list-of-conflicts (dir history)
849 (delq 847 (require 'find-func)
850 nil 848 (declare-function find-library-name "find-func" (library))
851 (mapcar 849 (delq
852 (lambda (x) (let* ((file (file-relative-name x dir)) 850 nil
853 ;; Previously loaded file, if any. 851 (mapcar
854 (previous 852 (lambda (x) (let* ((file (file-relative-name x dir))
855 (ignore-errors 853 ;; Previously loaded file, if any.
856 (file-name-sans-extension 854 (previous
857 (file-truename (find-library-name file))))) 855 (ignore-error file-error ;"Can't find library"
858 (pos (when previous (member previous history)))) 856 (file-name-sans-extension
859 ;; Return (RELATIVE-FILENAME . HISTORY-POSITION) 857 (file-truename (find-library-name file)))))
860 (when pos 858 (pos (when previous (member previous history))))
861 (cons (file-name-sans-extension file) (length pos))))) 859 ;; Return (RELATIVE-FILENAME . HISTORY-POSITION)
862 (directory-files-recursively dir "\\`[^\\.].*\\.el\\'")))) 860 (when pos
861 (cons (file-name-sans-extension file) (length pos)))))
862 (directory-files-recursively dir "\\`[^\\.].*\\.el\\'"))))
863 863
864(defun package--list-loaded-files (dir) 864(defun package--list-loaded-files (dir)
865 "Recursively list all files in DIR which correspond to loaded features. 865 "Recursively list all files in DIR which correspond to loaded features.