help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to find out if emacs is running inside GUI or terminal


From: Óscar Fuentes
Subject: Re: How to find out if emacs is running inside GUI or terminal
Date: Fri, 22 Nov 2013 20:41:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]