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

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

[nongnu] elpa/emacsql 2e6056df11 2/2: emacsql-waiting-p: Deal with delet


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 2e6056df11 2/2: emacsql-waiting-p: Deal with deleted buffer
Date: Wed, 18 Jan 2023 15:59:30 -0500 (EST)

branch: elpa/emacsql
commit 2e6056df110e76da4eabb413f8781c4f1edddf20
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    emacsql-waiting-p: Deal with deleted buffer
    
    If the buffer (and thus the process) are killed, then waiting for the
    process doesn't make sense anymore, and would result in a confusing
    error.
---
 emacsql.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index 05cefdec97..bba293a7f1 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -200,10 +200,14 @@ must display as \"nil\".")
   :abstract t)
 
 (cl-defmethod emacsql-waiting-p ((connection emacsql-protocol-mixin))
-  "Return true if the end of the buffer has a properly-formatted prompt."
-  (with-current-buffer (emacsql-buffer connection)
-    (and (>= (buffer-size) 2)
-         (string= "#\n" (buffer-substring (- (point-max) 2) (point-max))))))
+  "Return t if the end of the buffer has a properly-formatted prompt.
+Also return t if the process buffer has been killed."
+  (let ((buffer (emacsql-buffer connection)))
+    (or (not (buffer-live-p buffer))
+        (with-current-buffer buffer
+          (and (>= (buffer-size) 2)
+               (string= "#\n"
+                        (buffer-substring (- (point-max) 2) (point-max))))))))
 
 (cl-defmethod emacsql-handle ((_ emacsql-protocol-mixin) code message)
   "Signal a specific condition for CODE from CONNECTION.



reply via email to

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