From: Eli Zaretskii <eliz@gnu.org>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 25470@debbugs.gnu.org
Subject: bug#25470: 26.0.50; Lock files not removed when auto-save-visited-file-name is t
Date: Wed, 18 Jan 2017 19:49:53 +0200 [thread overview]
Message-ID: <8360lc8dha.fsf@gnu.org> (raw)
In-Reply-To: <wvr4lgu9zd3u.fsf@gmail.com> (message from Philipp Stephani on Tue, 17 Jan 2017 20:43:33 +0100)
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Tue, 17 Jan 2017 20:43:33 +0100
>
>
> Customize auto-save-visited-file to t, then edit a buffer and wait until
> it's auto-saved. Even after auto-saving the lock file (.#) is still
> present. It should be removed after a successful auto-save.
Does the patch below give good results?
diff --git a/src/fileio.c b/src/fileio.c
index be52d0f..8c8cba9 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5142,19 +5142,26 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
if (! ok)
report_file_errno ("Write error", filename, save_errno);
+ bool auto_saving_into_visited_file =
+ auto_saving
+ && ! NILP (Fstring_equal (BVAR (current_buffer, filename),
+ BVAR (current_buffer, auto_save_file_name)));
if (visiting)
{
SAVE_MODIFF = MODIFF;
XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
bset_filename (current_buffer, visit_file);
update_mode_lines = 14;
+ if (auto_saving_into_visited_file)
+ unlock_file (lockname);
}
else if (quietly)
{
- if (auto_saving
- && ! NILP (Fstring_equal (BVAR (current_buffer, filename),
- BVAR (current_buffer, auto_save_file_name))))
- SAVE_MODIFF = MODIFF;
+ if (auto_saving_into_visited_file)
+ {
+ SAVE_MODIFF = MODIFF;
+ unlock_file (lockname);
+ }
return Qnil;
}
next prev parent reply other threads:[~2017-01-18 17:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-17 19:43 bug#25470: 26.0.50; Lock files not removed when auto-save-visited-file-name is t Philipp Stephani
2017-01-17 20:05 ` Eli Zaretskii
2017-01-17 20:12 ` Eli Zaretskii
2017-01-18 17:49 ` Eli Zaretskii [this message]
2017-01-18 18:29 ` Philipp Stephani
2017-01-18 18:37 ` Eli Zaretskii
2017-01-18 18:34 ` Glenn Morris
2017-01-18 19:26 ` Eli Zaretskii
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=8360lc8dha.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=25470@debbugs.gnu.org \
--cc=p.stephani2@gmail.com \
/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.