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

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

[nongnu] elpa/emacsql 2fa32d2ab7 395/427: Create new log buffer if exist


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 2fa32d2ab7 395/427: Create new log buffer if existing one isn't live anymore
Date: Tue, 13 Dec 2022 03:00:15 -0500 (EST)

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

    Create new log buffer if existing one isn't live anymore
    
    The user might have killed the log buffer, in which case we have
    to create a new one, if logging is enabled.
    
    Closes #60.
    Closes #62.
---
 emacsql.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index 5f180f0a10..7b93c4c819 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -130,11 +130,13 @@ SQL expression.")
 (cl-defmethod emacsql-log ((connection emacsql-connection) message)
   "Log MESSAGE into CONNECTION's log.
 MESSAGE should not have a newline on the end."
-  (let ((log (emacsql-log-buffer connection)))
-    (when log
-      (with-current-buffer log
+  (let ((buffer (emacsql-log-buffer connection)))
+    (when buffer
+      (unless (buffer-live-p buffer)
+        (setq buffer (emacsql-enable-debugging connection)))
+      (with-current-buffer buffer
         (setf (point) (point-max))
-        (princ (concat message "\n") log)))))
+        (princ (concat message "\n") buffer)))))
 
 ;;; Sending and receiving
 



reply via email to

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