GNU bug report logs - #25642
26.0.50; Save unmodified buffers not visiting a file yet

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Tue, 7 Feb 2017 14:10:02 UTC

Severity: wishlist

Tags: wontfix

Found in version 26.0.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25642 in the body.
You can then email your comments to 25642 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25642; Package emacs. (Tue, 07 Feb 2017 14:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 07 Feb 2017 14:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; Save unmodified buffers not visiting a file yet
Date: Tue, 07 Feb 2017 23:08:42 +0900
emacs -Q
C-x b foo
foo ; Insert something.
M-: (set-buffer-modified-p nil) RET
C-x C-s ; No file is written.

It's easy to change that flag for several buffers
with `Buffer-menu-not-modified' or
`ibuffer-do-toggle-modified'.  Then, if you plan to save those
buffers and if they have buffer-file-name nil, then you
are not offered to save them.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 2e0d336c4889fac79e5621be34e9149eb3064cce Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Tue, 7 Feb 2017 22:53:35 +0900
Subject: [PATCH] Save unmodified buffers not visiting a file yet

* lisp/files.el (save-buffer): Set modified flag non-nil before
'basic-save-buffer' call (Bug#25642).
---
 lisp/files.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/files.el b/lisp/files.el
index b7d104853c..c651ef4ee6 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4822,6 +4822,9 @@ save-buffer
              (not noninteractive)
              (not save-silently))
 	(message "Saving file %s..." (buffer-file-name)))
+    ;; Save it as well when unmodified but not visiting a file yet.
+    (unless (or modp (buffer-file-name))
+      (set-buffer-modified-p t))
     (basic-save-buffer (called-interactively-p 'any))
     (and modp (memq arg '(4 64)) (setq buffer-backed-up nil))))
 
-- 
2.11.0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.7)
 of 2017-02-07
Repository revision: c939075b81b2b06c5ec040d7039fd20433509273





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25642; Package emacs. (Tue, 07 Feb 2017 16:14:02 GMT) Full text and rfc822 format available.

Message #8 received at 25642 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 25642 <at> debbugs.gnu.org
Subject: Re: bug#25642: 26.0.50;
 Save unmodified buffers not visiting a file yet
Date: Tue, 07 Feb 2017 18:13:05 +0200
> From: Tino Calancha <tino.calancha <at> gmail.com>
> Date: Tue, 07 Feb 2017 23:08:42 +0900
> 
> emacs -Q
> C-x b foo
> foo ; Insert something.
> M-: (set-buffer-modified-p nil) RET
> C-x C-s ; No file is written.
> 
> It's easy to change that flag for several buffers
> with `Buffer-menu-not-modified' or
> `ibuffer-do-toggle-modified'.  Then, if you plan to save those
> buffers and if they have buffer-file-name nil, then you
> are not offered to save them.
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> >From 2e0d336c4889fac79e5621be34e9149eb3064cce Mon Sep 17 00:00:00 2001
> From: Tino Calancha <tino.calancha <at> gmail.com>
> Date: Tue, 7 Feb 2017 22:53:35 +0900
> Subject: [PATCH] Save unmodified buffers not visiting a file yet
> 
> * lisp/files.el (save-buffer): Set modified flag non-nil before
> 'basic-save-buffer' call (Bug#25642).

Please don't, at least not unconditionally.  I use this feature all
the time, e.g. when composing email messages.

I don't actually understand why this would be a problem: the user
explicitly wanted to reset the modified status of a buffer, why should
Emacs second-guess what the user meant?  But if there are some use
cases where you find this annoying (please describe them), let's make
this an optional behavior, off by default.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25642; Package emacs. (Tue, 07 Feb 2017 17:23:01 GMT) Full text and rfc822 format available.

Message #11 received at 25642 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25642 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#25642: 26.0.50; Save unmodified buffers not visiting a file
 yet
Date: Wed, 8 Feb 2017 02:22:19 +0900 (JST)

On Tue, 7 Feb 2017, Eli Zaretskii wrote:

>> Subject: [PATCH] Save unmodified buffers not visiting a file yet
>>
>> * lisp/files.el (save-buffer): Set modified flag non-nil before
>> 'basic-save-buffer' call (Bug#25642).
>
> Please don't, at least not unconditionally.  I use this feature all
> the time, e.g. when composing email messages.
OK.
>
> I don't actually understand why this would be a problem: the user
> explicitly wanted to reset the modified status of a buffer, why should
> Emacs second-guess what the user meant?  But if there are some use
> cases where you find this annoying (please describe them), let's make
> this an optional behavior, off by default.
No i don't have in mind cases where i have being annoying but that.
Setting modified flag nil followed to trying to save the buffer
sounds like the user don't want to save the buffer.
I think we can close this bug report.  Thanks.




Added tag(s) wontfix. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 09 Feb 2017 21:49:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 25642 <at> debbugs.gnu.org and Tino Calancha <tino.calancha <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 09 Feb 2017 21:49:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 10 Mar 2017 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 101 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.