* How to find out if emacs is running inside GUI or terminal
@ 2013-11-22 19:16 Louis-Guillaume Gagnon
2013-11-22 19:30 ` Bob Proulx
2013-11-22 23:26 ` Stefan Monnier
0 siblings, 2 replies; 10+ messages in thread
From: Louis-Guillaume Gagnon @ 2013-11-22 19:16 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
Is there a way to find out within emacs if it is running in a GUI or inside
a terminal (i.e. -nw switch specified on the cli) using Elisp?
The reason is I would like to take different actions in my ~/.emacs
depending on the situation.
Thanks,
glg
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to find out if emacs is running inside GUI or terminal
2013-11-22 19:16 How to find out if emacs is running inside GUI or terminal Louis-Guillaume Gagnon
@ 2013-11-22 19:30 ` Bob Proulx
2013-11-22 19:41 ` Óscar Fuentes
2013-11-22 23:26 ` Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: Bob Proulx @ 2013-11-22 19:30 UTC (permalink / raw)
To: help-gnu-emacs
Louis-Guillaume Gagnon wrote:
> Is there a way to find out within emacs if it is running in a GUI or inside
> a terminal (i.e. -nw switch specified on the cli) using Elisp?
>
> The reason is I would like to take different actions in my ~/.emacs
> depending on the situation.
Yes. Use 'window-system' to determine this. Example:
(if window-system
(setq mouse-yank-at-point t))
And to head off complaints about the example, it is only an example.
I am aware of 'fboundp'.
Bob
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to find out if emacs is running inside GUI or terminal
2013-11-22 19:30 ` Bob Proulx
@ 2013-11-22 19:41 ` Óscar Fuentes
2013-11-25 2:04 ` Bob Proulx
0 siblings, 1 reply; 10+ messages in thread
From: Óscar Fuentes @ 2013-11-22 19:41 UTC (permalink / raw)
To: help-gnu-emacs
Bob Proulx <bob@proulx.com> writes:
> Louis-Guillaume Gagnon wrote:
>> Is there a way to find out within emacs if it is running in a GUI or inside
>> a terminal (i.e. -nw switch specified on the cli) using Elisp?
>>
>> The reason is I would like to take different actions in my ~/.emacs
>> depending on the situation.
>
> Yes. Use 'window-system' to determine this. Example:
>
> (if window-system
> (setq mouse-yank-at-point t))
>
> And to head off complaints about the example, it is only an example.
> I am aware of 'fboundp'.
I'll complain about something else, then :-)
C-h v window-system
[...]
Use of this variable as a boolean is deprecated. Instead,
use `display-graphic-p' or any of the other `display-*-p'
predicates which report frame's specific UI-related capabilities.
So your example should be
(if (display-graphic-p)
....
There are several display-*-p functions for querying about specific
features for a display.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to find out if emacs is running inside GUI or terminal
2013-11-22 19:41 ` Óscar Fuentes
@ 2013-11-25 2:04 ` Bob Proulx
2013-11-25 2:30 ` Drew Adams
2013-11-25 3:45 ` Eli Zaretskii
0 siblings, 2 replies; 10+ messages in thread
From: Bob Proulx @ 2013-11-25 2:04 UTC (permalink / raw)
To: help-gnu-emacs
Óscar Fuentes wrote:
> Bob Proulx writes:
> > (if window-system
> > (setq mouse-yank-at-point t))
> > And to head off complaints about the example, it is only an example.
> > I am aware of 'fboundp'.
>
> I'll complain about something else, then :-)
:-)
> C-h v window-system
>
> [...]
>
> Use of this variable as a boolean is deprecated. Instead,
> use `display-graphic-p' or any of the other `display-*-p'
> predicates which report frame's specific UI-related capabilities.
Deprecated! I wish people would let the API mature and stabilize. I
hadn't heard of the display-graphic-p functions yet. Thanks for
mentioning them.
> So your example should be
>
> (if (display-graphic-p)
> ....
>
> There are several display-*-p functions for querying about specific
> features for a display.
Sure. Unless you happen to be using an older emacs that doesn't have
those newer functions. I will have to look to see how long they have
been around.
Bob
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: How to find out if emacs is running inside GUI or terminal
2013-11-25 2:04 ` Bob Proulx
@ 2013-11-25 2:30 ` Drew Adams
2013-11-25 3:46 ` Eli Zaretskii
[not found] ` <<83k3fxb0tu.fsf@gnu.org>
2013-11-25 3:45 ` Eli Zaretskii
1 sibling, 2 replies; 10+ messages in thread
From: Drew Adams @ 2013-11-25 2:30 UTC (permalink / raw)
To: Bob Proulx, help-gnu-emacs
> > There are several display-*-p functions for querying about specific
> > features for a display.
>
> Sure. Unless you happen to be using an older emacs that doesn't have
> those newer functions. I will have to look to see how long they have
> been around.
Emacs 22, for `display-graphic-p', at least.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to find out if emacs is running inside GUI or terminal
2013-11-25 2:30 ` Drew Adams
@ 2013-11-25 3:46 ` Eli Zaretskii
[not found] ` <<83k3fxb0tu.fsf@gnu.org>
1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2013-11-25 3:46 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sun, 24 Nov 2013 18:30:26 -0800 (PST)
> From: Drew Adams <drew.adams@oracle.com>
>
> > > There are several display-*-p functions for querying about specific
> > > features for a display.
> >
> > Sure. Unless you happen to be using an older emacs that doesn't have
> > those newer functions. I will have to look to see how long they have
> > been around.
>
> Emacs 22, for `display-graphic-p', at least.
No, it's Emacs 21.1; see NEWS.21.
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <<83k3fxb0tu.fsf@gnu.org>]
* Re: How to find out if emacs is running inside GUI or terminal
2013-11-25 2:04 ` Bob Proulx
2013-11-25 2:30 ` Drew Adams
@ 2013-11-25 3:45 ` Eli Zaretskii
2013-11-25 5:56 ` Bob Proulx
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2013-11-25 3:45 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sun, 24 Nov 2013 19:04:05 -0700
> From: Bob Proulx <bob@proulx.com>
>
> > C-h v window-system
> >
> > [...]
> >
> > Use of this variable as a boolean is deprecated. Instead,
> > use `display-graphic-p' or any of the other `display-*-p'
> > predicates which report frame's specific UI-related capabilities.
>
> Deprecated! I wish people would let the API mature and stabilize. I
> hadn't heard of the display-graphic-p functions yet. Thanks for
> mentioning them.
display-graphic-p (as well as the other display-*-p predicates) exist
since Emacs 21.1. And window-system is deprecated approximately since
that time also. So I think this deprecation is mature enough ;-)
> > There are several display-*-p functions for querying about specific
> > features for a display.
>
> Sure. Unless you happen to be using an older emacs that doesn't have
> those newer functions.
I very much doubt that you have such old Emacsen around.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to find out if emacs is running inside GUI or terminal
2013-11-25 3:45 ` Eli Zaretskii
@ 2013-11-25 5:56 ` Bob Proulx
0 siblings, 0 replies; 10+ messages in thread
From: Bob Proulx @ 2013-11-25 5:56 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii wrote:
> Bob Proulx wrote:
> > Deprecated! I wish people would let the API mature and stabilize. I
> > hadn't heard of the display-graphic-p functions yet. Thanks for
> > mentioning them.
>
> display-graphic-p (as well as the other display-*-p predicates) exist
> since Emacs 21.1. And window-system is deprecated approximately since
> that time also. So I think this deprecation is mature enough ;-)
I guess since 21.1 is long enough. :-)
> > > There are several display-*-p functions for querying about specific
> > > features for a display.
> >
> > Sure. Unless you happen to be using an older emacs that doesn't have
> > those newer functions.
>
> I very much doubt that you have such old Emacsen around.
Yes, unlikely. Version 23 is the typically oldest one for me. I am
using version 24 on my recent systems. Although I do sometimes miss
version 18 which always seems like the best "old one" that I remember. :-)
Bob
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to find out if emacs is running inside GUI or terminal
2013-11-22 19:16 How to find out if emacs is running inside GUI or terminal Louis-Guillaume Gagnon
2013-11-22 19:30 ` Bob Proulx
@ 2013-11-22 23:26 ` Stefan Monnier
1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2013-11-22 23:26 UTC (permalink / raw)
To: help-gnu-emacs
> Is there a way to find out within emacs if it is running in a GUI or inside
> a terminal (i.e. -nw switch specified on the cli) using Elisp?
Note that a single Emacs can run both with GUI frames and with terminal
frames at the same time. E.g. you can start "emacs -nw" and then from
there you can M-x make-frame-on-display RET to open GUI frames.
Or you can run Emacs in "GUI mode", then do M-x server-mode RET, and
then use "emacsclient -t" from a terminal to open a terminal frame.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-11-25 15:45 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-22 19:16 How to find out if emacs is running inside GUI or terminal Louis-Guillaume Gagnon
2013-11-22 19:30 ` Bob Proulx
2013-11-22 19:41 ` Óscar Fuentes
2013-11-25 2:04 ` Bob Proulx
2013-11-25 2:30 ` Drew Adams
2013-11-25 3:46 ` Eli Zaretskii
[not found] ` <<83k3fxb0tu.fsf@gnu.org>
2013-11-25 15:45 ` Drew Adams
2013-11-25 3:45 ` Eli Zaretskii
2013-11-25 5:56 ` Bob Proulx
2013-11-22 23:26 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.