aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Servilio Afre Puentes <servilio@gmail.com>2013-06-07 16:57:46 -0400
committerGravatar David Bremner <bremner@debian.org>2013-06-08 20:37:46 -0300
commit10aac899117e96606b690e5788924ccc703c53c8 (patch)
tree53a2d09dcc0e7c67725c1c2f47f352f4c35123a8 /emacs
parent486340e28ea9d0ac3ed3e7dc463a67ddb2d7d061 (diff)
emacs: hello: allow deleting individual searches in the history
This commit adds an extra button at the end of the search entries that allows deleting that individual search from the history. A short confirmation («y» or «n») is made before taking action.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-hello.el25
1 files changed, 23 insertions, 2 deletions
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1ad1beaf..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)))
@@ -624,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))
@@ -633,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))