From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vitalie Spinu Newsgroups: gmane.emacs.bugs Subject: bug#20257: [PATCH] 24.4.90; set-visited-file-name doesn't reset buffer-auto-save-file-name Date: Sat, 04 Apr 2015 15:41:58 +0200 Message-ID: <874mowrowp.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1428155585 30329 80.91.229.3 (4 Apr 2015 13:53:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Apr 2015 13:53:05 +0000 (UTC) To: 20257@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 04 15:52:51 2015 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 1YeOTs-0000g2-CC for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Apr 2015 15:51:24 +0200 Original-Received: from localhost ([::1]:33019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOTr-0003FE-Oi for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Apr 2015 09:51:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOTg-0002zq-PM for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:51:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeOTY-0006FS-3p for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:51:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOTX-0006FF-Rz for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:51:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YeOTX-0004fz-LY for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:51:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vitalie Spinu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Apr 2015 13:51:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20257 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142815545917940 (code B ref -1); Sat, 04 Apr 2015 13:51:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Apr 2015 13:50:59 +0000 Original-Received: from localhost ([127.0.0.1]:44608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeOTT-0004fI-AO for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58487) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeOTS-0004f6-3c for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeOTE-0005xr-5q for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:52 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:53644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOTD-0005xU-V9 for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOT8-0001jD-0N for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:50:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeOKn-0002QR-CT for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:42:04 -0400 Original-Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:34354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOKn-0002QN-5L for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:42:01 -0400 Original-Received: by wgbdm7 with SMTP id dm7so130237481wgb.1 for ; Sat, 04 Apr 2015 06:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=/svhAVxmUzJHYddfuKDzvnbMoabw2HaxxsUN9l96tdQ=; b=bKkuLuHIgUt/2463p9RFb3KyPaOtSu8yGMlL2cWgQevUuRxBvdEeyFgx1UL5wnazIF cWEBUagnejvGIdIHsdJBSqkzwnV31Bo3RumDPiS0x9Cegt1b19/Z2rJmiEXhe1ZzGRDO rU3z9f0nJspzkfp4Up7/YnQ2bZbsnEmm0+j5bv8w3Vpd9E+X/kxZ/NdakUGyTqe0gSmU 3YjN8CCnQZhEJkUTGf7v2n2XMbftftXAVYHdmZplT6c8GPRHMZPmxjfTzhit+B9NAi4D q1sNPHuDAT2GeZQzIdrDtIzpV8VlvOO+OryGeEz6yRvmfB9g95Pc5Q8pzu1FUGL3etOh 0q8A== X-Received: by 10.194.57.170 with SMTP id j10mr14428952wjq.102.1428154920077; Sat, 04 Apr 2015 06:42:00 -0700 (PDT) Original-Received: from localhost (dhcp-077-251-128-242.chello.nl. [77.251.128.242]) by mx.google.com with ESMTPSA id bp1sm15701787wjb.31.2015.04.04.06.41.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Apr 2015 06:41:59 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:101180 Archived-At: --=-=-= Content-Type: text/plain Hi, Do (set-visited-file-name nil) and then rename the buffer. The buffer will be auto-saved into the old visiting file. Vitalie --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Stop-auto-saving-after-set-visited-file-name-with-ni.patch >From 9b68126dfe58478424ec2b726cc307b1c0d96b1a Mon Sep 17 00:00:00 2001 From: Vitalie Spinu Date: Sat, 4 Apr 2015 15:28:07 +0200 Subject: [PATCH] Stop auto-saving after `set-visited-file-name` with nil FILENAME --- lisp/files.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 42b00ac..7d36608 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3931,17 +3931,19 @@ the old visited file has been renamed to the new name FILENAME." (make-local-variable 'backup-inhibited) (setq backup-inhibited t))) (let ((oauto buffer-auto-save-file-name)) - ;; If auto-save was not already on, turn it on if appropriate. - (if (not buffer-auto-save-file-name) - (and buffer-file-name auto-save-default - (auto-save-mode t)) - ;; If auto save is on, start using a new name. - ;; We deliberately don't rename or delete the old auto save - ;; for the old visited file name. This is because perhaps - ;; the user wants to save the new state and then compare with the - ;; previous state from the auto save file. - (setq buffer-auto-save-file-name - (make-auto-save-file-name))) + (cond ((null filename) + (setq buffer-auto-save-file-name nil)) + ((not buffer-auto-save-file-name) + ;; If auto-save was not already on, turn it on if appropriate. + (and buffer-file-name auto-save-default (auto-save-mode t)) + (t + ;; If auto save is on, start using a new name. We + ;; deliberately don't rename or delete the old auto save + ;; for the old visited file name. This is because + ;; perhaps the user wants to save the new state and then + ;; compare with the previous state from the auto save + ;; file. + (setq buffer-auto-save-file-name (make-auto-save-file-name))))) ;; Rename the old auto save file if any. (and oauto buffer-auto-save-file-name (file-exists-p oauto) -- 2.1.0 --=-=-=--