From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.help Subject: Re: How to find out if emacs is running inside GUI or terminal Date: Fri, 22 Nov 2013 20:41:02 +0100 Message-ID: <87d2lsjkc1.fsf@wanadoo.es> References: <20131122193025.GA18686@hysteria.proulx.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1385149293 2061 80.91.229.3 (22 Nov 2013 19:41:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Nov 2013 19:41:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 22 20:41:37 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vjwbh-0002tD-3N for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Nov 2013 20:41:37 +0100 Original-Received: from localhost ([::1]:40790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vjwbg-0006TH-Nc for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Nov 2013 14:41:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjwbQ-0006S1-M3 for help-gnu-emacs@gnu.org; Fri, 22 Nov 2013 14:41:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjwbK-0002Bh-E5 for help-gnu-emacs@gnu.org; Fri, 22 Nov 2013 14:41:20 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:39217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjwbK-0002BW-6w for help-gnu-emacs@gnu.org; Fri, 22 Nov 2013 14:41:14 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VjwbI-0002Yk-0y for help-gnu-emacs@gnu.org; Fri, 22 Nov 2013 20:41:12 +0100 Original-Received: from 69.red-83-46-210.dynamicip.rima-tde.net ([83.46.210.69]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Nov 2013 20:41:12 +0100 Original-Received: from ofv by 69.red-83-46-210.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Nov 2013 20:41:12 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 34 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 69.red-83-46-210.dynamicip.rima-tde.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:a8xALlyNGZh8/9NpHdcY3Al0+j8= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94574 Archived-At: Bob Proulx 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.