From a046f2d3d6052b4e4845ab2d265017ec4e11121e Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Tue, 2 Sep 2014 19:56:04 +0100 Subject: [PATCH] [PATCH v2] emacs: jump: sort-order bugfix --- b1/fdd5116a9ebba13e9b636a06a7cc5f41b1ee57 | 117 ++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 b1/fdd5116a9ebba13e9b636a06a7cc5f41b1ee57 diff --git a/b1/fdd5116a9ebba13e9b636a06a7cc5f41b1ee57 b/b1/fdd5116a9ebba13e9b636a06a7cc5f41b1ee57 new file mode 100644 index 000000000..7c50030f7 --- /dev/null +++ b/b1/fdd5116a9ebba13e9b636a06a7cc5f41b1ee57 @@ -0,0 +1,117 @@ +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 1D54B431FB6 + for ; Tue, 2 Sep 2014 11:56:16 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=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 Tp19j1Zt1E1E for ; + Tue, 2 Sep 2014 11:56:12 -0700 (PDT) +Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com + [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 5396F431FAF + for ; Tue, 2 Sep 2014 11:56:12 -0700 (PDT) +Received: by mail-wi0-f181.google.com with SMTP id e4so8460713wiv.8 + for ; Tue, 02 Sep 2014 11:56:11 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=cVqEsYRH4tK+Nu22njLQhfxrgzaDCvGWFGcVn9VB6AY=; + b=NR/PXZBRom5vs4QzaPTlTcew8o+Hbk0h8FlfrTPUiag14ZNUvzyCuolYqHAOJVunnD + E+8OLGj9imHpgCLRG+WYKMsX5SZcUN8BS+z27fJAi9Q/ECN/tA5hqI+DnPnDfsdZovYP + C2ul0+Ftsw1XYsiB69QO2kPOVs+KBN9Wb44gGzH3vVot5Wn8ML0nWY1Fk4J71z2O5qyX + kAl1hsEiVX7gdV460iT1lUTCB66rXkMEhLcNDOYLe6Nso1BtZtS2BAkv+cX+MTpRsjJQ + Xbc6QQLhh1EsjxQ1H0SSDFNkXxaYT9cX/qFbDqBvVoEQvwMlKrLwNoZmFa9ChhLm1oJz + lRTQ== +X-Received: by 10.180.207.105 with SMTP id lv9mr29463607wic.23.1409684170929; + Tue, 02 Sep 2014 11:56:10 -0700 (PDT) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by mx.google.com with ESMTPSA id + ys5sm11262926wjc.25.2014.09.02.11.56.09 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Tue, 02 Sep 2014 11:56:09 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2] emacs: jump: sort-order bugfix +Date: Tue, 2 Sep 2014 19:56:04 +0100 +Message-Id: <1409684164-28407-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1409661049-23417-1-git-send-email-markwalters1009@gmail.com> +References: <1409661049-23417-1-git-send-email-markwalters1009@gmail.com> +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: Tue, 02 Sep 2014 18:56:16 -0000 + +default-value needs its argument to be quoted. + +Slightly strangely default-value of 't or nil is 't or nil +respectively so the code + +(default-value notmuch-search-oldest-first) + +just gives the current value of notmuch-search-oldest-first rather +than intended default-value of this variable. + +The symptom is that if you are in a search buffer and use notmuch jump +to run a saved search which does not have an explicitly set sort order +then the sort order of the saved-search is inherited from the current +search buffer rather than being the default search order. + +Thanks to Jani for finding the bug. +--- + +This time with a fuller commit message. + +(Part of the reason I did not send more before is I had not checked +what the exact outcome of the buggy code was: it was obvious what the +code was intended to do, and that with the extra quote it +would do what it was intended to do.) + +Best wishes + +Mark + + + + + + + + emacs/notmuch-jump.el | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el +index 5eb0949..0193f8c 100644 +--- a/emacs/notmuch-jump.el ++++ b/emacs/notmuch-jump.el +@@ -51,7 +51,7 @@ (defun notmuch-jump-search () + (case (plist-get saved-search :sort-order) + (newest-first nil) + (oldest-first t) +- (otherwise (default-value notmuch-search-oldest-first))))) ++ (otherwise (default-value 'notmuch-search-oldest-first))))) + (push (list key name + `(lambda () (notmuch-search ',query ',oldest-first))) + action-map))))) +-- +1.7.10.4 + -- 2.26.2