aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ring.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ring.c')
-rw-r--r--src/ring.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ring.c b/src/ring.c
index e42ff14..afd6b25 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -334,11 +334,26 @@ teco_ring_backup(void)
continue;
g_autofree gchar *filename_backup = teco_buffer_get_backup(buffer);
+
+ g_autoptr(GIOChannel) channel = g_io_channel_new_file(filename_backup, "w", NULL);
+ if (!channel)
+ continue;
+
/*
+ * teco_view_save_to_channel() expects a buffered and blocking channel.
+ */
+ g_io_channel_set_encoding(channel, NULL, NULL);
+ g_io_channel_set_buffered(channel, TRUE);
+
+ /*
+ * This does not use teco_view_save_to_file() since we must not
+ * emit undo tokens.
+ *
* FIXME: Errors are silently ignored.
* Should we log warnings instead?
*/
- teco_view_save(buffer->view, filename_backup, NULL);
+ if (!teco_view_save_to_channel(buffer->view, channel, NULL))
+ continue;
buffer->state = TECO_BUFFER_DIRTY_BACKEDUP;
}