3 # Run notmuch on remote host over SSH
5 # http://notmuchmail.org/remoteusage/
7 # Put this script in your path and add (setq notmuch-command
8 # "notmuch-remote") to your emacs configuration.
10 # Add a host specification for "notmuch" to ~/.ssh/config to set the
11 # remote host and (optionally) remote user.
14 # HostName host.example.org
17 SSH_REMOTE_HOST=notmuch
18 SSH_CONTROL_PATH="-o ControlPath=/tmp/notmuch-remote.${USER}.%r@%h:%p"
20 # Start a background master connection if one isn't running yet
21 ssh ${SSH_CONTROL_PATH} -O check ${SSH_REMOTE_HOST} 2>/dev/null ||
22 ssh ${SSH_CONTROL_PATH} -MNf ${SSH_REMOTE_HOST}
24 # The ControlPersist option (in OpenSSH 5.6) could be used to start
25 # the master connection automatically when "ssh host notmuch" is run.
27 # This requires the bash version of printf (bashism)
28 printf -v ARGS "%q " "$@"
29 ssh ${SSH_CONTROL_PATH} ${SSH_REMOTE_HOST} notmuch ${ARGS}