From 2457d10ebfedbd24040e30e70cca90c6e523afe0 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 18 Apr 2018 01:22:49 +0200 Subject: [PATCH] (sql-stop): Don't bug out if the SQL buffer is killed * lisp/progmodes/sql.el (sql-stop): Don't bug out if the SQL buffer is killed (bug#30244). --- lisp/progmodes/sql.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index f907a01d8cf..ebbef8d89ee 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -4031,15 +4031,16 @@ Writes the input history to a history file using 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))))) -- 2.39.5