Nifty! On Sat, Jun 4, 2011 at 8:19 AM, Daniel Schoepe <daniel.schoepe at googlemail.com> wrote: > + ? ? ? ?(minibuffer-completion-table (completion-table-dynamic > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?`(lambda (s) (notmuch-query-completions > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (quote ,all-compls) s))))) > + ? ?;; ^ 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 "<tab>") '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).