From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 92E9E431FBC for ; Fri, 7 Jun 2013 14:06:06 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xTqEL9ncG2Gb for ; Fri, 7 Jun 2013 14:06:00 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0F010431FAF for ; Fri, 7 Jun 2013 14:06:00 -0700 (PDT) Received: by mail-ob0-f178.google.com with SMTP id fb19so7293619obc.9 for ; Fri, 07 Jun 2013 14:05:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type:content-transfer-encoding; bh=EWzZ9CtWdyGlyxaWNpyvKns3KgGDBMNjQnVEJJmbEn8=; b=xhDXrV1YWX5+J3ivqCENkl8O4pKhWxd+9pNcQ6UvuG6FRQBUVKoJyAgyzZkNUr9vj+ wlCWXgJE0JomlNGFSih+y9Urh3QMHQnU9tUcOXD8/4XKtWk5xiY4HkDlfmBiaDKtU+yo W0Ha0iK1ecmSUp132WF1UxorpwQu8vP/DSYmMUa9+SwTW1KDusXpdSoYPjIoaTNJlKcp BwwFcksrOGKgeICzsMj6fdl7WWMmKle8AejcpqZyREGpscMvv7TZ5JiUHjkk1YcwcHOe H6xmX+VLg1fuS/XGQue/1yUxZhVqDQL3Nz4sY5EoobOBADra3uAcRaaEHQoWy3bLjN8k 1LWQ== X-Received: by 10.60.68.13 with SMTP id r13mr345403oet.71.1370639159611; Fri, 07 Jun 2013 14:05:59 -0700 (PDT) Received: from localhost (fammed-mip89.CSU.McMaster.CA. [130.113.164.106]) by mx.google.com with ESMTPSA id nt17sm574225obb.13.2013.06.07.14.05.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 07 Jun 2013 14:05:59 -0700 (PDT) From: Servilio Afre Puentes To: notmuch Subject: [PATCH v2 2/2] emacs: hello: allow deleting individual searches in the history In-Reply-To: <87sj0t7idi.fsf@goose.CSU.McMaster.CA> References: <87sj0t7idi.fsf@goose.CSU.McMaster.CA> User-Agent: Notmuch/0.15.2+10~gf347fe6 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Fri, 07 Jun 2013 16:57:46 -0400 Message-ID: <87mwr17i5x.fsf@goose.CSU.McMaster.CA> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2013 21:06:06 -0000 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 (=C2=ABy=C2=BB or =C2=ABn=C2=BB) is made before taking action. --- emacs/notmuch-hello.el | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 1ad1bea..147c08c 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))) =20 +(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)) --=20 1.8.3