Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notmuch: autocompletion of "to/cc/bcc" addresses #629

Closed
anarcat opened this issue Jun 9, 2017 · 5 comments
Closed

notmuch: autocompletion of "to/cc/bcc" addresses #629

anarcat opened this issue Jun 9, 2017 · 5 comments

Comments

@anarcat
Copy link

anarcat commented Jun 9, 2017

Right now when you compose an email in Neomutt, the autocompletion command (TAB) in the To: field yields the list of aliases. Yet the Notmuch feature provides a way more powerful autocompletion system through the notmuch-address command. This is used in the Emacs notmuch client and I use it all the time, it's one of those things that make me go back to Emacs instead of switching back to mutt (along with #628).

I'm not sure how that completion works or how customizable it is, but it would seem to me like a key feature to add.

Thanks!

@ghost ghost added the type:enhancement Feature Request label Jun 9, 2017
@anarcat
Copy link
Author

anarcat commented Jun 9, 2017

it seems this is already doable, by binding the query_command parameter. this worked for me:

set query_command = "notmuch-address %s"

although the output is trimmed at 25 columns for some odd reason...

by default, <Tab> runs the complete command which looks into aliases. to complete using the query_command, you need to use the ^T shortcut. to reverse the two, use this:

bind editor <Tab> complete-query
bind editor ^T complete

this means this is basically resolved. :) thanks!

@anarcat anarcat closed this as completed Jun 9, 2017
@ghost ghost added closed:invalid and removed type:enhancement Feature Request labels Jun 9, 2017
@ghost
Copy link

ghost commented Jun 9, 2017

although the output is trimmed at 25 columns for some odd reason...

If i recall correctly, you can fix that with:

set query_format="%4c %t %-70.70a %-70.70n %?e?(%e)?"

@anarcat
Copy link
Author

anarcat commented Jun 9, 2017 via email

@cbcoutinho
Copy link

cbcoutinho commented Sep 5, 2018

I have a question regarding this issue - using notmuch address query (with minor changes) works for me when the search results contain multiple options, but the results always cut off the first address. When the search results in only one address, neomutt stays blank.

The difference can be seen when comparing the output in a shell between:

notmuch address from:<my-string>

and when using tab completion in neomutt after the To: prompt:

To: <my-string>

My neomutt config options related to notmuch are:

set query_command = "notmuch address from:%s"
bind editor <Tab> complete-query
bind editor ^T complete
set query_format="%4c %t %-70.70a %-70.70n %?e?(%e)?"

If I should open a new issue please let me know


Version info:

$ notmuch --version
notmuch 0.26

$ neovim -v
NeoMutt 20180716
Copyright (C) 1996-2016 Michael R. Elkins and others.
NeoMutt comes with ABSOLUTELY NO WARRANTY; for details type 'neomutt -vv'.
NeoMutt is free software, and you are welcome to redistribute it
under certain conditions; type 'neomutt -vv' for details.

System: Linux 4.18.5-1-default (x86_64)
ncurses: ncurses 6.1.20180414 (compiled with 6.1.20180414)
libidn: 1.35 (compiled with 1.35)
hcache backends: kyotocabinet, lmdb

Compiler:
Using built-in specs.
Reading specs from /usr/lib64/gcc/x86_64-suse-linux/8/defaults.spec
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=hsa:nvptx-none
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go --enable-offload-targets=hsa,nvptx-none=/usr/nvptx-none, --without-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/8 --enable-ssp --disable-libssp --disable-libvtv --disable-cet --disable-libcc1 --enable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-8 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 8.1.1 20180614 [gcc-8-branch revision 261584] (SUSE Linux) 

Configure options: --prefix=/usr --docdir=/usr/share/doc/packages/neomutt --with-mailpath=/var/mail --kyotocabinet --lua --lmdb --gnutls --gpgme --notmuch --sasl --gss --idn --mixmaster

Compilation CFLAGS: -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -std=c99 -fno-delete-null-pointer-checks -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D__EXTENSIONS__ -I/usr/include -I/usr/include/lua5.3  -DNCURSES_WIDECHAR

Default options:
  +attach_headers_color +compose_to_sender +compress +cond_date +debug 
  +encrypt_to_self +forgotten_attachments +forwref +ifdef +imap +index_color 
  +initials +limit_current_thread +multiple_fcc +nested_if +new_mail +nntp +pop 
  +progress +quasi_delete +regcomp +reply_with_xorig +sensible_browser +sidebar 
  +skip_quoted +smtp +status_color +timeout +tls_sni +trash 

Compile options:
  +bkgdset +color +curs_set +fcntl -flock -fmemopen +futimens +getaddrinfo 
  +gnutls +gpgme +gss +hcache -homespool +idn -locales_hack +lua +meta 
  +mixmaster +nls +notmuch -openssl +pgp +sasl +smime +start_color 
  +sun_attachment +typeahead 
MAILPATH="/var/mail"
MIXMASTER="mixmaster"
PKGDATADIR="/usr/share/neomutt"
SENDMAIL="/usr/sbin/sendmail"
SYSCONFDIR="/etc"

To learn more about NeoMutt, visit: https://neomutt.org
If you find a bug in NeoMutt, please raise an issue at:
    https://github.com/neomutt/neomutt/issues
or send an email to: <neomutt-devel@neomutt.org>

@RichardKraus
Copy link

It might be worth noting that notmuch can also query for a regex (see man 7 notmuch-search-terms):
notmuch address from:/<regex>/
This means that youre able to tab complete with only part of the recipients name if you
set query_command = "echo '' && notmuch address from:/%s/"
(applying the echo 'n-1' fix) or similar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants