all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25642: 26.0.50; Save unmodified buffers not visiting a file yet
@ 2017-02-07 14:08 Tino Calancha
  2017-02-07 16:13 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Tino Calancha @ 2017-02-07 14:08 UTC (permalink / raw)
  To: 25642


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@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






^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-07 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 14:08 bug#25642: 26.0.50; Save unmodified buffers not visiting a file yet Tino Calancha
2017-02-07 16:13 ` Eli Zaretskii
2017-02-07 17:22   ` Tino Calancha

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.