X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-hello.el;h=147c08cc2079c41c5bdc72da2366db8af65f3041;hb=634914064bdfa4acb5b489dc03bd4ff5dcda3170;hp=c1c6f4b42186698f75fee9549ca1ab62daf58bd3;hpb=f0dfda5c7797f9db81ce35d270fe0ac406c7fca1;p=notmuch diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index c1c6f4b4..147c08cc 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -286,6 +286,15 @@ afterwards.") (message "Saved '%s' as '%s'." search name) (notmuch-hello-update))) +(defun notmuch-hello-delete-search-from-history (widget) + (interactive) + (let ((search (widget-value + (symbol-value + (widget-get widget :notmuch-saved-search-widget))))) + (setq notmuch-search-history (delete search + notmuch-search-history)) + (notmuch-hello-update))) + (defun notmuch-hello-longest-label (searches-alist) (or (loop for elem in searches-alist maximize (length (car elem))) @@ -599,8 +608,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))) @@ -623,7 +633,12 @@ Complete list of currently available key bindings: ;; `[save]' button. 6 ;; for the `[save]' ;; button. - 1 6)) + 1 6 + ;; 1 for the space + ;; before the `[del]' + ;; button. 5 for the + ;; `[del]' button. + 1 5)) :action (lambda (widget &rest ignore) (notmuch-hello-search (widget-value widget))) search)) @@ -632,7 +647,14 @@ Complete list of currently available key bindings: :notify (lambda (widget &rest ignore) (notmuch-hello-add-saved-search widget)) :notmuch-saved-search-widget widget-symbol - "save")) + "save") + (widget-insert " ") + (widget-create 'push-button + :notify (lambda (widget &rest ignore) + (when (y-or-n-p "Are you sure you want to delete this search? ") + (notmuch-hello-delete-search-from-history widget))) + :notmuch-saved-search-widget widget-symbol + "del")) (widget-insert "\n")) (indent-rigidly start (point) notmuch-hello-indent)) nil))