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 0B83F431FAF for ; Wed, 18 Jan 2012 09:58:26 -0800 (PST) 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 dIve49DlgXQz for ; Wed, 18 Jan 2012 09:58:25 -0800 (PST) Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 3E3D6431FAE for ; Wed, 18 Jan 2012 09:58:25 -0800 (PST) Received: by bkty12 with SMTP id y12so1947394bkt.26 for ; Wed, 18 Jan 2012 09:58:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; bh=m3pCFKw+OTFdzVg6YhxjyEamF/D+ejUM/BiZ574a2WE=; b=lL6I+gakHfP/LoiBamFu7jmG0H0ygeeLz0O5M8gLva3KMjQRpLu4LGl/w6TIxn3L+D IYcXB28lT+B7LQgDus5zOXXkxnO2acaFAJ6k+4zeBDa4dJxNC7OP0KF7G8ELPv8TLvdJ EGagyJJNz8GZuhQQMNFpHEcihRguwhbqKrVJQ= Received: by 10.204.145.72 with SMTP id c8mr8619109bkv.79.1326909503926; Wed, 18 Jan 2012 09:58:23 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id e12sm56352324bko.14.2012.01.18.09.58.22 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jan 2012 09:58:23 -0800 (PST) From: Dmitry Kurochkin To: David Edmondson , notmuch@notmuchmail.org Subject: Re: [PATCH 2/3] emacs: use a single history for all searches In-Reply-To: References: <1326828850-8519-1-git-send-email-dmitry.kurochkin@gmail.com> <1326828850-8519-2-git-send-email-dmitry.kurochkin@gmail.com> User-Agent: Notmuch/0.11+73~g8a5402e (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Wed, 18 Jan 2012 21:57:27 +0400 Message-ID: <87boq099mg.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Wed, 18 Jan 2012 17:58:26 -0000 On Wed, 18 Jan 2012 08:25:22 +0000, David Edmondson wrote: > On Tue, 17 Jan 2012 23:34:09 +0400, Dmitry Kurochkin wrote: > > There are two ways to do search in Emacs UI: search widget in > > notmuch-hello buffer and `notmuch-search' function bound to "s". > > Before the change, these search mechanisms used different history > > lists. The patch makes notmuch-hello search use the same history list > > as `notmuch-search' function. > > The test output updates included here should be with the previous patch, > shouldn't they? > Indeed. Would send v2. > > -(defun notmuch-search (query &optional oldest-first target-thread target-line continuation) > > - "Run \"notmuch search\" with the given query string and display results. > > +(defun notmuch-search (&optional query oldest-first target-thread target-line continuation) > > + "Run \"notmuch search\" with the given `query' and display results. > > > > -The optional parameters are used as follows: > > +If `query' is nil, it is read interactively from the minibuffer. > > +Other optional parameters are used as follows: > > > > oldest-first: A Boolean controlling the sort order of returned threads > > target-thread: A thread ID (with the thread: prefix) that will be made > > current if it appears in the search results. > > target-line: The line number to move to if the target thread does not > > appear in the search results." > > - (interactive (list (notmuch-read-query "Notmuch search: "))) > > + (interactive) > > + (if (null query) > > + (setq query (notmuch-read-query "Notmuch search: ")) > > + (setq query (notmuch-trim query)) > > + (let ((history-delete-duplicates t)) > > + (add-to-history 'notmuch-search-history query))) > > Should user-typed queries be trimmed? IMO that would not hurt. But we need to do it before it gets added to the history. And that may be tricky. So this patch does trimming only for queries from notmuch-hello search box (as it was before). Regards, Dmitry