From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Heerdegen Subject: Re: Emacs bug 37890; killing capture buffer Date: Sun, 15 Dec 2019 23:31:21 +0100 Message-ID: <87woaxw79i.fsf@web.de> References: <87r217lwwz.fsf@web.de> <874ky3sdhs.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:44812) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igcQM-00078X-DL for emacs-orgmode@gnu.org; Sun, 15 Dec 2019 17:31:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igcQC-0005HE-9Z for emacs-orgmode@gnu.org; Sun, 15 Dec 2019 17:31:38 -0500 Received: from mout.web.de ([212.227.15.3]:41641) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1igcQB-0005E5-RY for emacs-orgmode@gnu.org; Sun, 15 Dec 2019 17:31:28 -0500 In-Reply-To: <874ky3sdhs.fsf@alphapapa.net> (Adam Porter's message of "Fri, 13 Dec 2019 23:05:51 -0600") 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 Adam Porter writes: > Michael Heerdegen writes: > > > Or (really better IMHO) consider a different implementation where the > > original buffer is not modified until the user explicitly confirms the > > stuff to capture with C-c C-c. > > That would be helpful in some ways, but harmful in others. For example, > consider a capture that is started while in a meeting, on a phone call, > away from one's desk, etc., with some notes in it, clock start time, > etc. (You can find examples of this workflow in, e.g. Bernt Hansen's > Org config.) If Emacs were interrupted (crash, power failure, reboot, > etc), the un-finalized capture would still be present in the auto-save > file and could be recovered when restarting Emacs and finding the file > again. A legitimate objection. > The way Org uses indirect, narrowed buffers for capturing is an > elegant use of Emacs features that helps protect user data from > accidental loss. Let me rethink from the other side: how could the issue I described (globbered org file) be prevented? If you happen to kill the capture buffer or forget about it, is there any indication left that there is a problem? A modified buffer visiting the org file is left, but as soon as you successfully capture something else Org happily saves both edits to the file. So maybe we could prevent the user from doing something wrong? Maybe like this: - 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 would improve security even further without getting in the way in the normal workflow. Michael.