Subject: Re: bug#16859: tty-setup-hook can run twice

From: Stefan Monnier <[email-masked]>
Date: Wed, 26 Feb 2014 10:55:43 -0500

> 3) Add optional DO-NOT-RUN-HOOK (or the inverse) argument to
> tty-run-terminal-initialization.

I guess for backward compatibility's sake, adding a RUN-HOOK is a good idea.

> BTW, I also noticed that the hook runs when emacs --daemon is started,
> which seems odd?

Indeed, since we do

  (unless (or noninteractive
              initial-window-system)
    (tty-run-terminal-initialization (selected-frame)))

it would make sense to also prevent tty-run-terminal-initialization when
in daemon (tho I thought `noninteractive' would be set for daemon, but
maybe this is run late enough that `noninteractive' has already been
changed to nil by then).

        Stefan