From: Vitalie Spinu <spinuvit@gmail.com>
To: 20257@debbugs.gnu.org
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 [thread overview]
Message-ID: <874mowrowp.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 135 bytes --]
Hi,
Do (set-visited-file-name nil) and then rename the buffer. The buffer
will be auto-saved into the old visiting file.
Vitalie
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Stop-auto-saving-after-set-visited-file-name-with-ni.patch --]
[-- Type: text/x-diff, Size: 1997 bytes --]
From 9b68126dfe58478424ec2b726cc307b1c0d96b1a Mon Sep 17 00:00:00 2001
From: Vitalie Spinu <spinuvit@gmail.com>
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
next reply other threads:[~2015-04-04 13:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-04 13:41 Vitalie Spinu [this message]
2015-04-04 15:32 ` bug#20257: [PATCH] 24.4.90; set-visited-file-name doesn't reset buffer-auto-save-file-name Vitalie Spinu
2015-04-07 18:57 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874mowrowp.fsf@gmail.com \
--to=spinuvit@gmail.com \
--cc=20257@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.