unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Terminal only emacs question
       [not found] <20200924220106.way5eue2tmykuhgy.ref@Ergus>
@ 2020-09-24 22:01 ` Ergus
  2020-09-24 22:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-09-25  1:22   ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Ergus @ 2020-09-24 22:01 UTC (permalink / raw)
  To: help-gnu-emacs


Hi emacs:

Whats the way to determine in the init file if a emacs is running under
a terminal emulator or the linux console?

I need this to condition the load of xterm-mouse-mode or
gpm-mouse-mode. I tried getenv but for some reason inside emacs it is
always "dumb".

Any idea?

Best,
Ergus



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

* Re: Terminal only emacs question
  2020-09-24 22:01 ` Terminal only emacs question Ergus
@ 2020-09-24 22:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-09-24 22:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-09-25  1:22   ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-09-24 22:10 UTC (permalink / raw)
  To: help-gnu-emacs

Ergus wrote:

> Whats the way to determine in the init file if
> a emacs is running under a terminal emulator or the
> linux console?

Well, the Linux console, AKA the Linux VTs (virtual
terminals), is also a terminal emulator, "emulator"
and "virtual" here denotes the same thing, i.e.
that it isn't a physical terminal.

> I need this to condition the load of xterm-mouse-mode
> or gpm-mouse-mode. I tried getenv but for some reason
> inside emacs it is always "dumb".

OK, you tried `getenv', but with what?

> Any idea?

Check out the variable `window-system'...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Terminal only emacs question
  2020-09-24 22:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-09-24 22:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-09-24 22:20       ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-09-24 22:14 UTC (permalink / raw)
  To: help-gnu-emacs

> Check out the variable `window-system'...

If that doesn't work, you can invoke Emacs in just
slightly different ways. In X, you do

   $ emacs --eval '(setq win-var t)'

then branch on that in your init files!

But `window-system' is still preferable, more
elegant, I'd say, so try that first :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Terminal only emacs question
  2020-09-24 22:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-09-24 22:20       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-09-24 22:39         ` Ergus
  0 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-09-24 22:20 UTC (permalink / raw)
  To: help-gnu-emacs

> But `window-system' is still preferable, more
> elegant, I'd say, so try that first :)

In the docstring to `window-system' it says:

  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.

Hm... your use case is boolean, right?

So try:

  (display-graphic-p)

:)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Terminal only emacs question
  2020-09-24 22:20       ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-09-24 22:39         ` Ergus
  2020-09-24 22:53           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 9+ messages in thread
From: Ergus @ 2020-09-24 22:39 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Sep 25, 2020 at 12:20:32AM +0200, Emanuel Berg via Users list for the GNU Emacs text editor wrote:
>> But `window-system' is still preferable, more
>> elegant, I'd say, so try that first :)
>
>In the docstring to `window-system' it says:
>
>  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.
>
>Hm... your use case is boolean, right?
>
>So try:
>
>  (display-graphic-p)
>
>:)
>
That was the first I tried and it is nil in both cases :(

(display-graphic-p) is non nil only when using a gui but in xterm it is
nil.

>-- 
>underground experts united
>http://user.it.uu.se/~embe8573
>https://dataswamp.org/~incal
>
>



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

* Re: Terminal only emacs question
  2020-09-24 22:39         ` Ergus
@ 2020-09-24 22:53           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-09-24 22:53 UTC (permalink / raw)
  To: help-gnu-emacs

Ergus wrote:

> (display-graphic-p) is non nil only when using
> a gui but in xterm it is nil.

OK, just invoke in different ways then, that should
be foolproof.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Terminal only emacs question
  2020-09-24 22:01 ` Terminal only emacs question Ergus
  2020-09-24 22:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-09-25  1:22   ` Stefan Monnier
  2020-09-25  2:32     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-09-25  3:22     ` Ergus
  1 sibling, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2020-09-25  1:22 UTC (permalink / raw)
  To: help-gnu-emacs

> I tried getenv but for some reason inside emacs it is always "dumb".

I don't think that's right.  Try it again, but this time, be careful to
call this `getenv` early (i.e. before the end of your `.emacs`).


        Stefan




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

* Re: Terminal only emacs question
  2020-09-25  1:22   ` Stefan Monnier
@ 2020-09-25  2:32     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-09-25  3:22     ` Ergus
  1 sibling, 0 replies; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-09-25  2:32 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier wrote:

>> I tried getenv but for some reason inside emacs it
>> is always "dumb".
>
> I don't think that's right. Try it again, but this
> time, be careful to call this `getenv` early (i.e.
> before the end of your `.emacs`).

What does it mean to use `getenv'?

With TERM, i.e. (getenv "TERM") ?

If so, then: dumb

In the shell, using tmux: screen, both in the
Linux VTs and xterm.

In the Linux VTs, w/o tmux: linux

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Terminal only emacs question
  2020-09-25  1:22   ` Stefan Monnier
  2020-09-25  2:32     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-09-25  3:22     ` Ergus
  1 sibling, 0 replies; 9+ messages in thread
From: Ergus @ 2020-09-25  3:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

On Thu, Sep 24, 2020 at 09:22:04PM -0400, Stefan Monnier wrote:
>> I tried getenv but for some reason inside emacs it is always "dumb".
>
>I don't think that's right.  Try it again, but this time, be careful to
>call this `getenv` early (i.e. before the end of your `.emacs`).
>
>
>        Stefan
>
You are right diring the init the "TERM" variable is different... I
could use that; thanks!



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

end of thread, other threads:[~2020-09-25  3:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200924220106.way5eue2tmykuhgy.ref@Ergus>
2020-09-24 22:01 ` Terminal only emacs question Ergus
2020-09-24 22:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-24 22:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-24 22:20       ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-24 22:39         ` Ergus
2020-09-24 22:53           ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-25  1:22   ` Stefan Monnier
2020-09-25  2:32     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-25  3:22     ` Ergus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).