From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Subject: Re: buffer-file-name in [* Org src *] buffers Date: Wed, 14 Mar 2018 10:18:55 -0400 Message-ID: References: <87ina1cqaf.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew7F8-0002yh-CH for emacs-orgmode@gnu.org; Wed, 14 Mar 2018 10:19:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew7F5-0001Ku-3w for emacs-orgmode@gnu.org; Wed, 14 Mar 2018 10:19:02 -0400 Received: from mail-qk0-x233.google.com ([2607:f8b0:400d:c09::233]:42730) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ew7F4-0001KJ-UO for emacs-orgmode@gnu.org; Wed, 14 Mar 2018 10:18:59 -0400 Received: by mail-qk0-x233.google.com with SMTP id b198so3593691qkg.9 for ; Wed, 14 Mar 2018 07:18:58 -0700 (PDT) In-Reply-To: <87ina1cqaf.fsf@nicolasgoaziou.fr> Content-Language: en-GB 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: emacs-orgmode@gnu.org Cc: Nicolas Goaziou Hi Nicolas, > The explanation is here: > > > > AFAIU, this was needed so that Emacs would warn when closing a remote > editing buffer with C-x k. This feature doesn't appear to be functional > at the moment, tho. Sorry for the delayed answer; I didn't receive your message. Thanks for the link to the discussion. It'd be great to find a different way to do it, though, as the current implementation sends a confusing signal to other packages. The original implementation listed three problems: > * Proposed bug I > C-x k kills the edit buffer without questions; the overlay > remains, but now links to a deleted buffer. > * Proposed bug II > C-x C-c kills a modified edit buffer silently, without offering to > save your work. I have lost work like that a number of times > recently. > * Proposed bug III > C-x s does not offer to save a modified edit buffer It also mentioned this: > This patch gives the desired behaviour, at the cost of being forced > to assign a buffer-file-name to the edit buffer. The consequence is > that the edit buffer is considered to always be modified I think there's an alternative fix for these issues that doesn't require setting buffer-file-name: 1. Set buffer-offer-save to 'always; this guarantees that C-x s will ask about the edit buffer. 2. Add an entry to kill-buffer-query-functions. For example, with-editor (used by magit) does this: (add-hook 'kill-buffer-query-functions 'with-editor-kill-buffer-noop nil t) With these, we could leave buffer-file-name to nil. WDYT? Clément. PS: point (1) shares an issue with the original implementation (it always prompts during save-some-buffers). One fix to this could be to add a buffer-modification-hook that marks the source buffer as modified when the edit buffer is modified, and to make change the source buffer's write-contents-functions to offer to save edit buffers too.