all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Allen Li <vianchielfaura@gmail.com>
Cc: 30244@debbugs.gnu.org
Subject: bug#30244: 25.2.50; Killing sql mode buffer results in error
Date: Tue, 17 Apr 2018 22:08:40 +0200	[thread overview]
Message-ID: <874lk9iojb.fsf@mouse.gnus.org> (raw)
In-Reply-To: <CAJr1M6f_+GUN-2VmjUgrgx6rL7nRwBerpHrAM+x7tAPguCxrOw@mail.gmail.com> (Allen Li's message of "Wed, 24 Jan 2018 16:28:07 -0800")

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)))))
 
 \f
 


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





  reply	other threads:[~2018-04-17 20:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25  0:28 bug#30244: 25.2.50; Killing sql mode buffer results in error Allen Li
2018-04-17 20:08 ` Lars Ingebrigtsen [this message]
2018-04-17 23:12   ` Phil Sainty
2018-04-17 23:23     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874lk9iojb.fsf@mouse.gnus.org \
    --to=larsi@gnus.org \
    --cc=30244@debbugs.gnu.org \
    --cc=vianchielfaura@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.