Re: [PATCH 2/2] emacs: hello: allow deleting individual searches in the history
authorMark Walters <markwalters1009@gmail.com>
Sat, 4 May 2013 23:31:18 +0000 (00:31 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:54:37 +0000 (09:54 -0800)
d8/8224cdde7b6d954d2e983cf114d21174200052 [new file with mode: 0644]

diff --git a/d8/8224cdde7b6d954d2e983cf114d21174200052 b/d8/8224cdde7b6d954d2e983cf114d21174200052
new file mode 100644 (file)
index 0000000..8ddc7b0
--- /dev/null
@@ -0,0 +1,162 @@
+Return-Path: <m.walters@qmul.ac.uk>\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 BBB7A431FAF\r
+       for <notmuch@notmuchmail.org>; Sat,  4 May 2013 16:31:31 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+       tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+       NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 hTMU6VGimDW4 for <notmuch@notmuchmail.org>;\r
+       Sat,  4 May 2013 16:31:26 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 50CEC431FAE\r
+       for <notmuch@notmuchmail.org>; Sat,  4 May 2013 16:31:26 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+       by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1UYlvD-0005bt-Ku; Sun, 05 May 2013 00:31:24 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+       by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1UYlvD-0007fT-B5; Sun, 05 May 2013 00:31:19 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Servilio Afre Puentes <servilio@gmail.com>,\r
+       notmuch <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH 2/2] emacs: hello: allow deleting individual searches in\r
+       the history\r
+In-Reply-To: <87sj24kksc.fsf@goose.CSU.McMaster.CA>\r
+References: <87y5bwkml2.fsf@goose.CSU.McMaster.CA>\r
+       <87sj24kksc.fsf@goose.CSU.McMaster.CA>\r
+User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sun, 05 May 2013 00:31:18 +0100\r
+Message-ID: <87zjwafhkp.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record.  :)\r
+X-QM-Body-MD5: be14cbe024e71fb232c7e5a14fd55b8a (of first 20000 bytes)\r
+X-SpamAssassin-Score: -1.8\r
+X-SpamAssassin-SpamBar: -\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+       determine if it is\r
+       spam. We require at least 5.0 points to mark a message as spam.\r
+       This message scored -1.8 points.\r
+       Summary of the scoring: \r
+       * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
+       *      medium trust\r
+       *      [138.37.6.40 listed in list.dnswl.org]\r
+       * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+       provider *      (markwalters1009[at]gmail.com)\r
+       *  0.5 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Sat, 04 May 2013 23:31:31 -0000\r
+\r
+\r
+These patches both look good to me (and the lisp all looks fine) modulo\r
+a trivial style comment and a little bikeshedding.\r
+\r
+For the bikeshedding I would prefer that the first patch was a y-or-n-p\r
+(as Jani suggested) and that the second didn't query at all (the\r
+dataloss potential from deleting a single search from the history is\r
+pretty small)\r
+\r
+\r
+On Fri, 03 May 2013, Servilio Afre Puentes <servilio@gmail.com> wrote:\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 actio=\r
+n.\r
+> ---\r
+>  emacs/notmuch-hello.el | 26 ++++++++++++++++++++++++--\r
+>  1 file changed, 24 insertions(+), 2 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+> index aa063b7..9fbbdc9 100644\r
+> --- a/emacs/notmuch-hello.el\r
+> +++ b/emacs/notmuch-hello.el\r
+> @@ -286,6 +286,16 @@ afterwards.")\r
+>      (message "Saved '%s' as '%s'." search name)\r
+>      (notmuch-hello-update)))\r
+>=20=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
+> +\r
+\r
+Trivial formatting/style point: notmuch goes for putting all the braces\r
+after the final function.\r
+\r
+Best wishes\r
+\r
+Mark\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 +634,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 +648,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
+ ")\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.2.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r