* (window-system) returns nil on after-make-frame-functions when creating an X frame
@ 2009-03-09 17:02 Mike Mattie
2009-03-09 17:36 ` Dan Nicolaescu
2009-03-09 17:54 ` Chong Yidong
0 siblings, 2 replies; 7+ messages in thread
From: Mike Mattie @ 2009-03-09 17:02 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 871 bytes --]
Hi,
The behavior of (window-system) as it stands has a corner-case that
does not make sense.
I run a function on after-make-frame-functions that loads my GUI configuration
(previously discussed).
To make sure it runs only when a X frame is created, vs. a TTY I would check
that it is an X frame.
To do this I called (window-system) which normally returns "x". It is not
the best idea, but intuitively after the X frame is created it would sensibly
return "x".
Currently it returns nil. When (window-system) is evaluated in the scratch
buffer sometime after the frame is made, well after after-make-frame-functions
it does indeed return "x".
Though my use in this case is not advised, I think the current behavior in
this scenario does not make sense.
Cheers,
Mike Mattie
--
GnuPG Key: B9012279 is available from HKP server pgp.mit.edu
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: (window-system) returns nil on after-make-frame-functions when creating an X frame
2009-03-09 17:02 (window-system) returns nil on after-make-frame-functions when creating an X frame Mike Mattie
@ 2009-03-09 17:36 ` Dan Nicolaescu
2009-03-09 18:06 ` Stefan Monnier
2009-03-09 17:54 ` Chong Yidong
1 sibling, 1 reply; 7+ messages in thread
From: Dan Nicolaescu @ 2009-03-09 17:36 UTC (permalink / raw)
To: Mike Mattie; +Cc: emacs-devel
Mike Mattie <codermattie@gmail.com> writes:
> Hi,
>
> The behavior of (window-system) as it stands has a corner-case that
> does not make sense.
>
> I run a function on after-make-frame-functions that loads my GUI configuration
> (previously discussed).
>
> To make sure it runs only when a X frame is created, vs. a TTY I would check
> that it is an X frame.
>
> To do this I called (window-system) which normally returns "x". It is not
> the best idea, but intuitively after the X frame is created it would sensibly
> return "x".
>
> Currently it returns nil. When (window-system) is evaluated in the scratch
> buffer sometime after the frame is made, well after after-make-frame-functions
> it does indeed return "x".
How are you calling (window-system) ? You should be calling it from
within a `with-selected-frame'
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: (window-system) returns nil on after-make-frame-functions when creating an X frame
2009-03-09 17:02 (window-system) returns nil on after-make-frame-functions when creating an X frame Mike Mattie
2009-03-09 17:36 ` Dan Nicolaescu
@ 2009-03-09 17:54 ` Chong Yidong
2009-03-09 18:38 ` Mike Mattie
2009-03-09 19:51 ` Mike Mattie
1 sibling, 2 replies; 7+ messages in thread
From: Chong Yidong @ 2009-03-09 17:54 UTC (permalink / raw)
To: Mike Mattie; +Cc: emacs-devel
Mike Mattie <codermattie@gmail.com> writes:
> To do this I called (window-system) which normally returns "x". It is
> not the best idea, but intuitively after the X frame is created it
> would sensibly return "x".
>
> Currently it returns nil. When (window-system) is evaluated in the
> scratch buffer sometime after the frame is made, well after
> after-make-frame-functions it does indeed return "x".
Did you give `window-system' the frame as an argument?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: (window-system) returns nil on after-make-frame-functions when creating an X frame
2009-03-09 17:36 ` Dan Nicolaescu
@ 2009-03-09 18:06 ` Stefan Monnier
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2009-03-09 18:06 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: Mike Mattie, emacs-devel
> How are you calling (window-system) ? You should be calling it from
> within a `with-selected-frame'
Or pass it the frame as an argument.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: (window-system) returns nil on after-make-frame-functions when creating an X frame
2009-03-09 17:54 ` Chong Yidong
@ 2009-03-09 18:38 ` Mike Mattie
2009-03-09 20:10 ` Stefan Monnier
2009-03-09 19:51 ` Mike Mattie
1 sibling, 1 reply; 7+ messages in thread
From: Mike Mattie @ 2009-03-09 18:38 UTC (permalink / raw)
To: Chong Yidong; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]
On Mon, Mar 09, 2009 at 01:54:30PM -0400, Chong Yidong wrote:
> Mike Mattie <codermattie@gmail.com> writes:
>
> > To do this I called (window-system) which normally returns "x". It is
> > not the best idea, but intuitively after the X frame is created it
> > would sensibly return "x".
> >
> > Currently it returns nil. When (window-system) is evaluated in the
> > scratch buffer sometime after the frame is made, well after
> > after-make-frame-functions it does indeed return "x".
>
> Did you give `window-system' the frame as an argument?
I did. My function is as follows:
(defun is-current-frame-x ()
(message "window system is %s" (princ (window-system (selected-frame))))
(equal 'x (window-system (selected-frame)))
)
when called on the before-make-frame-hook, and the after-make-frame-functions
hook the result is always nil.
In essence I want to hook when a frame is created and determine
if it is an X or tty frame. This might not be the right path,
but the results are strange ?
--
GnuPG Key: B9012279 is available from HKP server pgp.mit.edu
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: (window-system) returns nil on after-make-frame-functions when creating an X frame
2009-03-09 17:54 ` Chong Yidong
2009-03-09 18:38 ` Mike Mattie
@ 2009-03-09 19:51 ` Mike Mattie
1 sibling, 0 replies; 7+ messages in thread
From: Mike Mattie @ 2009-03-09 19:51 UTC (permalink / raw)
To: Chong Yidong; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 832 bytes --]
On Mon, Mar 09, 2009 at 01:54:30PM -0400, Chong Yidong wrote:
> Mike Mattie <codermattie@gmail.com> writes:
>
> > To do this I called (window-system) which normally returns "x". It is
> > not the best idea, but intuitively after the X frame is created it
> > would sensibly return "x".
> >
> > Currently it returns nil. When (window-system) is evaluated in the
> > scratch buffer sometime after the frame is made, well after
> > after-make-frame-functions it does indeed return "x".
>
> Did you give `window-system' the frame as an argument?
I finally hunted down the error in my code. I needed to pass the frame
argument given to the after-make-frame-functions functions.
Now it works correctly. Sorry for the noise.
Cheers,
Mike Mattie
--
GnuPG Key: B9012279 is available from HKP server pgp.mit.edu
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: (window-system) returns nil on after-make-frame-functions when creating an X frame
2009-03-09 18:38 ` Mike Mattie
@ 2009-03-09 20:10 ` Stefan Monnier
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2009-03-09 20:10 UTC (permalink / raw)
To: Mike Mattie; +Cc: Chong Yidong, emacs-devel
> (defun is-current-frame-x ()
> (message "window system is %s" (princ (window-system (selected-frame))))
> (equal 'x (window-system (selected-frame)))
> )
Please check which frame is (selected-frame).
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-03-09 20:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-09 17:02 (window-system) returns nil on after-make-frame-functions when creating an X frame Mike Mattie
2009-03-09 17:36 ` Dan Nicolaescu
2009-03-09 18:06 ` Stefan Monnier
2009-03-09 17:54 ` Chong Yidong
2009-03-09 18:38 ` Mike Mattie
2009-03-09 20:10 ` Stefan Monnier
2009-03-09 19:51 ` Mike Mattie
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).