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

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

[nongnu] elpa/emacsql 8fa7c00978 170/427: Add sentinel cleanup to psql.


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 8fa7c00978 170/427: Add sentinel cleanup to psql.
Date: Tue, 13 Dec 2022 02:59:39 -0500 (EST)

branch: elpa/emacsql
commit 8fa7c00978882d9c7c41897ba53f2e7bd949718b
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>

    Add sentinel cleanup to psql.
---
 emacsql-psql.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/emacsql-psql.el b/emacsql-psql.el
index adac77bc99..008eb8334c 100644
--- a/emacsql-psql.el
+++ b/emacsql-psql.el
@@ -50,14 +50,17 @@
                                       :process process
                                       :dbname dbname)))
       (prog1 connection
+        (setf (process-sentinel process)
+              (lambda (_proc _) (kill-buffer buffer)))
         (emacsql-register connection)
-        (emacsql-send-string connection "\\pset pager off")
-        (emacsql-send-string connection "\\pset null nil")
-        (emacsql-send-string connection "\\a")
-        (emacsql-send-string connection "\\t")
-        (emacsql-send-string connection "\\f ' '")
-        (emacsql-send-string connection "\\set PROMPT1 ]")
-        (emacsql-send-string connection "EMACSQL;") ; error message flush
+        (mapc (apply-partially #'emacsql-send-string connection)
+              '("\\pset pager off"
+                "\\pset null nil"
+                "\\a"
+                "\\t"
+                "\\f ' '"
+                "\\set PROMPT1 ]"
+                "EMACSQL;")) ; error message flush
         (emacsql-wait connection)))))
 
 (defmethod emacsql-close ((connection emacsql-psql-connection))



reply via email to

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