From: Thomas Hilke Date: Fri, 15 Sep 2023 08:30:25 +0000 (+0200) Subject: Close SQL database when corresponding 'sqlite-mode' buffer is killed X-Git-Tag: emacs-29.1.90~81 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d9a1175a611876b5e1625e982720360b5c3a5b6f;p=emacs.git Close SQL database when corresponding 'sqlite-mode' buffer is killed * lisp/sqlite-mode.el (sqlite-mode-open-file): Close DB when the buffer is killed. (Bug#65998) Copyright-paperwork-exempt: yes --- diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 8cb94485369..71c9e57fc12 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -63,6 +63,7 @@ (setq-local sqlite--db (sqlite-open file)) (unless (sqlitep sqlite--db) (error "`sqlite-open' failed to open SQLite file")) + (add-hook 'kill-buffer-hook (lambda () (sqlite-close sqlite--db)) nil t) (sqlite-mode-list-tables)) (defun sqlite-mode-list-tables ()