branch: elpa/hyperdrive
commit 8aac4216821d7dceef342890e9d25c61b965a573
Author: Adam Porter <[email protected]>
Commit: Joseph Turner <[email protected]>
Add/Change: (h/menu-refresh) Refresh menu after starting gateway
---
hyperdrive-lib.el | 14 ++++++++++++--
hyperdrive-vars.el | 4 +++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 63cd976dab..c43f061751 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1445,11 +1445,21 @@ Default function; see variable
`h/gateway-start-function'."
;; twice in close succession.
(h/message "Starting gateway...")))
-(defun h/gateway-after-start-announce ()
+(defun h/announce-gateway-ready ()
"Announce that the gateway is ready."
- ;; TODO: Update hyperdrive-menu to indicate "gateway ready".
(h/message "Gateway ready."))
+(defun h/menu-refresh ()
+ "Refresh `hyperdrive-menu' if it's open."
+ (defvar transient-current-command)
+ (when (and (equal transient-current-command 'h/menu)
+ (not (active-minibuffer-window)))
+ ;; Assume that `hyperdrive-menu' is visible and refresh it.
+ (declare-function transient-quit-all "transient")
+ (transient-quit-all)
+ (declare-function h/menu "hyperdrive")
+ (call-interactively #'h/menu)))
+
(defun h//gateway-stop-default ()
"Stop the gateway subprocess."
(unless (h/gateway-live-p)
diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el
index 01f39009de..c458e8f719 100644
--- a/hyperdrive-vars.el
+++ b/hyperdrive-vars.el
@@ -424,7 +424,9 @@ gateway process."
:type 'function)
(defcustom h/gateway-ready-hook
- '(h/check-gateway-version h/gateway-after-start-announce)
+ '( h/check-gateway-version
+ h/announce-gateway-ready
+ h/menu-refresh)
"Hook called when gateway is ready after starting it.
This hook is called by `hyperdrive--gateway-wait-for-ready' after
`hyperdrive-start'."