all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30244: 25.2.50; Killing sql mode buffer results in error
@ 2018-01-25  0:28 Allen Li
  2018-04-17 20:08 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Allen Li @ 2018-01-25  0:28 UTC (permalink / raw
  To: 30244

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")

In GNU Emacs 25.2.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11),
modified by Debian





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#30244: 25.2.50; Killing sql mode buffer results in error
  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
  2018-04-17 23:12   ` Phil Sainty
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-17 20:08 UTC (permalink / raw
  To: Allen Li; +Cc: 30244

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





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#30244: 25.2.50; Killing sql mode buffer results in error
  2018-04-17 20:08 ` Lars Ingebrigtsen
@ 2018-04-17 23:12   ` Phil Sainty
  2018-04-17 23:23     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Sainty @ 2018-04-17 23:12 UTC (permalink / raw
  To: Lars Ingebrigtsen; +Cc: Allen Li, bug-gnu-emacs, 30244

I can replicate this with `sql-postgres', and can confirm that
the `buffer-live-p' wrapper eliminates the error here






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#30244: 25.2.50; Killing sql mode buffer results in error
  2018-04-17 23:12   ` Phil Sainty
@ 2018-04-17 23:23     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-17 23:23 UTC (permalink / raw
  To: Phil Sainty; +Cc: Allen Li, 30244

Phil Sainty <psainty@orcon.net.nz> writes:

> I can replicate this with `sql-postgres', and can confirm that
> the `buffer-live-p' wrapper eliminates the error here

Thanks for testing.

I've now applied the patch to Emacs 27.1.

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-17 23:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-04-17 23:12   ` Phil Sainty
2018-04-17 23:23     ` Lars Ingebrigtsen

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.