rfc for notmuch remote access script

Tomi Ollila domo141 at gmail.com
Thu Oct 27 10:25:41 PDT 2016


Hi

j4ni on irc expressed interest of having an installation option for
notmuch-emacs and a notmuch remote access script as 'notmuch'

This got me thinking what kind of script would fulfill all the needs
that I know of.

and this is the result of that:

--8<----8<----8<----8<----8<----8<----8<----8<--

#!/bin/bash

set -euf

if [ "${NOTMUCH_REMOTE_XTRACE_FILE-}" ]; then
	exec 6>>"$NOTMUCH_REMOTE_XTRACE_FILE"
	BASH_XTRACEFD=6
	echo -- >&6
	set -x
	env >&6
fi

: ${NOTMUCH_REMOTE_SSH_COMMAND:=ssh}
: ${NOTMUCH_REMOTE_SSH_ARGS=}
: ${NOTMUCH_REMOTE_HOST:=notmuch}
: ${NOTMUCH_REMOTE_COMMAND:=notmuch}

printf -v ARGS '%q ' "$@"

exec "$NOTMUCH_REMOTE_SSH_COMMAND" $NOTMUCH_REMOTE_SSH_ARGS \
	"$NOTMUCH_REMOTE_HOST" $NOTMUCH_REMOTE_COMMAND $ARGS

--8<----8<----8<----8<----8<----8<----8<----8<--

out of the box this works like the instructions given in
https://notmuchmail.org/remoteusage/ (with ~/.ssh/config changes)
and https://notmuchmail.org/remoteusage/124/ (with suitable wrapping
so that contents of ~/.ssh/ can be left unmodified)

also, debugging is easy. (setenv "NOTMUCH_REMOTE_XTRACE_FILE" "xtrace.log")
inside emacs, and NOTMUCH_REMOTE_XTRACE_FILE=xtrace.log notmuch-remote
on the command line.

what do you think?

Tomi


More information about the notmuch mailing list