~abcdw/rde-devel

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

Details
Message ID
<20240724030328.7075-1-andrew@trop.in>
DKIM signature
fail
Download raw message
Patch: +15 -19 DKIM signature: fail
---
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

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D2XFPIICO13H.2NDUKBQN2F08U@fra01>
In-Reply-To
<20240724030328.7075-1-andrew@trop.in> (view parent)
DKIM signature
missing
Download raw message
emacs-arei/patches/.build.yml: SUCCESS in 43s

[Consolidate spinner logic in one place, add pending request count][0] v2 from [Andrew Tropin][1]

[0]: https://lists.sr.ht/~abcdw/rde-devel/patches/54050
[1]: andrew@trop.in

✓ #1283093 SUCCESS emacs-arei/patches/.build.yml https://builds.sr.ht/~abcdw/job/1283093
Nikita Domnitskii <nikita@domnitskii.me>
Details
Message ID
<878qxqjfs1.fsf@domnitskii.me>
In-Reply-To
<20240724030328.7075-1-andrew@trop.in> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
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
Nikita Domnitskii <nikita@domnitskii.me>
Details
Message ID
<875xsujb6y.fsf@domnitskii.me>
In-Reply-To
<20240724030328.7075-1-andrew@trop.in> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
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
Reply to thread Export thread (mbox)