[PATCH] emacs: Tab completion for notmuch-search and notmuch-search-filter

Daniel Schoepe daniel.schoepe at googlemail.com
Sat Jun 4 15:54:38 PDT 2011


On Sat, 4 Jun 2011 17:55:24 -0400, Austin Clements <amdragon at MIT.EDU> wrote:
> Oh, sorry, I wasn't suggesting setq'ing a global.  I agree that that's
> really ugly.  Rather, something like
> 
> (defun notmuch-query-completions (string)
>   ... as you have it now ...)
> 
> (defun notmuch-read-query (prompt)
>   (let ((notmuch-completions (append (list "folder:" ...)))
>         (keymap ...)
>         (minibuffer-completion-table ...))
>     (read-from-minibuffer ...)))
> 
> Unfortunately, you still need the global defvar to avoid compilation
> warnings, but this at least avoids the side-effects, and is probably
> how programmed completion was intended to be used.

Both alternatives seem about equally ugly to me, since the one using
dynamic scoping still uses side-effects, because it still passes the
completion information around without using it as an argument to
notmuch-query-completions. At least defvar-ing a global variable and
then never actually using it, seems somewhat unclean as well.

> Alternatively, here's a completely different way to structure this
> that avoids globals and dynamic scoping entirely.  This is how some of
> the standard completing read functions appear to work:

Ah right, I forgot that using macros from cl is fine even in library
code.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-emacs-Tab-completion-for-notmuch-search-and-notmuch-.patch
Type: text/x-diff
Size: 3290 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110605/e41a2048/attachment-0001.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/20110605/e41a2048/attachment-0001.pgp>


More information about the notmuch mailing list