From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#25642: 26.0.50; Save unmodified buffers not visiting a file yet Date: Tue, 07 Feb 2017 23:08:42 +0900 Message-ID: <87mvdyt7o5.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486477435 9676 195.159.176.226 (7 Feb 2017 14:23:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Feb 2017 14:23:55 +0000 (UTC) To: 25642@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 07 15:23:50 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cb6gQ-0002HW-46 for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Feb 2017 15:23:50 +0100 Original-Received: from localhost ([::1]:54314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb6gV-0001Iq-GL for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Feb 2017 09:23:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb6T8-00068w-HE for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2017 09:10:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cb6T4-0001nt-KN for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2017 09:10:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60284) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cb6T4-0001ni-I3 for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2017 09:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cb6T4-0008Hy-D9 for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2017 09:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Feb 2017 14:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25642 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148647654531783 (code B ref -1); Tue, 07 Feb 2017 14:10:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Feb 2017 14:09:05 +0000 Original-Received: from localhost ([127.0.0.1]:58483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cb6S9-0008GZ-Ag for submit@debbugs.gnu.org; Tue, 07 Feb 2017 09:09:05 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47365) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cb6S6-0008Fy-V4 for submit@debbugs.gnu.org; Tue, 07 Feb 2017 09:09:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cb6S1-0000p6-3v for submit@debbugs.gnu.org; Tue, 07 Feb 2017 09:08:57 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49022) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cb6S1-0000p1-0f for submit@debbugs.gnu.org; Tue, 07 Feb 2017 09:08:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb6Rx-00058N-0b for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2017 09:08:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cb6Rt-0000ho-Qy for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2017 09:08:52 -0500 Original-Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:36662) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cb6Rt-0000g8-Ku for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2017 09:08:49 -0500 Original-Received: by mail-pg0-x243.google.com with SMTP id 75so12245094pgf.3 for ; Tue, 07 Feb 2017 06:08:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=XXRGnQjhJeP18tAsSqYwS4Y9GJ2hT6K41os57VpZPoI=; b=P68nDmb/yJWIm0ColAECUhvrPXVupT2FqiX54ymE7OpyqaouAbHcy6Vj9+qsd21e5U DKhzP7gaOBmHvo/vUinVOYTSdOGp3zrVUaj/QFz/QEqDSco24Y/a5QHXG3OblQZU3rNY XJ+EYgKPCBtxSE6nd+SFaN1aAyWV7sM4f8jV4sgDnEE1RchDai7L1ZgmLVKDHrS7+NSv 2TLD6XphKYyU2sb7it31X00ZcdiEsygH9kxxCqYvtDlugNrFNEVNZzhjVBQXqTqUNeVq 754IvUWyg/d5iJ2lnxD4oi/wsM07FrU9hQtxUP3b6l8m3OaWDSN9TyO8IOSfR0O+7cO0 +YCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=XXRGnQjhJeP18tAsSqYwS4Y9GJ2hT6K41os57VpZPoI=; b=snRUKHy1NfmTbFiouETW/CmUUaw+exMkBKDWBpRUsKnxQl9mg+HD+TLBUE4ZgLRdx8 WXGKSpQ7RLzBoofNpDInDtRtQiyukLU+t5gxvTJfKVykghdC0qjglRzjIZBR04Zpmu9l 4E6LCLPpe8W2FlOFAqVO6Zks75yO551JmIi62ErQycloGNolCIokHJJAuy9JFCpHbhFl X3+Iq7BHtshmacbpH3MKmF0afw2p24B6NOs7HN+hNu6nBJ0DAVtDLljZho/j/yQP8JPQ v7mlWWMNZ7Be+K55iHcub6VSStcfGrvGOBk1fEFGqZPwA8I/J6Vr5WFnTy8swBPc5u/W qk/Q== X-Gm-Message-State: AIkVDXIH3zrb9j4LJFR34A33tWzkmsKYqY65vKZeazIpS5YRT+0ryNFYSyBjnC1hI6gzbw== X-Received: by 10.98.149.93 with SMTP id p90mr20276781pfd.72.1486476527103; Tue, 07 Feb 2017 06:08:47 -0800 (PST) Original-Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104]) by smtp.gmail.com with ESMTPSA id w25sm11952785pge.27.2017.02.07.06.08.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Feb 2017 06:08:46 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129069 Archived-At: 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 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