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.

Full log


View this message in rfc822 format

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 25642 <at> debbugs.gnu.org
Subject: bug#25642: 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





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.