From fad6f3288ba7c9451bd0b2e0d38c67d267b7fc19 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 12 May 2026 13:29:38 -0500 Subject: refactor(org-drill): hoist the commands out of :config and clear the byte-compile warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `cj/drill-*` defuns and `cj/drill-map` lived inside the `use-package org-drill` `:config` block, so the byte-compiler never registered them — every cross-reference between them warned ("function `cj/drill-this-file' is not known", and so on). I moved all of that to module top level, where the compiler sees it. The ten `(setq org-drill-...)` lines became a `:custom` block (no more "assignment to free variable"). Added `(require 'user-constants)` and `(require 'keybindings)` for `drill-dir` and `cj/custom-keymap`, plus `declare-function` for `org-drill`, `org-drill-resume`, `org-capture`, and `org-refile`. The module byte-compiles clean now, and `C-; D` still mounts the drill submenu with the same leaf keys. I also gave `tests/test-org-drill-first-function.el` a `cj/custom-keymap` stub: its "loads without error" test does a bare `load` of the module, which now runs the keymap mount at load time instead of deferring it inside `:config`. --- tests/test-org-drill-first-function.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/test-org-drill-first-function.el') diff --git a/tests/test-org-drill-first-function.el b/tests/test-org-drill-first-function.el index 925cdf84..69ca28f9 100644 --- a/tests/test-org-drill-first-function.el +++ b/tests/test-org-drill-first-function.el @@ -14,6 +14,12 @@ (require 'ert) +;; `org-drill-config.el' mounts its keymap under `cj/custom-keymap' at load +;; time; in a real session that's defined by keybindings.el, but a bare +;; `load' of the module needs it stubbed (see `test-org-drill-config-loads-without-error'). +(defvar cj/custom-keymap (make-sparse-keymap) + "Stub custom keymap for the org-drill-config load test.") + (ert-deftest test-org-drill-first-function-not-defined-without-compat () "Verify that 'first' function doesn't exist by default in modern Emacs. -- cgit v1.2.3