Found that `frame-initial-frame' working when starting 'standalone' emacs:
# emacs -q --load ~/.emacs-experiments
then in *Message* buffer it prints:
> initial-frame: #<frame emacs@ZXnotdead 0xf502b0>; frame: #<frame emacs@ZXnotdead 0xf502b0>; eq: t;

but in don't work for emacs --daemon



On 25 November 2013 22:42, Constantin Kulikov <zxnotdead@gmail.com> wrote:
> We're talking about determining the current state

Here what I have:

# cat ~/.emacs-experiments
-- (message "initial-frame: %s; frame: %s; eq: %s;" frame-initial-frame (selected-frame) (eq frame-initial-frame (selected-frame)))

# emacs -q --daemon=exp --load ~/.emacs-experiments
-- ("emacs" "--load" "/home/constantin/.emacs-experiments")
-- Starting Emacs daemon.
-- initial-frame: nil; frame: #<frame F1 0x9a6a50>; eq: nil;



On 25 November 2013 22:26, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> frame-initial-frame
> hmm. The name of variable looked promising and I didn't know about it, but
> it's value is `nil'.
> emacs-version is "24.3.50.1"

We're talking about determining the current state, so the fact that it's
nil at some point is not necessarily a problem.  Also, if that var work,
try terminal-frame instead (which the one I was thinking of, really).
It's also nil when you look at it interactively, but just like the
other, it's not always nil (otherwise those vars would be useless).


        Stefan