summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2016-03-12 14:24:37 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2016-03-12 14:24:37 +0000
commit247cf303d83cc5fe045312c48cbda24a4a6a6bc0 (patch)
treeb41a034fcb81524da2fdbdf7f4875b1e7f0a21f1 /alot
parentc5af54797496352e418c829e025cac8956138c3a (diff)
parenta0034268573062075615ff117c74da65b2791af2 (diff)
Merge branch '0.3.8-polish-exit-flush-853' into testing
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/globals.py32
-rw-r--r--alot/defaults/alot.rc.spec3
2 files changed, 22 insertions, 13 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index b0ca6b7b..d234f54f 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -41,15 +41,22 @@ class ExitCommand(Command):
"""shut down cleanly"""
@inlineCallbacks
def apply(self, ui):
- msg = 'index not fully synced. ' if ui.db_was_locked else ''
- if settings.get('bug_on_exit') or ui.db_was_locked:
- msg += 'really quit?'
+ if settings.get('bug_on_exit'):
+ msg = 'really quit?'
if (yield ui.choice(msg, select='yes', cancel='no',
msg_position='left')) == 'no':
return
+
for b in ui.buffers:
b.cleanup()
- ui.exit()
+ ui.apply_command(FlushCommand(callback=ui.exit))
+
+ if ui.db_was_locked:
+ msg = 'Database locked. Exit without saving?'
+ if (yield ui.choice(msg, select='yes', cancel='no',
+ msg_position='left')) == 'no':
+ return
+ ui.exit()
@registerCommand(MODE, 'search', usage='search query', arguments=[
@@ -536,14 +543,15 @@ class FlushCommand(Command):
except DatabaseLockedError:
timeout = settings.get('flush_retry_timeout')
- def f(*args):
- self.apply(ui)
- ui.mainloop.set_alarm_in(timeout, f)
- if not ui.db_was_locked:
- if not self.silent:
- ui.notify(
- 'index locked, will try again in %d secs' % timeout)
- ui.db_was_locked = True
+ if timeout > 0:
+ def f(*args):
+ self.apply(ui)
+ ui.mainloop.set_alarm_in(timeout, f)
+ if not ui.db_was_locked:
+ if not self.silent:
+ ui.notify(
+ 'index locked, will try again in %d secs' % timeout)
+ ui.db_was_locked = True
ui.update()
return
diff --git a/alot/defaults/alot.rc.spec b/alot/defaults/alot.rc.spec
index 6f98dca0..00173d47 100644
--- a/alot/defaults/alot.rc.spec
+++ b/alot/defaults/alot.rc.spec
@@ -85,7 +85,8 @@ edit_headers_whitelist = force_list(default=list(*,))
# see :ref:`edit_headers_whitelist <edit-headers-whitelist>`
edit_headers_blacklist = force_list(default=list(Content-Type,MIME-Version,References,In-Reply-To))
-# timeout in seconds after a failed attempt to writeout the database is repeated
+# timeout in seconds after a failed attempt to writeout the database is
+# repeated. Set to 0 for no retry.
flush_retry_timeout = integer(default=5)
# where to look up hooks