diff options
| author | Eli Zaretskii | 2017-01-18 20:36:14 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-01-18 20:36:14 +0200 |
| commit | 5304cb983146fe55ea1b4963ffc756ca4325673d (patch) | |
| tree | 2363dd73e787ae9b8f9f87d859414d2a61e18f80 /src | |
| parent | 5fefaaa8c0696ba4b7b6e1e89267aa10fff88b31 (diff) | |
| download | emacs-5304cb983146fe55ea1b4963ffc756ca4325673d.tar.gz emacs-5304cb983146fe55ea1b4963ffc756ca4325673d.zip | |
Remove lock file when auto-saving into the visited file
* src/fileio.c (write_region): When auto-saving into the visited
file, unlock the file whenever we mark the buffer unmodified.
(Bug#25470)
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/fileio.c b/src/fileio.c index be52d0f3d0e..8c8cba9e49c 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5142,19 +5142,26 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, | |||
| 5142 | if (! ok) | 5142 | if (! ok) |
| 5143 | report_file_errno ("Write error", filename, save_errno); | 5143 | report_file_errno ("Write error", filename, save_errno); |
| 5144 | 5144 | ||
| 5145 | bool auto_saving_into_visited_file = | ||
| 5146 | auto_saving | ||
| 5147 | && ! NILP (Fstring_equal (BVAR (current_buffer, filename), | ||
| 5148 | BVAR (current_buffer, auto_save_file_name))); | ||
| 5145 | if (visiting) | 5149 | if (visiting) |
| 5146 | { | 5150 | { |
| 5147 | SAVE_MODIFF = MODIFF; | 5151 | SAVE_MODIFF = MODIFF; |
| 5148 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); | 5152 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); |
| 5149 | bset_filename (current_buffer, visit_file); | 5153 | bset_filename (current_buffer, visit_file); |
| 5150 | update_mode_lines = 14; | 5154 | update_mode_lines = 14; |
| 5155 | if (auto_saving_into_visited_file) | ||
| 5156 | unlock_file (lockname); | ||
| 5151 | } | 5157 | } |
| 5152 | else if (quietly) | 5158 | else if (quietly) |
| 5153 | { | 5159 | { |
| 5154 | if (auto_saving | 5160 | if (auto_saving_into_visited_file) |
| 5155 | && ! NILP (Fstring_equal (BVAR (current_buffer, filename), | 5161 | { |
| 5156 | BVAR (current_buffer, auto_save_file_name)))) | 5162 | SAVE_MODIFF = MODIFF; |
| 5157 | SAVE_MODIFF = MODIFF; | 5163 | unlock_file (lockname); |
| 5164 | } | ||
| 5158 | 5165 | ||
| 5159 | return Qnil; | 5166 | return Qnil; |
| 5160 | } | 5167 | } |