From a26ae49d76a2ce7db7a8d6ff7d91fe8e6b5021b4 Mon Sep 17 00:00:00 2001 From: Servilio Afre Puentes Date: Sat, 4 May 2013 13:58:27 +2000 Subject: [PATCH] [PATCH 2/2] emacs: hello: allow deleting individual searches in the history --- 8c/ebae09f8a59880685c72b9ebb116219afa7748 | 130 ++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 8c/ebae09f8a59880685c72b9ebb116219afa7748 diff --git a/8c/ebae09f8a59880685c72b9ebb116219afa7748 b/8c/ebae09f8a59880685c72b9ebb116219afa7748 new file mode 100644 index 000000000..2934546f8 --- /dev/null +++ b/8c/ebae09f8a59880685c72b9ebb116219afa7748 @@ -0,0 +1,130 @@ +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 53D6F431FB6 + for ; Fri, 3 May 2013 11:11:02 -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 JSCGfNaJQJsy for ; + Fri, 3 May 2013 11:10:56 -0700 (PDT) +Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com + [209.85.223.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D396B431FAF + for ; Fri, 3 May 2013 11:10:56 -0700 (PDT) +Received: by mail-ie0-f182.google.com with SMTP id a14so2142023iee.13 + for ; Fri, 03 May 2013 11:10:55 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=x-received:from:to:subject:in-reply-to:references:user-agent:date + :message-id:mime-version:content-type:content-transfer-encoding; + bh=GURfr1DyEIc1D6a5L9fBi/rrs1MRepT1JbVLAGHwbJA=; + b=aNuJ97kys3YgHQdnnwMiWK7YTuW5xcnRKVSySW1PZVFaHBVFzy6uWyQcLtYn+uIeRf + MyR0ZzZDyR+CsQs/p260IUPMnOvnnuvVRyHoxA3IwAnea0QgDK7xdrsxxYPkGa+XyVAq + X/hLKzrogaHRLg6eCDqCNi99irCA8eF9DQEFKB1W6oNyzEXu0rGKhHM09NLOrDHZYQ5B + Hz/oDD09a4ocxY1Oj6QDDualzKPhZBtAsxHCG1cej0mrmeEiQpUMN7M2Rr9hDdJxH/US + TA8G62Ze7AudltmJV3xvKLfgivCgFrUEW0qDIcNfZnH5Fny8lntNg0Xly0PwbfjIQ1sf + Br5A== +X-Received: by 10.50.70.9 with SMTP id i9mr16908662igu.60.1367604342799; + Fri, 03 May 2013 11:05:42 -0700 (PDT) +Received: from localhost (fammed-mip89.CSU.McMaster.CA. [130.113.164.106]) + by mx.google.com with ESMTPSA id c2sm34235778igv.1.2013.05.03.11.05.41 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Fri, 03 May 2013 11:05:41 -0700 (PDT) +From: Servilio Afre Puentes +To: notmuch +Subject: [PATCH 2/2] emacs: hello: allow deleting individual searches in the + history +In-Reply-To: <87y5bwkml2.fsf@goose.CSU.McMaster.CA> +References: <87y5bwkml2.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, 03 May 2013 13:58:27 -0400 +Message-ID: <87sj24kksc.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, 03 May 2013 18:11:02 -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 | 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 ++(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 +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 + -- 2.26.2