]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: hello: ask confirmation for clearing recent searches
authorServilio Afre Puentes <servilio@gmail.com>
Fri, 7 Jun 2013 20:55:57 +0000 (16:55 -0400)
committerDavid Bremner <bremner@debian.org>
Sat, 8 Jun 2013 23:37:35 +0000 (20:37 -0300)
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

index c1c6f4b42186698f75fee9549ca1ab62daf58bd3..1ad1beafdc8ff5f40084887a9be489b7c2b262db 100644 (file)
@@ -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)))