Re: [PATCH 1/6] test: run emacs inside screen

Subject: Re: [PATCH 1/6] test: run emacs inside screen

Date: Wed, 29 Jun 2011 16:16:40 -0400

To: Dmitry Kurochkin

Cc: notmuch@notmuchmail.org

From: Jim Paris


Dmitry Kurochkin wrote:
> Before the change, emacs run in daemon mode without any visible
> buffers.  Turns out that this affects emacs behavior in some
> cases.  In particular, `window-end' function returns `point-max'
> instead of the last visible position.  That makes it hard or
> impossible to implement some tests.  The patch runs emacs in a
> detached screen(1) session.  So that it works exactly as if it
> has a visible window.
> 
> Note: screen terminates when emacs exits.  So the patch does not
> introduce new "running processes left behind" issues.
> ---
>  test/test-lib.sh |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 079d7db..8d7c98d 100755
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -873,10 +873,16 @@ EOF
>  test_emacs () {
>  	if [ -z "$EMACS_SERVER" ]; then
>  		EMACS_SERVER="notmuch-test-suite-$$"
> -		"$TMP_DIRECTORY/run_emacs" \
> -			--daemon \
> +		# start a detached screen session with an emacs server
> +		screen -S "$EMACS_SERVER" -d -m "$TMP_DIRECTORY/run_emacs" \

To avoid problems with ~/.screenrc or /etc/screenrc, you might want e.g.
  env SYSSCREENRC=/dev/null SCREENRC=/dev/null screen -S ...

-jim

> +			--no-window-system \
>  			--eval "(setq server-name \"$EMACS_SERVER\")" \
> +			--eval '(server-start)' \
>  			--eval "(orphan-watchdog $$)" || return
> +		# wait until the emacs server is up
> +		until test_emacs '()'; do
> +			sleep 1
> +		done
>  	fi
>  
>  	emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
> -- 
> 1.7.5.4
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Thread: