From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Heerdegen Subject: Re: Emacs bug 37890; killing capture buffer Date: Tue, 17 Dec 2019 00:00:08 +0100 Message-ID: <8736dj27wn.fsf@web.de> References: <87r217lwwz.fsf@web.de> <874ky3sdhs.fsf@alphapapa.net> <87woaxw79i.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:36034) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igzLd-0006v2-Rn for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 18:00:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igzLc-0006lM-LY for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 18:00:17 -0500 Received: from mout.web.de ([212.227.17.11]:33655) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igzLc-0006cr-6T for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 18:00:16 -0500 In-Reply-To: <87woaxw79i.fsf@web.de> (Michael Heerdegen's message of "Sun, 15 Dec 2019 23:31:21 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Adam Porter Cc: emacs-orgmode@gnu.org Michael Heerdegen writes: > - kill-buffer-hook in the capture buffer could be used to prevent the > user from killing such a buffer by accident. Or it could be made > configurable what to do (e.g. undo the change with or without user > prompting, ask for what to do, etc.) > > - kill-emacs-hook could be used to register a function that warns when > any capture buffers are left when Emacs is to be killed. That would > make a difference if you have captured more stuff after having > forgotten about a former capture buffer. The user would be guided to > finish what he would otherwise have forgotten. That doesn't seem to be hard to implement: #+begin_src emacs-lisp (add-hook 'org-capture-mode-hook (defun my-org-capture-mode-hook-fun () (add-hook 'kill-buffer-hook (defun my-org-capture-inhibit-accidental-kill () (user-error "Please don't just kill org capture buffers")) nil 'local) (add-hook 'kill-emacs-hook (defun my-org-capture-barf-for-left-capture-buffers () (dolist (b (buffer-list)) (when (with-current-buffer b (bound-and-true-p org-capture-mode)) (user-error "Please care about org capture buffer %s" (buffer-name b)))))))) (add-hook 'org-capture-prepare-finalize-hook (defun my-org-capture-prepare-finalize-hook-fun () (remove-hook 'kill-buffer-hook 'my-org-capture-inhibit-accidental-kill 'local))) #+end_src Would you consider to do something like this by default? BTW, what about my question whether my original bug report can be closed? TIA, Michael.