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

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

[elpa] externals/ement 9bcb6fd014: Fix: (ement-room-mark-read) "curl pro


From: ELPA Syncer
Subject: [elpa] externals/ement 9bcb6fd014: Fix: (ement-room-mark-read) "curl process interrupted" error
Date: Thu, 27 Oct 2022 13:57:55 -0400 (EDT)

branch: externals/ement
commit 9bcb6fd01493e0dade41a65900c8422bebc805ff
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Fix: (ement-room-mark-read) "curl process interrupted" error
---
 README.org    |  3 +++
 ement-room.el | 15 ++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index 0aed164a5b..0ee1b26672 100644
--- a/README.org
+++ b/README.org
@@ -292,6 +292,9 @@ Note that, while ~matrix-client~ remains usable, and 
probably will for some time
 *Changes*
 + When selecting a room to view with completion, don't offer spaces.
 
+*Fixes*
++ Don't show "curl process interrupted" message when updating a read marker's 
position again.
+
 ** 0.4
 
 *Additions*
diff --git a/ement-room.el b/ement-room.el
index 72fcde02e8..112a3410f3 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -2484,7 +2484,6 @@ Also, mark room's buffer as unmodified."
               ;; send a new one.
               (when-let ((request-process (car (map-values 
ement-room-read-receipt-request))))
                 (when (process-live-p request-process)
-                  ;; FIXME: This will probably cause a spurious error message.
                   (interrupt-process request-process)))
               (setf ement-room-read-receipt-request nil)
               (setf (alist-get event ement-room-read-receipt-request)
@@ -2564,14 +2563,24 @@ Interactively, mark both types as read up to event at 
point."
       (let ((request-process (ement-api session endpoint :method 'post :data 
(json-encode data)
                                :then (lambda (_data)
                                        (ement-room-move-read-markers room
-                                         :read-event read-event 
:fully-read-event fully-read-event)))))
+                                         :read-event read-event 
:fully-read-event fully-read-event))
+                               :else (lambda (plz-error)
+                                       (pcase (plz-error-message plz-error)
+                                         ("curl process interrupted"
+                                          ;; Ignore this, because it happens 
when we
+                                          ;; update a read marker before the 
previous
+                                          ;; update request is completed.
+                                          nil)
+                                         (_ (signal 'ement-api-error
+                                                    (list (format "Ement: 
(ement-room-mark-read) Unexpected API error: %s"
+                                                                  plz-error)
+                                                          plz-error))))))))
         (when-let ((room-buffer (alist-get 'buffer (ement-room-local room))))
           ;; NOTE: Ideally we would do this before sending the new request, 
but to make
           ;; the code much simpler, we do it afterward.
           (with-current-buffer room-buffer
             (when-let ((request-process (car (map-values 
ement-room-read-receipt-request))))
               (when (process-live-p request-process)
-                ;; FIXME: This will probably cause a spurious error message.
                 (interrupt-process request-process)))
             (setf ement-room-read-receipt-request nil
                   (alist-get read-event ement-room-read-receipt-request) 
request-process)))))))



reply via email to

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