bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#30244: 25.2.50; Killing sql mode buffer results in error


From: Lars Ingebrigtsen
Subject: bug#30244: 25.2.50; Killing sql mode buffer results in error
Date: Tue, 17 Apr 2018 22:08:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Allen Li <vianchielfaura@gmail.com> writes:

> To reproduce (need a mysql server handy):
>
> M-x toggle-debug-on-error RET
> M-x sql-mysql RET <fill in information>
> C-x k RET yes RET
>
> Yields error:
>
> Debugger entered--Lisp error: (error "Selecting deleted buffer")
>   sql-stop(#<process SQL> "hangup\n")

I don't use sql-mode, so I can't test this.  Does the following trivial
patch work fix the bug for you?

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index f907a01d8c..ebbef8d89e 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4031,15 +4031,16 @@ sql-stop
 
 This function is a sentinel watching the SQL interpreter process.
 Sentinels will always get the two parameters PROCESS and EVENT."
-  (with-current-buffer (process-buffer process)
-    (let
-        ((comint-input-ring-separator sql-input-ring-separator)
-         (comint-input-ring-file-name sql-input-ring-file-name))
-      (comint-write-input-ring))
-
-    (if (not buffer-read-only)
-        (insert (format "\nProcess %s %s\n" process event))
-      (message "Process %s %s" process event))))
+  (when (buffer-live-p (process-buffer process))
+    (with-current-buffer (process-buffer process)
+      (let
+          ((comint-input-ring-separator sql-input-ring-separator)
+           (comint-input-ring-file-name sql-input-ring-file-name))
+        (comint-write-input-ring))
+
+      (if (not buffer-read-only)
+          (insert (format "\nProcess %s %s\n" process event))
+        (message "Process %s %s" process event)))))
 
 
 


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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