branch: externals/ement
commit 3552980d36e94c11b02104e76e37dce58a79ab60
Author: Adam Porter <a...@alphapapa.net>
Commit: Adam Porter <a...@alphapapa.net>

    Fix: (ement-disconnect) Prevent error message
    
    Fixes #208.
---
 README.org | 1 +
 ement.el   | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index cbec8b46f1..3610a5ced2 100644
--- a/README.org
+++ b/README.org
@@ -314,6 +314,7 @@ Ement.el doesn't support encrypted rooms natively, but it 
can be used transparen
 *Fixes*
 + Replies to edited messages are correctly sent to the original event (whereas 
previously they were sent to the edit, which caused reactions to not be shown). 
 ([[https://github.com/alphapapa/ement.el/issues/230][#230]], 
[[https://github.com/alphapapa/ement.el/issues/277][#277]].  Thanks to 
[[https://github.com/phil-s][Phil Sainty]] for suggesting, and to 
[[https://github.com/dionisos2][dionisos]] for reporting.)
 + Set ~filter-buffer-substring-function~ in room buffers to prevent undesired 
text properties from being included in copied text.  
([[https://github.com/alphapapa/ement.el/pull/278][#278]].  Thanks to 
[[https://github.com/phil-s][Phil Sainty]].)
++ Command ~ement-disconnect~ no longer shows an error message.  
([[https://github.com/alphapapa/ement.el/issues/208][#208]].)
 
 ** 0.15.1
 
diff --git a/ement.el b/ement.el
index d3dc835001..46bba32ab8 100644
--- a/ement.el
+++ b/ement.el
@@ -356,8 +356,10 @@ in them won't work."
   (dolist (session sessions)
     (let ((user-id (ement-user-id (ement-session-user session))))
       (when-let ((process (map-elt ement-syncs session)))
-        (ignore-errors
-          (delete-process process)))
+        ;; Disable the sync process's ELSE handler, preventing error messages, 
but still
+        ;; allowing `plz--respond' to clean up the buffer, etc.
+        (setf (process-get process :plz-else) #'ignore)
+        (delete-process process))
       ;; NOTE: I'd like to use `map-elt' here, but not until
       ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47368> is fixed, I 
guess.
       (setf (alist-get session ement-syncs nil nil #'equal) nil

Reply via email to