all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: help-gnu-emacs@gnu.org
Subject: Re: How to find out if emacs is running inside GUI or terminal
Date: Fri, 22 Nov 2013 20:41:02 +0100	[thread overview]
Message-ID: <87d2lsjkc1.fsf@wanadoo.es> (raw)
In-Reply-To: 20131122193025.GA18686@hysteria.proulx.com

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	other threads:[~2013-11-22 19:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2lsjkc1.fsf@wanadoo.es \
    --to=ofv@wanadoo.es \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.