test: use LDFLAGS in test/Makefile.local

Apparently the test binaries are built with minimal LDFLAGS, only
adding dependency specific LDFLAGS as needed. However because some of
the test binaries incorporate notmuch object files, it is necessary to
use the same link flags as notmuch. For example user provided
CFLAGS/CXXFLAGS/LDFLAGS with -fsanitize=undefined fails to build the
test binaries if the flags differ.
emacs: Improve the behaviour of the 'q' binding.

When a user hits 'q' in a notmuch buffer, kill the buffer only if
there are no other windows currently showing it.