From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 06714429E25 for ; Sat, 29 Oct 2011 10:25:34 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.79 X-Spam-Level: X-Spam-Status: No, score=-0.79 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, T_MIME_NO_TEXT=0.01] 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 Lszy1NvVf10e for ; Sat, 29 Oct 2011 10:25:33 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D83C5431FB6 for ; Sat, 29 Oct 2011 10:25:32 -0700 (PDT) Received: by faai28 with SMTP id i28so5019762faa.26 for ; Sat, 29 Oct 2011 10:25:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schoepe.org; s=google; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=O4533N/9SL0iaUEXnS+v2bpt3c/nBXZtxdrI9WXS/ao=; b=fVpleH2h7tXoojxbzpUk8O80p1V0FXM9lPzZBfiVHAkwqU29u2Hf9h9715OkWT1jxO VGgl0wlNIJtpBBt84/wQKeokvHPaQbaCMwuZkxsd6H3qQToeuqwTjYX+F9GNkmBRhk6A q1ORC0vK/hJkln5wuiA4Ljmze15f0usjZfh+Y= Received: by 10.223.36.193 with SMTP id u1mr15059283fad.27.1319909131412; Sat, 29 Oct 2011 10:25:31 -0700 (PDT) Received: from localhost (dslb-178-004-066-018.pools.arcor-ip.net. [178.4.66.18]) by mx.google.com with ESMTPS id w7sm25529596fab.6.2011.10.29.10.25.29 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 29 Oct 2011 10:25:29 -0700 (PDT) From: Daniel Schoepe To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [RFC PATCH 3/3] emacs: support limiting the number of messages shown in search results In-Reply-To: <0290050284e4cb3a6f5ef0eb3582319f8d52ccf2.1319833617.git.jani@nikula.org> References: <0290050284e4cb3a6f5ef0eb3582319f8d52ccf2.1319833617.git.jani@nikula.org> User-Agent: Notmuch/0.9+47~g3dfd481 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Sat, 29 Oct 2011 19:25:22 +0200 Message-ID: <87pqhfk8vx.fsf@gilead.invalid> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: amdragon@mit.edu 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, 29 Oct 2011 17:25:34 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Fri, 28 Oct 2011 23:59:31 +0300, Jani Nikula wrote: > Add support for limiting the maximum number of messages initially display= ed > in search results. When enabled, the search results will contain push > buttons to double the number of messages displayed or to show unlimited > messages. Nice patch, as it not only makes searches with a lot of results easier to use on slower machines/hard drives, but I also find that seeing only a few dozen threads in the buffer looks more "orderly" to me, compared to a buffer with hundreds of lines. A few comments about the code: > @@ -373,6 +381,7 @@ Complete list of currently available key bindings: > (make-local-variable 'notmuch-search-oldest-first) > (make-local-variable 'notmuch-search-target-thread) > (make-local-variable 'notmuch-search-target-line) > + (make-local-variable 'notmuch-search-maxitems) > (set (make-local-variable 'notmuch-search-continuation) nil) > (set (make-local-variable 'scroll-preserve-screen-position) t) > (add-to-invisibility-spec 'notmuch-search) > @@ -633,6 +642,8 @@ This function advances the next thread when finished." > (insert "End of search results.") > (if (not (=3D exit-status 0)) > (insert (format " (process returned %d)" exit-status))) > + (if notmuch-search-maxitems > + (notmuch-search-setup-buttons)) As discussed on IRC, this causes `notmuch-search' to fail if the maxitems argument is nil. > +(defun notmuch-search-setup-buttons () > + (widget-insert " ") > + (widget-create 'push-button > + :notify (lambda (&rest ignore) > + (set 'notmuch-search-maxitems > + (* 2 notmuch-search-maxitems)) > + (notmuch-search-refresh-view)) > + :help-echo "Double the number of messages shown" > + "Show 2X messages") > + (widget-insert " ") > + (widget-create 'push-button > + :notify (lambda (&rest ignore) > + (set 'notmuch-search-maxitems 0) > + (notmuch-search-refresh-view)) > + :help-echo "Show all search results" > + "Show unlimited messages") > + (widget-setup)) I think these notify-actions should be separate functions to make it easier to bind them to keys. > + > (defcustom notmuch-poll-script "" > "An external script to incorporate new mail into the notmuch database. >=20=20 > @@ -997,7 +1030,7 @@ current search results AND the additional query stri= ng provided." > query))) > (notmuch-search (if (string=3D notmuch-search-query-string "*") > grouped-query > - (concat notmuch-search-query-string " and " grouped-query)) notm= uch-search-oldest-first))) > + (concat notmuch-search-query-string " and " > grouped-query)) notmuch-search-oldest-first > notmuch-search-maxitems))) This causes notmuch-search-filter to fail (repeatedly), since `notmuch-sear= ch' expects a TARGET-THREAD (or nil) as its third parameter, but is given `notmuch-search-maxitems' instead. >=20=20 > (defun notmuch-search-filter-by-tag (tag) > "Filter the current search results based on a single tag. > @@ -1006,7 +1039,7 @@ Runs a new search matching only messages that match= both the > current search results AND that are tagged with the given tag." > (interactive > (list (notmuch-select-tag-with-completion "Filter by tag: "))) > - (notmuch-search (concat notmuch-search-query-string " and tag:" tag) n= otmuch-search-oldest-first)) > + (notmuch-search (concat notmuch-search-query-string " and tag:" > tag) notmuch-search-oldest-first notmuch-search-maxitems)) Same here. Cheers, Daniel --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAgAGBQJOrDcCAAoJEIaTAtce+Z+JnfMP/irov7ZyMI/lt+hMa90hdgQt 4Hfbn5B985VxY7Gj60rj2CCi+KlkWTzRHrq06HhJtL3rTXuCEFwJuIrqPUSxH7nS M3pcstubJ5QbXFwvYAJyR7QgELebdrIKwtls9VwSSx3xpEcT1MqybZMGL8BZmJmu ZR2gJCQqp/CXB5DXOiULOEBbzEawO83RaKI6hKHj4e1U/QFy0J1sn+ImfYlmraz6 fKxFM7N31Oeh6K9P78oqdM3QLF0t5EnOrK9ZkYCOBUKu9HcvjTNbiNdR7ndRMgVX +m+egx0Oz3FbFAaBXeVTY2Q4ldyY6sVGfJp3jOmymuftxtMhTDBaffkOn2PGv5a4 +gWPKDmJgopw5YYRaiN+de+GC7b7cE+5xmtsrAOEXh3oiExKH8Yb5irahyW351b6 OWi1O6trSEfga6bdTepWrPIHGiPvwWP0Hlih/pj4i3hS3m3vnf43wmJs7eu7obo7 QFnbhyT5LO2aE1Wz5LHt8S8wSm/H8n26gAlExj31h0ppiu779QriFJKFjYsKewwF gsMqXIz9Rhj3zevEtOtDtjM2DdYOJOr4HEKjxEbe2/CKlczG68XAwoQ3teTXne+q sUUoCQx/8MXqBEo7iHwq9SsYu2xk7Qi5l1Ya/wGM2xlsnoEJNRWSyrbKuw9G75C6 Mm10VNwBdmNI6Slo/XTA =c4QO -----END PGP SIGNATURE----- --=-=-=--