[PATCH 2/3] test: Add `test_emacs_expect_t'.

Tomi Ollila tomi.ollila at iki.fi
Wed Jan 18 01:09:52 PST 2012


On Tue, 17 Jan 2012 15:09:22 +0000, David Edmondson <dme at dme.org> wrote:
> On Tue, 17 Jan 2012 18:49:36 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> > > +		# We cannot call 'test_emacs' in a subshell, because
> > > +		# the setting of EMACS_SERVER would not persist
> > > +		# throughout a sequence of tests, so we use a
> > > +		# temporary file.
> > > +		tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
> > > +		output="$tmp/test_emacs_output.$$"
> > > +		test_emacs "$1" > "${output}"
> > > +		result=$(cat "${output}")
> > > +		rm -f "${output}"
> > 
> > I wonder if there is any bash trick which can help here?
> 
> I'm not aware of one, but I'm not a bash expert.

No shell trick possible there.

> 
> > Another option is to start emacs server before using test_emacs in
> > subshell.  See emacs-subject-to-filename for an example.  I think this
> > is a better option than using a temporary file.
> 
> I think that's a very poor option. Forcing knowledge the breakage into
> all of the users may make applying any future fix more difficult.

The alternative would be to replace
emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"

with something like:

   case $1 in --stdout-to-output)
	shift
	output=$(emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)")
        return
   esac
   emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"

Tomi


More information about the notmuch mailing list