all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* way to discriminate between Emacs.app or terminal launch of Emacs in init.el
@ 2015-08-17 22:22 christopherpenrose
  2015-08-17 22:41 ` christopherpenrose
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: christopherpenrose @ 2015-08-17 22:22 UTC (permalink / raw)
  To: help-gnu-emacs

I would like to have a logic switch in init.el that either detects that I am launching via Terminal in OS X or launching via Emacs.app on OS X. Is there a way to do this?

I am quite happy using Emacs in a terminal, and am often inconvenienced using Emacs.app for all my emacs needs, despite netsperts who proclaim that I am gimping myself.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: way to discriminate between Emacs.app or terminal launch of Emacs in init.el
  2015-08-17 22:22 way to discriminate between Emacs.app or terminal launch of Emacs in init.el christopherpenrose
@ 2015-08-17 22:41 ` christopherpenrose
  2015-08-17 22:53 ` Pascal J. Bourguignon
  2015-08-19 11:42 ` Alexis
  2 siblings, 0 replies; 6+ messages in thread
From: christopherpenrose @ 2015-08-17 22:41 UTC (permalink / raw)
  To: help-gnu-emacs

For now I am simply using emacs-version in a conditional. Yosemite still has Emacs 22 and I can simply use that as a distinction for now.  Is there a terminal type variable or such that might work better?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: way to discriminate between Emacs.app or terminal launch of Emacs in init.el
  2015-08-17 22:22 way to discriminate between Emacs.app or terminal launch of Emacs in init.el christopherpenrose
  2015-08-17 22:41 ` christopherpenrose
@ 2015-08-17 22:53 ` Pascal J. Bourguignon
  2015-08-18  0:18   ` Drew Adams
       [not found]   ` <mailman.8493.1439857145.904.help-gnu-emacs@gnu.org>
  2015-08-19 11:42 ` Alexis
  2 siblings, 2 replies; 6+ messages in thread
From: Pascal J. Bourguignon @ 2015-08-17 22:53 UTC (permalink / raw)
  To: help-gnu-emacs

christopherpenrose@gmail.com writes:

> I would like to have a logic switch in init.el that either detects
> that I am launching via Terminal in OS X or launching via Emacs.app on
> OS X. Is there a way to do this?
>
> I am quite happy using Emacs in a terminal, and am often
> inconvenienced using Emacs.app for all my emacs needs, despite
> netsperts who proclaim that I am gimping myself.


You can use window-system
It'll be nil in the terminal, and ns for Emacs.app.
Other values are possible.

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: way to discriminate between Emacs.app or terminal launch of Emacs in init.el
  2015-08-17 22:53 ` Pascal J. Bourguignon
@ 2015-08-18  0:18   ` Drew Adams
       [not found]   ` <mailman.8493.1439857145.904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2015-08-18  0:18 UTC (permalink / raw)
  To: Pascal J. Bourguignon, help-gnu-emacs

> > I am quite happy using Emacs in a terminal, and am often
> > inconvenienced using Emacs.app for all my emacs needs, despite
> > netsperts who proclaim that I am gimping myself. 
> 
> You can use window-system
> It'll be nil in the terminal, and ns for Emacs.app.
> Other values are possible.

I think this is what's recommended, but I can't tell you why
`display-graphic-p' is supposed to be better here. ;-)

(if (fboundp 'display-graphic-p)
    (display-graphic-p)
  window-system)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: way to discriminate between Emacs.app or terminal launch of Emacs in init.el
       [not found]   ` <mailman.8493.1439857145.904.help-gnu-emacs@gnu.org>
@ 2015-08-18  5:24     ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2015-08-18  5:24 UTC (permalink / raw)
  To: help-gnu-emacs

> I think this is what's recommended, but I can't tell you why
> `display-graphic-p' is supposed to be better here. ;-)

The "better" is mostly for Elisp packages.  One of the reasons is that
it takes an argument, so it can check whether a given frame is graphical
or is a tty (after all, a single Emacs session can have both).
The other is that window-system can have value `pc' when running in the
FreeDOS port, and that port does not offer graphics mode.

In the use case of the OP, it probably just doesn't matter.


        Stefan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: way to discriminate between Emacs.app or terminal launch of Emacs in init.el
  2015-08-17 22:22 way to discriminate between Emacs.app or terminal launch of Emacs in init.el christopherpenrose
  2015-08-17 22:41 ` christopherpenrose
  2015-08-17 22:53 ` Pascal J. Bourguignon
@ 2015-08-19 11:42 ` Alexis
  2 siblings, 0 replies; 6+ messages in thread
From: Alexis @ 2015-08-19 11:42 UTC (permalink / raw)
  To: help-gnu-emacs


christopherpenrose@gmail.com writes:

> I would like to have a logic switch in init.el that either 
> detects that I am launching via Terminal in OS X or launching 
> via Emacs.app on OS X. Is there a way to do this?

i'm on Debian Linux, but i use `framep` to detect whether i'm 
starting `emacsclient` from X or from the console:

    (framep OBJECT) 
 
    Return non-nil if OBJECT is a frame.  Value is: 
      t for a termcap frame (a character-only terminal), 
     'x' for an Emacs frame that is really an X window, 'w32' for 
     an Emacs frame that is a window on MS-Windows display, 'ns' 
     for an Emacs frame on a GNUstep or Macintosh Cocoa display, 
     'pc' for a direct-write MS-DOS frame.


Alexis.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-19 11:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-17 22:22 way to discriminate between Emacs.app or terminal launch of Emacs in init.el christopherpenrose
2015-08-17 22:41 ` christopherpenrose
2015-08-17 22:53 ` Pascal J. Bourguignon
2015-08-18  0:18   ` Drew Adams
     [not found]   ` <mailman.8493.1439857145.904.help-gnu-emacs@gnu.org>
2015-08-18  5:24     ` Stefan Monnier
2015-08-19 11:42 ` Alexis

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.