[PATCH 2/2] test: use emacsclient(1) for Emacs tests
Austin Clements
amdragon at MIT.EDU
Tue Jun 28 09:22:57 PDT 2011
Quoth myself on Jun 27 at 11:49 pm:
> Quoth Dmitry Kurochkin on Jun 28 at 5:03 am:
> EMACSDONE=$TEST_DIRECTORY/emacsdone
> mkfifo $EMACSDONE
> coproc emacs --batch --eval '(while t (eval (read)) (write-region "\n" nil "'$EMACSDONE'" t 0))'
> EMACSFD=${COPROC[1]}
>
> test_emacs() {
> echo "$1" >&$EMACSFD
> read <$EMACSDONE
> }
>
> test_emacs '(sleep-for 2)'
> test_emacs '(message "Hi")'
>
> echo '(kill-emacs)' >&$EMACSFD
Oops, got a little overzealous with TEST_DIRECTORY. For reference,
the pipe should, of course, have gone in the current directory (or
TMP_DIRECTORY).
mkfifo emacsdone
coproc emacs --batch --eval '(while t (eval (read)) (write-region "\n" nil "emacsdone" t 0))'
EMACSFD=${COPROC[1]}
test_emacs() {
echo "$1" >&$EMACSFD
read < emacsdone
}
(I don't really see how that could be either more shell code or more
elisp code than using emacsclient plus cleanup code [nor why it
matters for five lines of code], but I'm probably missing something.)
More information about the notmuch
mailing list