This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
3
2
[PATCH emacs-arei v2] Consolidate spinner logic in one place, add pending request count
---
Oops, sent previous version as guile-ares-rs patch :)
arei-evaluation.el | 9 ++-------
arei-macroexpansion.el | 9 ++-------
arei.el | 16 +++++++++++-----
3 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/arei-evaluation.el b/arei-evaluation.el
index 88584d3..065d694 100644
--- a/arei-evaluation.el
+++ b/arei-evaluation.el
@@ -90,11 +90,7 @@
:format fmt
:where (or expression-end (point))
:duration eros-eval-result-duration)
- (message fmt value))))
- ;; NOTE: stop spinner if it's the last request (we can have
- ;; multiple evals queued)
- (when (= 1 (hash-table-count arei-client--pending-requests))
- (arei-spinner-stop)))
+ (message fmt value)))))
(when (get-buffer-window)
(set-window-point (get-buffer-window) (buffer-size))))))))
@@ -119,8 +115,7 @@
(arei-client-send-request
request
(arei--process-user-eval-response-callback (current-buffer) end)
- (arei--user-evaluation-session-id))
- (ignore-errors (arei-spinner-start))))
+ (arei--user-evaluation-session-id))))
;;;
diff --git a/arei-macroexpansion.el b/arei-macroexpansion.el
index 1f561a2..1b1e28e 100644
--- a/arei-macroexpansion.el
+++ b/arei-macroexpansion.el
@@ -57,11 +57,7 @@
:format fmt
:where (or expression-end (point))
:duration eros-eval-result-duration)
- (message fmt expansion))))
- ;; NOTE: stop spinner if it's the last request (we can have
- ;; multiple evals queued)
- (when (= 1 (hash-table-count arei-client--pending-requests))
- (arei-spinner-stop)))
+ (message fmt expansion)))))
(when (get-buffer-window)
(set-window-point (get-buffer-window) (buffer-size)))))))
@@ -78,8 +74,7 @@
(arei-client-send-request
request
(arei--process-guile-macroexpand-response-callback (current-buffer) end)
- (arei--tooling-session-id))
- (ignore-errors (arei-spinner-start))))
+ (arei--tooling-session-id))))
(defun arei-macroexpand-last-sexp ()
(interactive)
diff --git a/arei.el b/arei.el
index 2676ceb..fdf157a 100644
--- a/arei.el
+++ b/arei.el
@@ -133,7 +133,6 @@ Development related and other commands:
(cl-defmethod sesman-quit-session ((_system (eql Arei)) session)
"Quit an Arei SESSION."
(let ((kill-buffer-query-functions nil))
- (arei-spinner-stop)
(kill-buffer (cadr session))))
@@ -262,10 +261,17 @@ this function directly."
(defun arei--modeline-connection-info ()
(list
"["
- (cond
- ((arei-spinner-modeline) (arei-spinner-modeline))
- ((arei-connected-p) "connected")
- (t "disconnected"))
+ (if (arei-connected-p)
+ (with-current-buffer (arei-connection-buffer)
+ (if (not (hash-table-empty-p arei-client--pending-requests))
+ (progn
+ (unless (arei-spinner-modeline) (arei-spinner-start))
+ (format "%s %s"
+ (car (arei-spinner-modeline))
+ (hash-table-count arei-client--pending-requests)))
+ (arei-spinner-stop)
+ "connected"))
+ (t "disconnected"))
"]"))
(defvar arei-mode-line
--
2.45.2
[emacs-arei/patches/.build.yml] build success
Andrew Tropin <andrew@trop.in> writes:
> ---
> Oops, sent previous version as guile-ares-rs patch :)
>
> arei-evaluation.el | 9 ++-------
> arei-macroexpansion.el | 9 ++-------
> arei.el | 16 +++++++++++-----
> 3 files changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/arei-evaluation.el b/arei-evaluation.el
> index 88584d3..065d694 100644
> --- a/arei-evaluation.el
> +++ b/arei-evaluation.el
> @@ -90,11 +90,7 @@
> :format fmt
> :where (or expression-end (point))
> :duration eros-eval-result-duration)
> - (message fmt value))))
> - ;; NOTE: stop spinner if it's the last request (we can have
> - ;; multiple evals queued)
> - (when (= 1 (hash-table-count arei-client--pending-requests))
> - (arei-spinner-stop)))
> + (message fmt value)))))
>
> (when (get-buffer-window)
> (set-window-point (get-buffer-window) (buffer-size))))))))
> @@ -119,8 +115,7 @@
> (arei-client-send-request
> request
> (arei--process-user-eval-response-callback (current-buffer) end)
> - (arei--user-evaluation-session-id))
> - (ignore-errors (arei-spinner-start))))
> + (arei--user-evaluation-session-id))))
>
>
> ;;;
> diff --git a/arei-macroexpansion.el b/arei-macroexpansion.el
> index 1f561a2..1b1e28e 100644
> --- a/arei-macroexpansion.el
> +++ b/arei-macroexpansion.el
> @@ -57,11 +57,7 @@
> :format fmt
> :where (or expression-end (point))
> :duration eros-eval-result-duration)
> - (message fmt expansion))))
> - ;; NOTE: stop spinner if it's the last request (we can have
> - ;; multiple evals queued)
> - (when (= 1 (hash-table-count arei-client--pending-requests))
> - (arei-spinner-stop)))
> + (message fmt expansion)))))
>
> (when (get-buffer-window)
> (set-window-point (get-buffer-window) (buffer-size)))))))
> @@ -78,8 +74,7 @@
> (arei-client-send-request
> request
> (arei--process-guile-macroexpand-response-callback (current-buffer) end)
> - (arei--tooling-session-id))
> - (ignore-errors (arei-spinner-start))))
> + (arei--tooling-session-id))))
>
> (defun arei-macroexpand-last-sexp ()
> (interactive)
> diff --git a/arei.el b/arei.el
> index 2676ceb..fdf157a 100644
> --- a/arei.el
> +++ b/arei.el
> @@ -133,7 +133,6 @@ Development related and other commands:
> (cl-defmethod sesman-quit-session ((_system (eql Arei)) session)
> "Quit an Arei SESSION."
> (let ((kill-buffer-query-functions nil))
> - (arei-spinner-stop)
> (kill-buffer (cadr session))))
>
>
> @@ -262,10 +261,17 @@ this function directly."
> (defun arei--modeline-connection-info ()
> (list
> "["
> - (cond
> - ((arei-spinner-modeline) (arei-spinner-modeline))
> - ((arei-connected-p) "connected")
> - (t "disconnected"))
> + (if (arei-connected-p)
> + (with-current-buffer (arei-connection-buffer)
> + (if (not (hash-table-empty-p arei-client--pending-requests))
> + (progn
> + (unless (arei-spinner-modeline) (arei-spinner-start))
> + (format "%s %s"
> + (car (arei-spinner-modeline))
> + (hash-table-count arei-client--pending-requests)))
> + (arei-spinner-stop)
> + "connected"))
> + (t "disconnected"))
just "disconnected"
> "]"))
>
> (defvar arei-mode-line
> --
> 2.45.2
>
Everything else looks great!
--
Best Regards,
Nikita Domnitskii
Andrew Tropin <andrew@trop.in> writes:
> ---
> Oops, sent previous version as guile-ares-rs patch :)
>
> arei-evaluation.el | 9 ++-------
> arei-macroexpansion.el | 9 ++-------
> arei.el | 16 +++++++++++-----
> 3 files changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/arei-evaluation.el b/arei-evaluation.el
> index 88584d3..065d694 100644
> --- a/arei-evaluation.el
> +++ b/arei-evaluation.el
> @@ -90,11 +90,7 @@
> :format fmt
> :where (or expression-end (point))
> :duration eros-eval-result-duration)
> - (message fmt value))))
> - ;; NOTE: stop spinner if it's the last request (we can have
> - ;; multiple evals queued)
> - (when (= 1 (hash-table-count arei-client--pending-requests))
> - (arei-spinner-stop)))
> + (message fmt value)))))
>
> (when (get-buffer-window)
> (set-window-point (get-buffer-window) (buffer-size))))))))
> @@ -119,8 +115,7 @@
> (arei-client-send-request
> request
> (arei--process-user-eval-response-callback (current-buffer) end)
> - (arei--user-evaluation-session-id))
> - (ignore-errors (arei-spinner-start))))
> + (arei--user-evaluation-session-id))))
>
>
> ;;;
> diff --git a/arei-macroexpansion.el b/arei-macroexpansion.el
> index 1f561a2..1b1e28e 100644
> --- a/arei-macroexpansion.el
> +++ b/arei-macroexpansion.el
> @@ -57,11 +57,7 @@
> :format fmt
> :where (or expression-end (point))
> :duration eros-eval-result-duration)
> - (message fmt expansion))))
> - ;; NOTE: stop spinner if it's the last request (we can have
> - ;; multiple evals queued)
> - (when (= 1 (hash-table-count arei-client--pending-requests))
> - (arei-spinner-stop)))
> + (message fmt expansion)))))
>
> (when (get-buffer-window)
> (set-window-point (get-buffer-window) (buffer-size)))))))
> @@ -78,8 +74,7 @@
> (arei-client-send-request
> request
> (arei--process-guile-macroexpand-response-callback (current-buffer) end)
> - (arei--tooling-session-id))
> - (ignore-errors (arei-spinner-start))))
> + (arei--tooling-session-id))))
>
> (defun arei-macroexpand-last-sexp ()
> (interactive)
> diff --git a/arei.el b/arei.el
> index 2676ceb..fdf157a 100644
> --- a/arei.el
> +++ b/arei.el
> @@ -133,7 +133,6 @@ Development related and other commands:
> (cl-defmethod sesman-quit-session ((_system (eql Arei)) session)
> "Quit an Arei SESSION."
> (let ((kill-buffer-query-functions nil))
> - (arei-spinner-stop)
> (kill-buffer (cadr session))))
>
>
> @@ -262,10 +261,17 @@ this function directly."
> (defun arei--modeline-connection-info ()
> (list
> "["
> - (cond
> - ((arei-spinner-modeline) (arei-spinner-modeline))
> - ((arei-connected-p) "connected")
> - (t "disconnected"))
> + (if (arei-connected-p)
> + (with-current-buffer (arei-connection-buffer)
> + (if (not (hash-table-empty-p arei-client--pending-requests))
> + (progn
> + (unless (arei-spinner-modeline) (arei-spinner-start))
> + (format "%s %s"
> + (car (arei-spinner-modeline))
> + (hash-table-count arei-client--pending-requests)))
> + (arei-spinner-stop)
> + "connected"))
> + (t "disconnected"))
> "]"))
>
> (defvar arei-mode-line
> --
> 2.45.2
>
Okay, I've applied the patch, fix the typo and pushed as
https://git.sr.ht/~abcdw/emacs-arei/commit/6c6ff9a598dfd7ea1b60b80d7d84ea5a69b30e6f
--
Best Regards,
Nikita Domnitskii