From 3b4c8d8915d469b0bfbb148820bca7a31dcd734a Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 15 May 2026 23:48:20 -0500 Subject: fix(ai-config): Ensure gptel-magit is installed via use-package Replace raw autoload calls with a `use-package` declaration so `use-package-always-ensure` installs gptel-magit on machines that haven't run `package-install`, fixing the "Cannot open load file" error on transient setup. --- tests/test-ai-config-gptel-magit-lazy-loading.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/test-ai-config-gptel-magit-lazy-loading.el') diff --git a/tests/test-ai-config-gptel-magit-lazy-loading.el b/tests/test-ai-config-gptel-magit-lazy-loading.el index 05e3634d..bc345ef0 100644 --- a/tests/test-ai-config-gptel-magit-lazy-loading.el +++ b/tests/test-ai-config-gptel-magit-lazy-loading.el @@ -123,5 +123,21 @@ a gptel-magit function is called." One for magit-commit (generate) and one for magit-diff (explain)." (should (= 2 (length test-gptel-magit--transient-calls)))) +;;; Error Cases — Install behavior + +(ert-deftest test-ai-config-gptel-magit-declared-via-use-package () + "ai-config should declare gptel-magit via `use-package' so it gets installed. +Raw `(autoload ...)' calls register the function name but leave the +package uninstalled on machines that never ran `package-install'. The +\\=`use-package' form inherits `use-package-always-ensure' from +early-init, which is how every other package in this config gets +onto `load-path' before its autoloads fire." + (let ((source-file (expand-file-name "modules/ai-config.el" + user-emacs-directory))) + (with-temp-buffer + (insert-file-contents source-file) + (goto-char (point-min)) + (should (re-search-forward "(use-package gptel-magit\\b" nil t))))) + (provide 'test-ai-config-gptel-magit-lazy-loading) ;;; test-ai-config-gptel-magit-lazy-loading.el ends here -- cgit v1.2.3