Bug: shell-maker--curl-version-supported blocks UI on every prompt submit
Summary
shell-maker--curl-version-supported calls shell-command-to-string synchronously
on every prompt submission, blocking the Emacs UI for several seconds.
Call stack
shell-maker--curl-version-supported()
shell-maker--clear-input-for-execution(...)
shell-maker-submit()
Root cause
shell-maker.el:1296:
(defun shell-maker--curl-version-supported ()
"Return t if curl version is 7.76 or newer, nil otherwise."
(let ((curl-version-string (shell-command-to-string
(concat shell-maker-curl-executable " --version "))))
(when (string-match "\\([0-9]+\\.[0-9]+\\.[0-9]+\\)" curl-version-string)
(let ((version (match-string 1 curl-version-string)))
(version<= "7.76" version)))))
The curl version never changes at runtime, so re-checking it on every submission
is unnecessary. The blocking shell-command-to-string call stalls the UI thread
until curl exits (~5 seconds on some systems).
Fix
Cache the result after the first call:
(defvar shell-maker--curl-version-supported-cache 'unchecked)
(defun shell-maker--curl-version-supported ()
"Return t if curl version is 7.76 or newer, nil otherwise."
(when (eq shell-maker--curl-version-supported-cache 'unchecked)
(setq shell-maker--curl-version-supported-cache
(let ((str (shell-command-to-string
(concat shell-maker-curl-executable " --version "))))
(when (string-match "\\([0-9]+\\.[0-9]+\\.[0-9]+\\)" str)
(version<= "7.76" (match-string 1 str))))))
shell-maker--curl-version-supported-cache)
The sentinel 'unchecked distinguishes "not yet run" from nil (curl too old /
not found), so the failure path is also cached correctly.
Environment
- Emacs 29.x, Linux
- shell-maker 20260512.1253
Bug:
shell-maker--curl-version-supportedblocks UI on every prompt submitSummary
shell-maker--curl-version-supportedcallsshell-command-to-stringsynchronouslyon every prompt submission, blocking the Emacs UI for several seconds.
Call stack
Root cause
shell-maker.el:1296:The curl version never changes at runtime, so re-checking it on every submission
is unnecessary. The blocking
shell-command-to-stringcall stalls the UI threaduntil curl exits (~5 seconds on some systems).
Fix
Cache the result after the first call:
The sentinel
'uncheckeddistinguishes "not yet run" fromnil(curl too old /not found), so the failure path is also cached correctly.
Environment