From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#12507: [debbugs-tracker] Processed: severity 12507 wishlist Date: Thu, 27 Sep 2012 11:37:02 -0700 Message-ID: <9D98A7802F07462887BCC67BE194243B@us.oracle.com> References: <87bogubqjy.fsf@gnu.org><873925ebpd.fsf@gnu.org><87ipb031aj.fsf@kwarm.red-bean.com> <87sja4t48j.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1348771086 10288 80.91.229.3 (27 Sep 2012 18:38:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Sep 2012 18:38:06 +0000 (UTC) To: "'Thierry Volpiatto'" , <12507@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 27 20:38:11 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1THIyR-0001Wx-9o for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Sep 2012 20:38:11 +0200 Original-Received: from localhost ([::1]:43145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THIyM-000145-6y for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Sep 2012 14:38:06 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THIyJ-00013w-IV for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 14:38:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THIyI-0005Oq-5f for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 14:38:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THIyI-0005Om-2m for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 14:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1THIyM-00031P-Cf for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 14:38:06 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Sep 2012 18:38:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12507 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12507-submit@debbugs.gnu.org id=B12507.134877103611555 (code B ref 12507); Thu, 27 Sep 2012 18:38:04 +0000 Original-Received: (at 12507) by debbugs.gnu.org; 27 Sep 2012 18:37:16 +0000 Original-Received: from localhost ([127.0.0.1]:59177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THIxW-00030H-8O for submit@debbugs.gnu.org; Thu, 27 Sep 2012 14:37:15 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:47565) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THIxT-000304-KW for 12507@debbugs.gnu.org; Thu, 27 Sep 2012 14:37:12 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q8RIb3hk010431 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 27 Sep 2012 18:37:04 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q8RIb3eJ015343 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Sep 2012 18:37:03 GMT Original-Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q8RIb3we000836; Thu, 27 Sep 2012 13:37:03 -0500 Original-Received: from dradamslap1 (/130.35.178.248) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 27 Sep 2012 11:37:03 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87sja4t48j.fsf@gmail.com> Thread-Index: Ac2ccmlFIbZCtl/lS7WsTo5OaXoZSAAYAaQA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64960 Archived-At: > >> ;; Don't use write-file; we don't want this buffer to visit it. > > > > After write-file, the buffer is marked as visiting that file, which > > affects the behavior of C-x C-f and a lot more (e.g. asks the user > > for confirmation if the file was modified by some other process, ...). > > What about improving write-region to use backup when needed? > Possibly writing a new write-region-something function that handle > backup, or a write-file-noselect function. +1 And please let us know how best to accomplish that (in the doc perhaps, but also in this thread). It's not clear to me how to make a backup copy of a file without visiting that file in some buffer, however temporarily. For example, I can imagine this as a way to append the region to a file and back it up: (write-region (point-min) (point-max) FILE 'append) (with-current-buffer (find-file-noselect FILE) (backup-buffer)) But IIUC `find-file-noselect' visits the buffer (and so "asks the user for confirmation if the file was modified by some other process"). So that's apparently not the way to go. What is? Leaving the question of visiting aside for the moment, what about `backup-buffer' here? Should it be `save-buffer' instead, so that the modes of FILE get updated properly? Should it be just `basic-save-buffer-1' instead of `save-buffer'? And should any such code take what Juri mentioned wrt vc into account? If so, how? It's not clear to me how best to handle this write-stuff-to-a-file-and-back-it-up-when-appropriate, but I (and perhaps others) would like to learn. I haven't found the answer by looking at the manuals or perusing the source code. Can you help? Thx.