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