On Sat, 4 Jun 2011 11:32:15 -0400, Austin Clements <amdragon at mit.edu> wrote:
> 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.

Sounds reasonable, I guess I really should stop fighting all those ugly
parts of elisp with unreadable constructs like that. I made it a global
variable though to avoid compilation warnings about notmuch-completion
being a free variable. Since it's contents are not dependent on
how/where notmuch-read-query is called, this shouldn't cause any
problems, except my personal discomfort arising from the use of side
effects for something as simple as this. :)

> > +    (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).

Yes, that was the reason.

Another thing that bugs me, is that I did not find a better way of doing
the completion: Ideally I'd like to just specify a list of completions
for individual words and have emacs handle separating the input string
into individual words, but I couldn't find any options to accomplish
that.

An updated patch is attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-emacs-Tab-completion-for-notmuch-search-and-notmuch-.patch
Type: text/x-diff
Size: 3267 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110604/016d9e5b/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110604/016d9e5b/attachment.pgp>

Reply via email to