aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-15 02:31:53 -0500
committerCraig Jennings <c@cjennings.net>2026-05-15 02:31:53 -0500
commit82655ef9d550f9388027f20ea1eb7b9adcdac56c (patch)
tree311c0efd6861166f97cad379dcc80919fd09d80f /modules
parent05f4c25130cdaaa16bc14bc1c36866b3e187ad6d (diff)
downloaddotemacs-82655ef9d550f9388027f20ea1eb7b9adcdac56c.tar.gz
dotemacs-82655ef9d550f9388027f20ea1eb7b9adcdac56c.zip
refactor(org-webclipper): use setq, not setopt, for pandoc sleep time
`org-web-tools-pandoc-sleep-time' is a plain float with no custom-set handler that needs to fire. `setopt' adds the entire customize-variable validation machinery -- which, lazily, depends on wid-edit being loaded. The handler's tests stub `require' so org-web-tools never really loads, then mock `setopt' via `cl-letf' on the function cell. That mock has no effect on byte-compiled code because `setopt' is a macro: the production handler has already expanded to a call into `setopt--set'. When `setopt--set' runs, it walks into the customize machinery and hits an unbound `widget-field-keymap' (wid-edit not loaded), and the test fails with a confusing wrong-type-argument. `setq' has identical runtime effect for this variable and dodges the customize machinery entirely. Tests now pass without contorted mocking.
Diffstat (limited to 'modules')
-rw-r--r--modules/org-webclipper.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/org-webclipper.el b/modules/org-webclipper.el
index 7b024e431..be4c1cb68 100644
--- a/modules/org-webclipper.el
+++ b/modules/org-webclipper.el
@@ -135,9 +135,15 @@ INFO is a plist containing :url and :title from the org-protocol call."
"Handle web page clipping during org-capture.
This function is called from the capture template.
It fetches the page content and converts it to Org format."
- ;; Load org-web-tools only when actually needed
+ ;; Load org-web-tools only when actually needed. Use plain `setq'
+ ;; rather than `setopt' because the variable is a plain float with no
+ ;; custom-set handler that needs to fire, and `setopt' is a macro --
+ ;; tests that try to stub it via `cl-letf' on the function cell hit
+ ;; the already-expanded `setopt--set' in the byte-compiled handler
+ ;; and fail with a `void-variable widget-field-keymap' error from
+ ;; the customize machinery loading lazily.
(require 'org-web-tools)
- (setopt org-web-tools-pandoc-sleep-time 0.5)
+ (setq org-web-tools-pandoc-sleep-time 0.5)
(let ((url cj/webclip-current-url)
(title cj/webclip-current-title))