emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/elisa f89691796c 2/3: Merge pull request #23 from s-kos


From: ELPA Syncer
Subject: [elpa] externals/elisa f89691796c 2/3: Merge pull request #23 from s-kostyaev/add-progress-reporter
Date: Sun, 21 Jul 2024 09:57:52 -0400 (EDT)

branch: externals/elisa
commit f89691796c94241bd2afb6f3a9a27eb0bc945774
Merge: 7298d3ee8d 80fa89bb73
Author: Sergey Kostyaev <s-kostyaev@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #23 from s-kostyaev/add-progress-reporter
    
    Add progress reporter to async operations
---
 elisa.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/elisa.el b/elisa.el
index 653b5d1450..65412abc90 100644
--- a/elisa.el
+++ b/elisa.el
@@ -1152,7 +1152,11 @@ WHERE d.rowid in %s;"
 (defun elisa--async-do (func &optional on-done)
   "Do FUNC asyncronously.
 Call ON-DONE callback with result as an argument after FUNC evaluation done."
-  (let ((command real-this-command))
+  (let* ((command real-this-command)
+        (reporter (make-progress-reporter (if command
+                                              (prin1-to-string command)
+                                            "elisa async processing")))
+        (timer (run-at-time t 0.2 (lambda () (progress-reporter-update 
reporter)))))
     (async-start `(lambda ()
                    ,(async-inject-variables "elisa-embeddings-provider")
                    ,(async-inject-variables "elisa-db-directory")
@@ -1176,12 +1180,12 @@ Call ON-DONE callback with result as an argument after 
FUNC evaluation done."
                    (require 'elisa)
                    (,func))
                 (lambda (res)
+                  (cancel-timer timer)
+                  (progress-reporter-done reporter)
                   (sqlite-close elisa-db)
                   (elisa--reopen-db)
                   (when on-done
-                    (funcall on-done res))
-                  (message "%s done."
-                           (or command "async elisa processing"))))))
+                    (funcall on-done res))))))
 
 (defun elisa-extact-webpage-chunks (url)
   "Extract semantic chunks for webpage fetched from URL."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]