From ca6c625401d82cff596dfa028873407276de6325 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Thu, 3 Dec 2015 20:08:01 +0100 Subject: [PATCH 1/4] Add newline at EOF. --- alot/init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alot/init.py b/alot/init.py index 439280962..9f790acff 100755 --- a/alot/init.py +++ b/alot/init.py @@ -186,4 +186,4 @@ def main(): UI(dbman, cmdstring) if __name__ == '__main__': - main() \ No newline at end of file + main() From 14fa2133fef5004f4af120ea43e7dd3fa2805c36 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Thu, 3 Dec 2015 20:07:38 +0100 Subject: [PATCH 2/4] Call the `exit` hook at the end of main(). --- alot/init.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/alot/init.py b/alot/init.py index 9f790acff..165f9092d 100755 --- a/alot/init.py +++ b/alot/init.py @@ -185,5 +185,10 @@ def main(): # set up and start interface UI(dbman, cmdstring) + # run the exit hook + exit_hook = settings.get_hook('exit') + if exit_hook is not None: + exit_hook() + if __name__ == '__main__': main() From d20f22eddcc7df94b1e6c68fd2bd3994d37d9bf5 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Fri, 4 Dec 2015 12:22:42 +0100 Subject: [PATCH 3/4] Mention exit hook in docs. --- docs/source/configuration/hooks.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/configuration/hooks.rst b/docs/source/configuration/hooks.rst index dba5e6eb0..1709df68f 100644 --- a/docs/source/configuration/hooks.rst +++ b/docs/source/configuration/hooks.rst @@ -174,3 +174,7 @@ Apart from command pre- and posthooks, the following hooks will be interpreted: :type buf: alot.buffer.Buffer :param success: true if successfully focused buffer :type success: boolean + +.. py:function:: exit() + + run just before the program exits From 1a863d9e5ce64633a19928e7890a274c6e6c3368 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Fri, 4 Dec 2015 12:25:25 +0100 Subject: [PATCH 4/4] Update NEWS. --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index ffbe84b1a..4248def49 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ master: * switched to setuptools * detached urwidtrees library into separate project (and new dependency) +* new "exit" hook, called just before the program shuts down 0.3.6: * implement vim-style "move last" command (bound to G)