aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ring.h
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2025-12-29 00:31:20 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2025-12-29 00:42:41 +0100
commit713462dfdf3c46a998b43525cbbf5ae0ec8ea84b (patch)
tree0d54c9634677ef326892277d06d758bd2c718830 /src/ring.h
parent0b593eb7d0e6907b19cdbb605caf1becae351004 (diff)
avoid unnecessary cleanups of recovery files
* After the last commit 0b593eb7d0e6907b19cdbb605caf1becae351004 we tried to clean up (unlink) recovery files for all dirty buffers. This resulted in superfluous file deletions before any recovery file was dumped; after disabling file recovery and even in batch mode. It's not tolerable that SciTECO scripts try to unlink files as a side effect e.g. of EW. Also, sometimes you may have to clean up recovery dumps even in batch mode, e.g. in Quit hooks. * Also, it was broken for dirty unnamed buffers, which would cause glib errors. * That's why we had to add another buffer state for dirty files with outdated recovery dumps (TECO_BUFFER_DIRTY_OUTDATED_DUMP). Once a dump was written, a buffer never directly transitions into the TECO_BUFFER_DIRTY_NO_DUMP state again. We can now reliably unlink() only where we'd expect a recovery file to exist in the first place.
Diffstat (limited to 'src/ring.h')
-rw-r--r--src/ring.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ring.h b/src/ring.h
index 4624983..d81c3db 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -28,10 +28,12 @@
typedef enum {
/** buffer is freshly opened or saved */
TECO_BUFFER_CLEAN = 0,
- /** buffer modified - if a recovery file already exists, it is outdated */
- TECO_BUFFER_DIRTY,
- /** buffer modified and recovery file already written */
- TECO_BUFFER_DIRTY_DUMPED
+ /** buffer modified, but a recovery file does not yet exist */
+ TECO_BUFFER_DIRTY_NO_DUMP,
+ /** buffer modified, recovery file outdated */
+ TECO_BUFFER_DIRTY_OUTDATED_DUMP,
+ /** buffer modified and recovery file is up to date */
+ TECO_BUFFER_DIRTY_RECENT_DUMP
} teco_buffer_state_t;
typedef struct teco_buffer_t {