unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to `start-process' in different terminal?
@ 2014-06-22  9:23 Thorsten Jolitz
  2014-06-23  2:46 ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Thorsten Jolitz @ 2014-06-22  9:23 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List, 

when running Emacs on the console (without X) I use 'fbgs' to display
pdf files (converted to .tiff actally). This does not work with a
terminal multiplexer like tmux (running on e.g. tty), I have to switch
manually to e.g. tty1 to make it work.

Quite a lot of Emacs libs use start-process to display generated pdfs
with an OS dependent executable, for example "evince", always assuming 

,----[ C-h f display-graphic-p RET ]
| display-graphic-p is a compiled Lisp function in `frame.el'.
| 
| (display-graphic-p &optional DISPLAY)
| 
| Return non-nil if DISPLAY is a graphic display.
`----

is non-nil. I would like to fallback to "fbgs" if it is nil on
GNU/Linux, normally from an Emacs running inside a tmux session e.g. on
tty.  

How can I `start-process' in a different terminal (e.g. tty1) and switch
to that terminal in an Emacs Lisp program?

When I call `(terminal-list)' from Emacs instances on two different tty's I get
the same result:

,----
| (#<terminal 1 on /dev/tty>)
`----

and I don't find a function for switching terminal or calling cmd on
another terminal. 

-- 
cheers,
Thorsten





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

* Re: How to `start-process' in different terminal?
       [not found] <mailman.4092.1403429055.1147.help-gnu-emacs@gnu.org>
@ 2014-06-22 15:03 ` Pascal J. Bourguignon
  2014-06-23  2:47   ` Stefan Monnier
                     ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Pascal J. Bourguignon @ 2014-06-22 15:03 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Hi List, 
>
> when running Emacs on the console (without X) I use 'fbgs' to display
> pdf files (converted to .tiff actally). This does not work with a
> terminal multiplexer like tmux (running on e.g. tty), I have to switch
> manually to e.g. tty1 to make it work.
>
> Quite a lot of Emacs libs use start-process to display generated pdfs
> with an OS dependent executable, for example "evince", always assuming 
>
> ,----[ C-h f display-graphic-p RET ]
> | display-graphic-p is a compiled Lisp function in `frame.el'.
> | 
> | (display-graphic-p &optional DISPLAY)
> | 
> | Return non-nil if DISPLAY is a graphic display.
> `----
>
> is non-nil. I would like to fallback to "fbgs" if it is nil on
> GNU/Linux, normally from an Emacs running inside a tmux session e.g. on
> tty.  

It depends on the frame, nowadays emacs can work BOTH on a terminal and
a X window at the same time:

(frame-list) --> (#<frame PGM 0x39cff98> 
                  #<frame   gnus at kuiper.lan.informatimago.com 0x1172ab0>)

So calling display-graphic-p is meaningless.


> How can I `start-process' in a different terminal (e.g. tty1) and switch
> to that terminal in an Emacs Lisp program?
>
> When I call `(terminal-list)' from Emacs instances on two different tty's I get
> the same result:
>
> ,----
> | (#<terminal 1 on /dev/tty>)
> `----

I don't observe that:

(terminal-list) --> (#<terminal 1 on :0.0> 
                     #<terminal 2 on /dev/pts/3> 
                     #<terminal 4 on /dev/pts/5>)

(frame-list)  --> (#<frame PGM 0xe18b00> 
                   #<frame PGM 0x39cff98> 
                   #<frame   gnus at kuiper.lan.informatimago.com 0x1172ab0>)

> and I don't find a function for switching terminal or calling cmd on
> another terminal. 

You can use:

   (make-terminal-frame '((tty . "/dev/pts/5")
                         (tty-type . "xterm")))5)

to make a frame on a new terminal.


But to run a function in the context of another terminal, you need to
select a frame running on that terminal.

To find a frame running on a given terminal device:

    (first (remove* "/dev/pts/3" (frame-list)
                    :test (function string/=)
                    :key (lambda (frame) (terminal-name (frame-terminal frame)))))
    --> (#<frame PGM 0x39cff98>)

then you can use with-selected-frame to run your code on that frame.


To switch automatically to that terminal will depend on the multiplexer
you use.

You can use chvt(1) to switch to the linux console you want.  When you
run a multiplexer in the terminal, you need to use whatever is provided
by the multiplexer to switch to another view.

For example, with screen, you could print ESC ]83;select 1 BEL
to select the view 1.  I don't know tmux.  But the difficulty here would
be to have emacs send the escape sequence unchanged.   With message or
insert, screen doesn't seem to catch it, I guess we'd have to do that at
a lower level.

Finally if you're on X window, you would have to use window manager
commands to move the X window containing the terminal emulator you want
on the front.  With ratpoison it's done with:

   (shell-command "ratpoison -c 'select 1'")

but it depends on the window manager.  Perhaps there's some
common (ICCCM) command, and it should be possible to send it, since
emacs itself can be used as a X window manager (cf. xwem).



-- 
__Pascal Bourguignon__
http://www.informatimago.com/
"Le mercure monte ?  C'est le moment d'acheter !"


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

* Re: How to `start-process' in different terminal?
  2014-06-22  9:23 How to `start-process' in different terminal? Thorsten Jolitz
@ 2014-06-23  2:46 ` Stefan Monnier
  2014-06-24  9:23   ` Thorsten Jolitz
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2014-06-23  2:46 UTC (permalink / raw)
  To: help-gnu-emacs

> pdf files (converted to .tiff actally). This does not work with a
> terminal multiplexer like tmux (running on e.g. tty), I have to switch
> manually to e.g. tty1 to make it work.

Comparing "tty" to "tty1" is comparing apples and oranges.

> When I call `(terminal-list)' from Emacs instances on two different
> tty's I get the same result:

Emacs's "terminals" are yet different beasts.


        Stefan




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

* Re: How to `start-process' in different terminal?
  2014-06-22 15:03 ` Pascal J. Bourguignon
@ 2014-06-23  2:47   ` Stefan Monnier
       [not found]   ` <mailman.4136.1403492122.1147.help-gnu-emacs@gnu.org>
  2014-06-24 10:41   ` Thorsten Jolitz
  2 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2014-06-23  2:47 UTC (permalink / raw)
  To: help-gnu-emacs

> For example, with screen, you could print ESC ]83;select 1 BEL
> to select the view 1.  I don't know tmux.  But the difficulty here would
> be to have emacs send the escape sequence unchanged.   With message or
> insert, screen doesn't seem to catch it, I guess we'd have to do that at
> a lower level.

There' send-string-to-terminal for that.


        Stefan




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

* Re: How to `start-process' in different terminal?
       [not found]   ` <mailman.4136.1403492122.1147.help-gnu-emacs@gnu.org>
@ 2014-06-23  6:05     ` Pascal J. Bourguignon
  0 siblings, 0 replies; 13+ messages in thread
From: Pascal J. Bourguignon @ 2014-06-23  6:05 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> For example, with screen, you could print ESC ]83;select 1 BEL
>> to select the view 1.  I don't know tmux.  But the difficulty here would
>> be to have emacs send the escape sequence unchanged.   With message or
>> insert, screen doesn't seem to catch it, I guess we'd have to do that at
>> a lower level.
>
> There' send-string-to-terminal for that.

Very nice!  Thank you!

-- 
__Pascal Bourguignon__
http://www.informatimago.com/
"Le mercure monte ?  C'est le moment d'acheter !"


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

* Re: How to `start-process' in different terminal?
  2014-06-23  2:46 ` Stefan Monnier
@ 2014-06-24  9:23   ` Thorsten Jolitz
  2014-06-24 12:33     ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Thorsten Jolitz @ 2014-06-24  9:23 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> pdf files (converted to .tiff actally). This does not work with a
>> terminal multiplexer like tmux (running on e.g. tty), I have to switch
>> manually to e.g. tty1 to make it work.
>
> Comparing "tty" to "tty1" is comparing apples and oranges.

I probably meant "tty1" vs "tty2" etc ...

>> When I call `(terminal-list)' from Emacs instances on two different
>> tty's I get the same result:
>
> Emacs's "terminals" are yet different beasts.

the docstring says 

,----[ C-h f terminal-list RET ]
| terminal-list is a built-in function in `C source code'.
| 
| (terminal-list)
| 
| Return a list of all terminal devices.
| 
| [back]
`----

but the function returns 

,----
| (#<terminal 1 on /dev/tty>)
`----

in my case although Archlinux with systemd has several terminals
pre-initialized AFAIK. 

So this `terminal-list' is just about M-x term from within Emacs and
then

,----
| To make multiple terminal emulators, rename the buffer *terminal* to
| something different using M-x rename-uniquely, just as with Shell
| mode.
`----

I guess. 

-- 
cheers,
Thorsten




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

* Re: How to `start-process' in different terminal?
  2014-06-22 15:03 ` Pascal J. Bourguignon
  2014-06-23  2:47   ` Stefan Monnier
       [not found]   ` <mailman.4136.1403492122.1147.help-gnu-emacs@gnu.org>
@ 2014-06-24 10:41   ` Thorsten Jolitz
  2014-06-24 15:20     ` Thorsten Jolitz
  2014-06-24 15:37     ` Eli Zaretskii
  2 siblings, 2 replies; 13+ messages in thread
From: Thorsten Jolitz @ 2014-06-24 10:41 UTC (permalink / raw)
  To: help-gnu-emacs

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>

>> Quite a lot of Emacs libs use start-process to display generated pdfs
>> with an OS dependent executable, for example "evince"

>> I would like to fallback to "fbgs" if it is nil on GNU/Linux,
>> normally from an Emacs running inside a tmux session e.g. on tty.
>
> It depends on the frame, nowadays emacs can work BOTH on a terminal and
> a X window at the same time:
>
> (frame-list) --> (#<frame PGM 0x39cff98> 
>                   #<frame gnus at kuiper.lan.informatimago.com
> 0x1172ab0>)
>
> So calling display-graphic-p is meaningless.

hmm ... right now I try to live without X11, but before when I had one
Emacs server running and several Emacsclients open, on the console and
under X11, I used `display-graphic-p' successfully to determine
background-color.

>> How can I `start-process' in a different terminal (e.g. tty1) and switch
>> to that terminal in an Emacs Lisp program?
>>
>> When I call `(terminal-list)' from Emacs instances on two different
>> tty's I get
>> the same result:
>>
>> ,----
>> | (#<terminal 1 on /dev/tty>)
>> `----
>
> I don't observe that:
>
> (terminal-list) --> (#<terminal 1 on :0.0> 
>                      #<terminal 2 on /dev/pts/3> 
>                      #<terminal 4 on /dev/pts/5>)
>
> (frame-list)  --> (#<frame PGM 0xe18b00> 
>                    #<frame PGM 0x39cff98> 
>                    #<frame   gnus at kuiper.lan.informatimago.com 0x1172ab0>)


,----
| (terminal-list) --> (#<terminal 1 on /dev/tty>)
| 
| (frame-list) --> (#<frame F1 0xbc5c20>)
`----

even when I switch from tty1 to tty2 and start Emacs -Q I get

,----
| (terminal-list) --> (#<terminal 1 on /dev/tty>)
`----

again.

>> and I don't find a function for switching terminal or calling cmd on
>> another terminal. 
>
> You can use:
>
>    (make-terminal-frame '((tty . "/dev/pts/5")
>                          (tty-type . "xterm")))5)
>
> to make a frame on a new terminal.

seems to work

,----
| (make-terminal-frame '((tty2 . "/dev/pts/5")
|                        (tty-type . "xterm")))
| 
| -> #<frame F2 0x4d834f0>
`----

and I get

,----
| (frame-configuration (#<frame F2 0x4d834f0> ((menu-bar-lines . 0)
| (buried-buffer-list) (buffer-list *Ibuffer* *Minibuf-1* *unsent followup
| to Pascal J. Bourguignon on gmane.emacs.help*) ...)
| 
| (#<frame F1 0xbc5c20> ((buried-buffer-list *Backtrace* *Completions*
| *sent followup to Stefan Monnier on gmane.emacs.help* .newsrc-dribble)
| (buffer-list *unsent followup to Pascal J. Bourguignon on
| gmane.emacs.help* ...))
`----

but `frame-terminal' returns the same in both frames:
(#<terminal 1 on /dev/tty>). 

I'm probably confused wrt console, terminal, shell ...

This is what ps shows me right now (I'm on Archlinux):

,----
|   182 root     1:name=systemd:/user.slice/ login -- tj
|   188 tj       1:name=systemd:/user.slice/  \_ -bash
|   219 tj       1:name=systemd:/user.slice/      \_ tmux
|   221 tj       1:name=systemd:/user.slice/ tmux
|   267 tj       1:name=systemd:/user.slice/  \_ bash
|   270 tj       1:name=systemd:/user.slice/  |   \_ emacs --debug-init
|   283 tj       1:name=systemd:/user.slice/  |       \_ /usr/bin/idn
|   --quiet --idna-to-ascii --usestd3asciirules
|  1473 root     1:name=systemd:/user.slice/ login -- tj
|  1475 tj       1:name=systemd:/user.slice/  \_ -bash
`----

I just logged in, started tmux, then started emacs. Then I switched
terminals with M-<right> going from tty1 to tty2 and logged in again
(thats what I thought at least, and thats what I'm told at the login
shell prompt). 

But it seems I'm on the same terminal all the time? When I start Emacs
-Q from the bash with pid 1475 I would assume its on another terminal
than the one I started from bash with pid 267, but apparently it isn't. 

> But to run a function in the context of another terminal, you need to
> select a frame running on that terminal.
>
> To find a frame running on a given terminal device:
>
>     (first (remove* "/dev/pts/3" (frame-list)
>                     :test (function string/=)
>                     :key (lambda (frame) (terminal-name (frame-terminal frame)))))
>     --> (#<frame PGM 0x39cff98>)
>
> then you can use with-selected-frame to run your code on that frame.

 (first (remove* "/dev/pts/3" (frame-list)
                 :test (function string=)
                 :key (lambda (frame) (terminal-name (frame-terminal
                 frame)))))

--> #<frame F2 0x4d834f0>

ok ...

> To switch automatically to that terminal will depend on the multiplexer
> you use.
>
> You can use chvt(1) to switch to the linux console you want.  When you
> run a multiplexer in the terminal, you need to use whatever is provided
> by the multiplexer to switch to another view.

,----
| [tj@arch ~]$ chvt 2
| Couldn't get a file descriptor referring to the console
`----

I have to figure that out for tmux

> For example, with screen, you could print ESC ]83;select 1 BEL
> to select the view 1.  I don't know tmux.  But the difficulty here would
> be to have emacs send the escape sequence unchanged.   With message or
> insert, screen doesn't seem to catch it, I guess we'd have to do that at
> a lower level.

... this too.

> Finally if you're on X window, you would have to use window manager
> commands to move the X window containing the terminal emulator you want
> on the front.  With ratpoison it's done with:
>
>    (shell-command "ratpoison -c 'select 1'")
>
> but it depends on the window manager.  Perhaps there's some
> common (ICCCM) command, and it should be possible to send it, since
> emacs itself can be used as a X window manager (cf. xwem).

Well, my question was more about the situation without X11, since
otherwise I don't see a reason not to use e.g. evince to display
generated pdfs.

The use-case I had in mind is:
 
 - Emacs on the console with terminal-multiplexer (tmux), no Xorg server
   running

 - Emacs libraries (org, auctex ...) produce pdf output

 - pdf can be viewed without X11 using frame-buffer tools like fbgs

 - but these tools don't work with terminal-multiplexer like tmux, thus
   I have to manually switch from tty1 (with tmux) to tty2 (without
   tmux) and call fbgs from there.

The question was if its possible to e.g. make org-export instruction

,----
| Export to LaTeX as PDF file and open
`----

work in such a scenario too. 

From your answer I would say 'yes', I only need to figure out the very
last tmux-specific steps. I'll try ...

Thanks a lot.

-- 
cheers,
Thorsten




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

* Re: How to `start-process' in different terminal?
  2014-06-24  9:23   ` Thorsten Jolitz
@ 2014-06-24 12:33     ` Stefan Monnier
  2014-06-24 13:00       ` Thorsten Jolitz
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2014-06-24 12:33 UTC (permalink / raw)
  To: help-gnu-emacs

> | terminal-list is a built-in function in `C source code'.
[...]
> but the function returns 
> ,----
> | (#<terminal 1 on /dev/tty>)
> `----

Emacs's terminals are not the OS's terminals.  It's the "output devices"
that Emacs currently uses.  So if you have several "emacsclient -t"
sessions (or used make-terminal-frame), each one will have its own
"terminal" (one might be on /dev/tty1, another on /dev/pts/4), and every
time you use make-frame-on-display on another display you'll get
another "terminal".

> in my case although Archlinux with systemd has several terminals
> pre-initialized AFAIK.

But Emacs isn't using these, hence they're not in the list.

> So this `terminal-list' is just about M-x term from within Emacs and
> then

No, M-x term is yet something completely different.  These are virtual
terminals created inside Emacs for use by other applications.


        Stefan




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

* Re: How to `start-process' in different terminal?
  2014-06-24 12:33     ` Stefan Monnier
@ 2014-06-24 13:00       ` Thorsten Jolitz
  0 siblings, 0 replies; 13+ messages in thread
From: Thorsten Jolitz @ 2014-06-24 13:00 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> | terminal-list is a built-in function in `C source code'.
> [...]
>> but the function returns 
>> ,----
>> | (#<terminal 1 on /dev/tty>)
>> `----
>
> Emacs's terminals are not the OS's terminals.  It's the "output devices"
> that Emacs currently uses.  So if you have several "emacsclient -t"
> sessions (or used make-terminal-frame), each one will have its own
> "terminal" (one might be on /dev/tty1, another on /dev/pts/4), and every
> time you use make-frame-on-display on another display you'll get
> another "terminal".
>
>> in my case although Archlinux with systemd has several terminals
>> pre-initialized AFAIK.
>
> But Emacs isn't using these, hence they're not in the list.
>
>> So this `terminal-list' is just about M-x term from within Emacs and
>> then
>
> No, M-x term is yet something completely different.  These are virtual
> terminals created inside Emacs for use by other applications.

Ok, on top of the already a bit confusing console/terminal/tty/pty stuff
there is another layer of confusion once Emacs enters the game ...

So calling 'tty on my tty1 (with tmux) I get

,----
| [tj@arch ~]$ tty
| /dev/pts/0
`----

while after switching to tty2 (without tmux) I get

,----
| [tj@arch ~]$ tty
| /dev/tty2
`----

and I would need to explicitly make terminal-frames on both to get 2
"terminals" in Emacs 'terminal-list. 

-- 
cheers,
Thorsten




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

* Re: How to `start-process' in different terminal?
  2014-06-24 10:41   ` Thorsten Jolitz
@ 2014-06-24 15:20     ` Thorsten Jolitz
  2014-06-24 15:37     ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Thorsten Jolitz @ 2014-06-24 15:20 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:

> The use-case I had in mind is:
>  
>  - Emacs on the console with terminal-multiplexer (tmux), no Xorg server
>    running
>
>  - Emacs libraries (org, auctex ...) produce pdf output
>
>  - pdf can be viewed without X11 using frame-buffer tools like fbgs
>
>  - but these tools don't work with terminal-multiplexer like tmux, thus
>    I have to manually switch from tty1 (with tmux) to tty2 (without
>    tmux) and call fbgs from there.
>
> The question was if its possible to e.g. make org-export instruction
>
> ,----
> | Export to LaTeX as PDF file and open
> `----
>
> work in such a scenario too. 
>
> From your answer I would say 'yes', I only need to figure out the very
> last tmux-specific steps. I'll try ...

Ok, after some experimenting I figured out that calling fbgs from Emacs
does not work anyway (not even from Emacs on e.g. tty2 with tty-type
linux and no tmux/screen involved.

I get the same error I get when calling fbgs from tmux:

,----
| [tj@arch ~]$ LC_ALL=C fbgs junk/test1.pdf
| 
| ### rendering pages, please wait ... ###
| 
| GPL Ghostscript 9.14 (2014-03-26)
| Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.
| This software comes with NO WARRANTY: see the file PUBLIC for details.
| Processing pages 1 through 1.
| Page 1
| using "Bitstream Vera Sans Mono-16", pixelsize=16.67
| file=/usr/share/fonts/TTF/VeraMono.ttf
| ioctl VT_GETSTATE: Inappropriate ioctl for device (not a linux console?)
`----

So the solution seems to be writing a shellscript that detaches from the
tmux session and then call fbgs on its (pdf) argument and call this
shell-command from Emacs Lisp. 

This 

,----
| #!/bin/sh
| # detach from tmux and call fbgs on arg
| 
| tmux detach
| fbgs "$1"
`----

does not work yet, I get the same error as above, although prompt is now
at a linux console and I can successfully call fbgs manually. 

PS 

If this would work, a simple manual 'tmux attach' would bring you back
to the tmux session and Emacs.




-- 
cheers,
Thorsten




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

* Re: How to `start-process' in different terminal?
  2014-06-24 10:41   ` Thorsten Jolitz
  2014-06-24 15:20     ` Thorsten Jolitz
@ 2014-06-24 15:37     ` Eli Zaretskii
  2014-06-24 16:51       ` Thorsten Jolitz
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2014-06-24 15:37 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Thorsten Jolitz <tjolitz@gmail.com>
> Date: Tue, 24 Jun 2014 12:41:08 +0200
> 
> >> I would like to fallback to "fbgs" if it is nil on GNU/Linux,
> >> normally from an Emacs running inside a tmux session e.g. on tty.
> >
> > It depends on the frame, nowadays emacs can work BOTH on a terminal and
> > a X window at the same time:
> >
> > (frame-list) --> (#<frame PGM 0x39cff98> 
> >                   #<frame gnus at kuiper.lan.informatimago.com
> > 0x1172ab0>)
> >
> > So calling display-graphic-p is meaningless.
> 
> hmm ... right now I try to live without X11, but before when I had one
> Emacs server running and several Emacsclients open, on the console and
> under X11, I used `display-graphic-p' successfully to determine
> background-color.

I don't understand why.  There's absolutely no relation between
display-graphic-p and the color capabilities of the frame's terminal.
There are graphic terminals that can only display shades of gray, and
there are text terminals that can display hundreds of colors.

There are other predicates and functions to query the terminal about
color support.



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

* Re: How to `start-process' in different terminal?
  2014-06-24 15:37     ` Eli Zaretskii
@ 2014-06-24 16:51       ` Thorsten Jolitz
  2014-06-24 17:02         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Thorsten Jolitz @ 2014-06-24 16:51 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> > So calling display-graphic-p is meaningless.
>> 
>> hmm ... right now I try to live without X11, but before when I had one
>> Emacs server running and several Emacsclients open, on the console and
>> under X11, I used `display-graphic-p' successfully to determine
>> background-color.
>
> I don't understand why.  There's absolutely no relation between
> display-graphic-p and the color capabilities of the frame's terminal.
> There are graphic terminals that can only display shades of gray, and
> there are text terminals that can display hundreds of colors.

With `display-graphic-p' non-nil, I changed background color of
emacsclient to black and foreground to white, otherwise I did not need
to do that because thats what I got anyway on the console.

-- 
cheers,
Thorsten




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

* Re: How to `start-process' in different terminal?
  2014-06-24 16:51       ` Thorsten Jolitz
@ 2014-06-24 17:02         ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2014-06-24 17:02 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Thorsten Jolitz <tjolitz@gmail.com>
> Date: Tue, 24 Jun 2014 18:51:59 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> > So calling display-graphic-p is meaningless.
> >> 
> >> hmm ... right now I try to live without X11, but before when I had one
> >> Emacs server running and several Emacsclients open, on the console and
> >> under X11, I used `display-graphic-p' successfully to determine
> >> background-color.
> >
> > I don't understand why.  There's absolutely no relation between
> > display-graphic-p and the color capabilities of the frame's terminal.
> > There are graphic terminals that can only display shades of gray, and
> > there are text terminals that can display hundreds of colors.
> 
> With `display-graphic-p' non-nil, I changed background color of
> emacsclient to black and foreground to white, otherwise I did not need
> to do that because thats what I got anyway on the console.

Until the day comes when you need to do the same on the text
terminal.  Why not learn The Right Way now?



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

end of thread, other threads:[~2014-06-24 17:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-22  9:23 How to `start-process' in different terminal? Thorsten Jolitz
2014-06-23  2:46 ` Stefan Monnier
2014-06-24  9:23   ` Thorsten Jolitz
2014-06-24 12:33     ` Stefan Monnier
2014-06-24 13:00       ` Thorsten Jolitz
     [not found] <mailman.4092.1403429055.1147.help-gnu-emacs@gnu.org>
2014-06-22 15:03 ` Pascal J. Bourguignon
2014-06-23  2:47   ` Stefan Monnier
     [not found]   ` <mailman.4136.1403492122.1147.help-gnu-emacs@gnu.org>
2014-06-23  6:05     ` Pascal J. Bourguignon
2014-06-24 10:41   ` Thorsten Jolitz
2014-06-24 15:20     ` Thorsten Jolitz
2014-06-24 15:37     ` Eli Zaretskii
2014-06-24 16:51       ` Thorsten Jolitz
2014-06-24 17:02         ` Eli Zaretskii

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).