summary history branches tags files
commit:b958c01bda2ebd77e7fc25faf41474fec746ef46
author:Trevor Bentley
committer:Trevor Bentley
date:Thu Dec 3 00:46:49 2020 +0100
parents:c393fb2cefc4f51c074f1232a003762d54558f3b
improve init/deinit and add restart
diff --git a/snitch.el b/snitch.el
line changes: +9/-3
index 76414f2..e2c7fbb
--- a/snitch.el
+++ b/snitch.el
@@ -614,14 +614,20 @@ network connections."
 (defun snitch-init ()
   "Initialize snitch.el firewall, enabling globally."
   (interactive)
-  (snitch--register-wrapper-fns))
+  (when (snitch--register-wrapper-fns) t))
 
 (defun snitch-deinit ()
   "Unload snitch.el firewall, disabling globally."
   (interactive)
   (snitch--stop-log-prune-timer)
-  (unload-feature 'snitch)
-  (require 'snitch))
+  (unload-feature 'snitch t)
+  (when (require 'snitch) t))
+
+(defun snitch-restart ()
+  "Unload snitch.el and re-launch snitch firewall."
+  (interactive)
+  (when (snitch-deinit)
+    (snitch-init)))
 
 (provide 'snitch)