Skip to content

Commit

Permalink
[fu] exordium-require return the feature on success
Browse files Browse the repository at this point in the history
  • Loading branch information
pkryger committed Nov 16, 2024
1 parent e6ac3c8 commit 3a03166
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions modules/init-require.el
Original file line number Diff line number Diff line change
Expand Up @@ -239,33 +239,35 @@ Please see Commentary in init-require.el for more details."
;; eval.
`(,@(when (bound-and-true-p use-package-compute-statistics)
`((use-package-statistics-gather :config ,feature nil)))
(if (featurep ,feature)
,feature
(condition-case-unless-debug err
(unwind-protect
(if (< 3 (cl-count ,feature exordium--require-nesting-list))
(error
"Recursive `exordium-require' for feature `%s', require-nesting-list: %s"
,feature exordium--require-nesting-list)
(push ,feature exordium--require-nesting-list)
(exordium--require-load ,feature ,location)
(if (featurep ,feature)
,feature
(if-let* ((file (caar load-history)))
(error "Loading file %s failed to provide feature `%s'"
file ,feature)
(error "Required feature `%s' was not provided"
,feature))))
(when (eq ,feature (car exordium--require-nesting-list))
(pop exordium--require-nesting-list)))
(error
(display-warning 'exordium-require
(format "%s: %s"
,feature (error-message-string err))))))
,@(when (bound-and-true-p use-package-compute-statistics)
`((use-package-statistics-gather :config ,feature t)))
,@(when (bound-and-true-p use-package-compute-statistics)
`((use-package-statistics-gather :use-package ,feature t)))))))
(prog1
(if (featurep ,feature)
,feature
(condition-case-unless-debug err
(unwind-protect
(if (< 3 (cl-count ,feature exordium--require-nesting-list))
(error
"Recursive `exordium-require' for feature `%s', require-nesting-list: %s"
,feature exordium--require-nesting-list)
(push ,feature exordium--require-nesting-list)
(exordium--require-load ,feature ,location)
(if (featurep ,feature)
,feature
(if-let* ((file (caar load-history)))
(error "Loading file %s failed to provide feature `%s'"
file ,feature)
(error "Required feature `%s' was not provided"
,feature))))
(when (eq ,feature (car exordium--require-nesting-list))
(pop exordium--require-nesting-list)))
(error
(display-warning 'exordium-require
(format "%s: %s"
,feature (error-message-string err)))
nil)))
,@(when (bound-and-true-p use-package-compute-statistics)
`((use-package-statistics-gather :config ,feature t)))
,@(when (bound-and-true-p use-package-compute-statistics)
`((use-package-statistics-gather :use-package ,feature t))))))))

(provide 'init-require)

Expand Down

0 comments on commit 3a03166

Please sign in to comment.