all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 25642@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	[thread overview]
Message-ID: <87mvdyt7o5.fsf@calancha-pc> (raw)


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






             reply	other threads:[~2017-02-07 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 14:08 Tino Calancha [this message]
2017-02-07 16:13 ` bug#25642: 26.0.50; Save unmodified buffers not visiting a file yet Eli Zaretskii
2017-02-07 17:22   ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mvdyt7o5.fsf@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=25642@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.