[PATCH v2 2/2] emacs: hello: allow deleting individual searches in the history
authorServilio Afre Puentes <servilio@gmail.com>
Fri, 7 Jun 2013 20:57:46 +0000 (16:57 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:55:27 +0000 (09:55 -0800)
0c/c59ac51e958b4c3b01a616cf65f4fc9eedd1ff [new file with mode: 0644]

diff --git a/0c/c59ac51e958b4c3b01a616cf65f4fc9eedd1ff b/0c/c59ac51e958b4c3b01a616cf65f4fc9eedd1ff
new file mode 100644 (file)
index 0000000..cf461cc
--- /dev/null
@@ -0,0 +1,129 @@
+Return-Path: <servilio@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 92E9E431FBC\r
+       for <notmuch@notmuchmail.org>; Fri,  7 Jun 2013 14:06:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id xTqEL9ncG2Gb for <notmuch@notmuchmail.org>;\r
+       Fri,  7 Jun 2013 14:06:00 -0700 (PDT)\r
+Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com\r
+       [209.85.214.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 0F010431FAF\r
+       for <notmuch@notmuchmail.org>; Fri,  7 Jun 2013 14:06:00 -0700 (PDT)\r
+Received: by mail-ob0-f178.google.com with SMTP id fb19so7293619obc.9\r
+       for <notmuch@notmuchmail.org>; Fri, 07 Jun 2013 14:05:59 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type:content-transfer-encoding;\r
+       bh=EWzZ9CtWdyGlyxaWNpyvKns3KgGDBMNjQnVEJJmbEn8=;\r
+       b=xhDXrV1YWX5+J3ivqCENkl8O4pKhWxd+9pNcQ6UvuG6FRQBUVKoJyAgyzZkNUr9vj+\r
+       wlCWXgJE0JomlNGFSih+y9Urh3QMHQnU9tUcOXD8/4XKtWk5xiY4HkDlfmBiaDKtU+yo\r
+       W0Ha0iK1ecmSUp132WF1UxorpwQu8vP/DSYmMUa9+SwTW1KDusXpdSoYPjIoaTNJlKcp\r
+       BwwFcksrOGKgeICzsMj6fdl7WWMmKle8AejcpqZyREGpscMvv7TZ5JiUHjkk1YcwcHOe\r
+       H6xmX+VLg1fuS/XGQue/1yUxZhVqDQL3Nz4sY5EoobOBADra3uAcRaaEHQoWy3bLjN8k\r
+       1LWQ==\r
+X-Received: by 10.60.68.13 with SMTP id r13mr345403oet.71.1370639159611;\r
+       Fri, 07 Jun 2013 14:05:59 -0700 (PDT)\r
+Received: from localhost (fammed-mip89.CSU.McMaster.CA. [130.113.164.106])\r
+       by mx.google.com with ESMTPSA id nt17sm574225obb.13.2013.06.07.14.05.58\r
+       for <notmuch@notmuchmail.org>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Fri, 07 Jun 2013 14:05:59 -0700 (PDT)\r
+From: Servilio Afre Puentes <servilio@gmail.com>\r
+To: notmuch <notmuch@notmuchmail.org>\r
+Subject: [PATCH v2 2/2] emacs: hello: allow deleting individual searches in\r
+       the history\r
+In-Reply-To: <87sj0t7idi.fsf@goose.CSU.McMaster.CA>\r
+References: <87sj0t7idi.fsf@goose.CSU.McMaster.CA>\r
+User-Agent: Notmuch/0.15.2+10~gf347fe6 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Fri, 07 Jun 2013 16:57:46 -0400\r
+Message-ID: <87mwr17i5x.fsf@goose.CSU.McMaster.CA>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 07 Jun 2013 21:06:06 -0000\r
+\r
+\r
+This commit adds an extra button at the end of the search entries that\r
+allows deleting that individual search from the history. A short\r
+confirmation (=C2=ABy=C2=BB or =C2=ABn=C2=BB) is made before taking action.\r
+---\r
+ emacs/notmuch-hello.el | 25 +++++++++++++++++++++++--\r
+ 1 file changed, 23 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 1ad1bea..147c08c 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -286,6 +286,15 @@ afterwards.")\r
+     (message "Saved '%s' as '%s'." search name)\r
+     (notmuch-hello-update)))\r
+=20\r
++(defun notmuch-hello-delete-search-from-history (widget)\r
++  (interactive)\r
++  (let ((search (widget-value\r
++               (symbol-value\r
++                (widget-get widget :notmuch-saved-search-widget)))))\r
++    (setq notmuch-search-history (delete search\r
++                                       notmuch-search-history))\r
++    (notmuch-hello-update)))\r
++\r
+ (defun notmuch-hello-longest-label (searches-alist)\r
+   (or (loop for elem in searches-alist\r
+           maximize (length (car elem)))\r
+@@ -624,7 +633,12 @@ Complete list of currently available key bindings:\r
+                                               ;; `[save]' button. 6\r
+                                               ;; for the `[save]'\r
+                                               ;; button.\r
+-                                              1 6))\r
++                                              1 6\r
++                                              ;; 1 for the space\r
++                                              ;; before the `[del]'\r
++                                              ;; button. 5 for the\r
++                                              ;; `[del]' button.\r
++                                              1 5))\r
+                                 :action (lambda (widget &rest ignore)\r
+                                           (notmuch-hello-search (widget-value widget)))\r
+                                 search))\r
+@@ -633,7 +647,14 @@ Complete list of currently available key bindings:\r
+                            :notify (lambda (widget &rest ignore)\r
+                                      (notmuch-hello-add-saved-search widget))\r
+                            :notmuch-saved-search-widget widget-symbol\r
+-                           "save"))\r
++                           "save")\r
++            (widget-insert " ")\r
++            (widget-create 'push-button\r
++                           :notify (lambda (widget &rest ignore)\r
++                                     (when (y-or-n-p "Are you sure you want to delete this search? ")\r
++                                       (notmuch-hello-delete-search-from-history widget)))\r
++                           :notmuch-saved-search-widget widget-symbol\r
++                           "del"))\r
+           (widget-insert "\n"))\r
+       (indent-rigidly start (point) notmuch-hello-indent))\r
+     nil))\r
+--=20\r
+1.8.3\r
+\r