[PATCH v2 1/2] emacs: hello: ask confirmation for clearing recent searches

Subject: [PATCH v2 1/2] emacs: hello: ask confirmation for clearing recent searches

Date: Fri, 07 Jun 2013 16:55:57 -0400

To: notmuch

Cc:

From: Servilio Afre Puentes


The button to clear the recent searches in notmuch-hello is easy to
press accidentally while moving around the, clearing potentially
useful searches with no way of recovering them.
---
 emacs/notmuch-hello.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index c1c6f4b..1ad1bea 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -599,8 +599,9 @@ Complete list of currently available key bindings:
     (widget-insert "Recent searches: ")
     (widget-create 'push-button
 		   :notify (lambda (&rest ignore)
-			     (setq notmuch-search-history nil)
-			     (notmuch-hello-update))
+			     (when (y-or-n-p "Are you sure you want to clear the searches? ")
+			       (setq notmuch-search-history nil)
+			       (notmuch-hello-update)))
 		   "clear")
     (widget-insert "\n\n")
     (let ((start (point)))
-- 
1.8.3


Thread: