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 9FB6D429E28 for ; Sat, 4 Jun 2011 08:32:17 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-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 C8p4RXf6YVXI for ; Sat, 4 Jun 2011 08:32:17 -0700 (PDT) Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com [209.85.216.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 04FE0431FB6 for ; Sat, 4 Jun 2011 08:32:16 -0700 (PDT) Received: by qwb7 with SMTP id 7so1440803qwb.26 for ; Sat, 04 Jun 2011 08:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=IdK578clprBDvNtuvdFEwD1xVe6bbfo2+u78ZGoYy/M=; b=l1dA3e6ZOn6ITOxsNUQ0SHRWxDbDe8IYDSG8fNqF/0gUpYBpyw4KZo93p1RDtsM5+c k9FAHf3R4V6YWlB7w72SvH51+4enUjKSKSOo4Uk2dUiaR2TdD7J3gzp2rBM2kvFxVuyo SDmgB3k62EemAHmN7sSEh3k/epZeTMrcsc3lA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=a2bor8p/H/FqTFJwVXnJ3NJNcu5ZDTnbDL6edriWrHnflC1b+bVAWOXWsVSpV7Is91 zng2FmH+icHONXOSK2dCYD71q/WxQ8MHV0EfF1DiWr+HPtsZC1aBMg+9RmMMYZRFwk0f Ad2x712+myCsmHA8CUlegjBOW73GpOwh1yct0= MIME-Version: 1.0 Received: by 10.229.176.170 with SMTP id be42mr2135393qcb.258.1307201535634; Sat, 04 Jun 2011 08:32:15 -0700 (PDT) Sender: amdragon@gmail.com Received: by 10.229.211.148 with HTTP; Sat, 4 Jun 2011 08:32:15 -0700 (PDT) In-Reply-To: <1307189970-728-1-git-send-email-daniel.schoepe@googlemail.com> References: <1307189970-728-1-git-send-email-daniel.schoepe@googlemail.com> Date: Sat, 4 Jun 2011 11:32:15 -0400 X-Google-Sender-Auth: FG1OlSjAblvhj5WKrwcH9WfBJjA Message-ID: Subject: Re: [PATCH] emacs: Tab completion for notmuch-search and notmuch-search-filter From: Austin Clements To: Daniel Schoepe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: notmuch@notmuchmail.org 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 Jun 2011 15:32:17 -0000 Nifty! On Sat, Jun 4, 2011 at 8:19 AM, Daniel Schoepe wrote: > + =A0 =A0 =A0 =A0(minibuffer-completion-table (completion-table-dynamic > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0`(lambda (s) (notmuch-query-completions > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 (quote ,all-compls) s))))) > + =A0 =A0;; ^ emulate a closure to avoid recomputing the completion list = each time Dynamic scoping is obnoxious, but I think programmed completion is steeped in the assumption that you'll use it. This code would be much simpler if notmuch-query-completions took only `string' and used the dynamically-bound all-compls (which should probably be renamed notmuch-completions or something if you do this). Then this could be just (minibuffer-completion-table (completion-table-dynamic #'notmuch-query-completions))) and there'd be no need for quasiquoting, comments, and fake lexical scoping= . > + (define-key keymap (kbd "") 'minibuffer-complete) This probably deserves a comment about why you're doing so much work to avoid completing-read (which I assume is because it also binds SPC, even if require-match is nil, which is unfortunate).