Skip to content

Commit 7300503

Browse files
committed
elpaca-generate-autoloads: fail gracefully when build dir empty
This can occur when the recipe's :files conflict with the structure of the repository. e.g. Attempting to use an inherited :files spec which assumes a different repo layout. Previously, loaddefs-generate would be passed a nil DIR arg, which would signal an vague error. Note this change does not affect Emacs < version 29.
1 parent d9f173a commit 7300503

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

elpaca.el

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,14 +1357,13 @@ This is the branch that would be checked out upon cloning."
13571357
(write-file-functions nil)
13581358
(left-margin 0)) ; Prevent spurious parens in autoloads.
13591359
(cond
1360-
((fboundp 'loaddefs-generate)
1361-
(loaddefs-generate
1362-
(cl-loop with seen
1363-
for file in (elpaca--directory-files-recursively dir "\\.el$")
1364-
for d = (file-name-directory file)
1365-
unless (member d seen)
1366-
collect d do (push d seen))
1367-
output nil nil nil t)) ;; Emacs 29
1360+
((fboundp 'loaddefs-generate) ;; Emacs 29+
1361+
(cl-loop with seen
1362+
for file in (elpaca--directory-files-recursively dir "\\.el\\'")
1363+
for d = (file-name-directory file)
1364+
unless (member d seen) collect d into dirs do (push d seen)
1365+
finally do (if (null dirs) (error "No elisp files in %s" dir)
1366+
(loaddefs-generate dirs output nil nil nil t))))
13681367
((fboundp 'make-directory-autoloads) (make-directory-autoloads dir output))
13691368
((fboundp 'update-directory-autoloads) ;; Compatibility for Emacs < 28.1
13701369
(with-no-warnings (update-directory-autoloads dir))))

0 commit comments

Comments
 (0)