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 17:32:35 +0200 Message-ID: <87vbhbrjsc.fsf@gmail.com> References: <874mowrowp.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1428161603 27532 80.91.229.3 (4 Apr 2015 15:33:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Apr 2015 15:33:23 +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 17:33:11 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 1YeQ4L-000564-Nt for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Apr 2015 17:33:09 +0200 Original-Received: from localhost ([::1]:33454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeQ4L-0001rK-1B for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Apr 2015 11:33:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeQ4I-0001rD-2F for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 11:33:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeQ4E-0007wB-Sq for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 11:33:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeQ4E-0007w5-Oh for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 11:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YeQ4E-0007A2-CD for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 11:33:02 -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 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 Original-Received: via spool by 20257-submit@debbugs.gnu.org id=B20257.142816156527497 (code B ref 20257); Sat, 04 Apr 2015 15:33:02 +0000 Original-Received: (at 20257) by debbugs.gnu.org; 4 Apr 2015 15:32:45 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <874mowrowp.fsf@gmail.com> (Vitalie Spinu's message of "Sat, 04 Apr 2015 15:41:58 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.90 (gnu/linux) 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:101188 Archived-At: --=-=-= 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 --=-=-=--