From unknown Sat Jun 14 05:12:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20257: [PATCH] 24.4.90; set-visited-file-name doesn't reset buffer-auto-save-file-name 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 To: 20257@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.142815545917940 (code B ref -1); Sat, 04 Apr 2015 13:51:03 +0000 Received: (at submit) by debbugs.gnu.org; 4 Apr 2015 13:50:59 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 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 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 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 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 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) 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) From: Vitalie Spinu Date: Sat, 04 Apr 2015 15:41:58 +0200 Message-ID: <874mowrowp.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= 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 --=-=-=-- From unknown Sat Jun 14 05:12:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20257: [PATCH] 24.4.90; set-visited-file-name doesn't reset buffer-auto-save-file-name Resent-From: Vitalie Spinu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Apr 2015 15:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20257 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 20257@debbugs.gnu.org Received: via spool by 20257-submit@debbugs.gnu.org id=B20257.142816156527497 (code B ref 20257); Sat, 04 Apr 2015 15:33:02 +0000 Received: (at 20257) by debbugs.gnu.org; 4 Apr 2015 15:32:45 +0000 Received: from localhost ([127.0.0.1]:44844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeQ3w-00079R-Dj for submit@debbugs.gnu.org; Sat, 04 Apr 2015 11:32:44 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:37406) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeQ3u-00079D-8G for 20257@debbugs.gnu.org; Sat, 04 Apr 2015 11:32:42 -0400 Received: by wiaa2 with SMTP id a2so166991565wia.0 for <20257@debbugs.gnu.org>; Sat, 04 Apr 2015 08:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=q/2RgJWMbcUUYKC1HrXzHEY+O4Rv66DjlcT9BYk1hg0=; b=Q2S0l3BWOBleIZh6jnzJoUBKy0QkWqgWuluA6jO6+EuTHhVbwBoRpC13hyUQJNqcgh mcb3bH/uAQ8Y8m8BYHfELrMLZtHePdR32K8KVDQ45lUEikOsfOZHRr1k7dIzJUqsuj6r 3H7XPKXw+fYLGYd6s2G5umG76vas0fT8k6ZfId+beiMeRCZgEi9aVJhf9kP54pSTOBop 2P5NVHCNFPjvzRwJlPh0+EMQk3pPADXGOON6O+vCd78wGGEzRm6X55YePbB5eDAkAnTz jQGlr7THcvdtjRI3SltzbXV7oQfNgDR79RLqyrtW0hBvD82ODnj98v/pkAjEKjFIThoY N6jA== X-Received: by 10.180.85.195 with SMTP id j3mr14498509wiz.21.1428161556643; Sat, 04 Apr 2015 08:32:36 -0700 (PDT) Received: from localhost (dhcp-077-251-128-242.chello.nl. [77.251.128.242]) by mx.google.com with ESMTPSA id ha10sm16037581wjc.37.2015.04.04.08.32.35 for <20257@debbugs.gnu.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Apr 2015 08:32:35 -0700 (PDT) From: Vitalie Spinu References: <874mowrowp.fsf@gmail.com> Date: Sat, 04 Apr 2015 17:32:35 +0200 In-Reply-To: <874mowrowp.fsf@gmail.com> (Vitalie Spinu's message of "Sat, 04 Apr 2015 15:41:58 +0200") Message-ID: <87vbhbrjsc.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.90 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Fix a typo in the previous patch. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-auto-save-after-set-visited-file-name-nil.patch >From 06533b83650f24fe1138ab043c9ac93e0ac59ae2 Mon Sep 17 00:00:00 2001 From: Vitalie Spinu Date: Sat, 4 Apr 2015 15:28:07 +0200 Subject: [PATCH] Don't auto-save after (set-visited-file-name nil) --- lisp/files.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 42b00ac..5cff442 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 --=-=-=-- From unknown Sat Jun 14 05:12:42 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Vitalie Spinu Subject: bug#20257: closed (Re: bug#20257: [PATCH] 24.4.90; set-visited-file-name doesn't reset buffer-auto-save-file-name) Message-ID: References: <874mowrowp.fsf@gmail.com> X-Gnu-PR-Message: they-closed 20257 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 20257@debbugs.gnu.org Date: Tue, 07 Apr 2015 18:59:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1428433143-6490-1" This is a multi-part message in MIME format... ------------=_1428433143-6490-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #20257: [PATCH] 24.4.90; set-visited-file-name doesn't reset buffer-auto-sa= ve-file-name which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 20257@debbugs.gnu.org. --=20 20257: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20257 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1428433143-6490-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 20257-done) by debbugs.gnu.org; 7 Apr 2015 18:58:02 +0000 Received: from localhost ([127.0.0.1]:48191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YfYhF-0001fP-O3 for submit@debbugs.gnu.org; Tue, 07 Apr 2015 14:58:01 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:46374) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YfYhD-0001f1-KN for 20257-done@debbugs.gnu.org; Tue, 07 Apr 2015 14:57:59 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 050E19C157; Tue, 7 Apr 2015 14:57:50 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 37B121E5B8B; Tue, 7 Apr 2015 14:57:26 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 1A5C9B4122; Tue, 7 Apr 2015 14:57:25 -0400 (EDT) From: Stefan Monnier To: Vitalie Spinu Subject: Re: bug#20257: [PATCH] 24.4.90; set-visited-file-name doesn't reset buffer-auto-save-file-name Message-ID: References: <874mowrowp.fsf@gmail.com> <87vbhbrjsc.fsf@gmail.com> Date: Tue, 07 Apr 2015 14:57:25 -0400 In-Reply-To: <87vbhbrjsc.fsf@gmail.com> (Vitalie Spinu's message of "Sat, 04 Apr 2015 17:32:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 20257-done Cc: 20257-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Thank you, installed into master, Stefan ------------=_1428433143-6490-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Apr 2015 13:50:59 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 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 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 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 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 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) 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) From: Vitalie Spinu To: bug-gnu-emacs@gnu.org Subject: [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> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= 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 --=-=-=-- ------------=_1428433143-6490-1--