The quit_hook runs when the quit command is used, but not
a) if conkeror exits because the last buffer is killed (eg. with 'q')
b) when "conkeror -batch" exits
The patch below fixes case a but not case b. I'm interested in the
latter because I'd like to add a summary to the end of a walnut test
suite run. Any suggestions?
--8<--
Subject: [PATCH] Run quit_hook regardless of how conkeror is exited
Not for application; insufficient and includes a debugging output.
---
modules/commands.js | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/modules/commands.js b/modules/commands.js
index 0f82e36..afca07a 100644
--- a/modules/commands.js
+++ b/modules/commands.js
@@ -9,8 +9,17 @@
define_hook("quit_hook");
+let quit_observer = {
+ observe : function (subject, topic, data) {
+ quit_hook.run();
+ }
+}
+
+observer_service.addObserver(quit_observer, "quit-application", false);
+
+add_hook("quit_hook", function () dumpln("Bye"));
+
function quit () {
- quit_hook.run();
var appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup);
appStartup.quit(appStartup.eAttemptQuit);
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror