unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Daemon/Client, Multiple Terminals, and `tty-erase-char'
@ 2019-12-16  4:00 Alexander Shukaev
  2019-12-16  5:19 ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Alexander Shukaev @ 2019-12-16  4:00 UTC (permalink / raw)
  To: emacs-devel

Hi,

Simple question, is `tty-erase-char' defined per terminal instance 
running terminal variant of Emacs client connecting to Emacs Daemon 
instance?  That is, in case of multiple terminal Emacs instances running 
from different terminals each of which defines a different value for 
`tty-erase-char', but all of them connecting to the same Emacs Daemon 
instance, would each corresponding frame refer to a different value of 
`tty-erase-char'?

Regards,
Alexander



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16  4:00 Daemon/Client, Multiple Terminals, and `tty-erase-char' Alexander Shukaev
@ 2019-12-16  5:19 ` Eli Zaretskii
  2019-12-16  5:57   ` Alexander Shukaev
  2019-12-16 16:02   ` Andreas Schwab
  0 siblings, 2 replies; 13+ messages in thread
From: Eli Zaretskii @ 2019-12-16  5:19 UTC (permalink / raw)
  To: emacs-devel, Alexander Shukaev

On December 16, 2019 6:00:46 AM GMT+02:00, Alexander Shukaev <emacs@Alexander.Shukaev.name> wrote:
> Hi,
> 
> Simple question, is `tty-erase-char' defined per terminal instance 
> running terminal variant of Emacs client connecting to Emacs Daemon 
> instance?  That is, in case of multiple terminal Emacs instances
> running 
> from different terminals each of which defines a different value for 
> `tty-erase-char', but all of them connecting to the same Emacs Daemon 
> instance, would each corresponding frame refer to a different value of
> 
> `tty-erase-char'?
> 
> Regards,
> Alexander

tty-erase-char is a global variable, so it is not per terminal.

But I don't think I understand what you mean by "frame refers to a different value" in this context.  What do you think Emacs does with the value of this variable, that you need to be specific to a frame?



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16  5:19 ` Eli Zaretskii
@ 2019-12-16  5:57   ` Alexander Shukaev
  2019-12-16 15:30     ` Eli Zaretskii
  2019-12-16 16:02   ` Andreas Schwab
  1 sibling, 1 reply; 13+ messages in thread
From: Alexander Shukaev @ 2019-12-16  5:57 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel

[-- Attachment #1: Type: text/html, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 216 bytes --]

The expectation is that 'normal-erase-is-backspace' does the right thing in different terminal of course.  But that's just an example, and aside from it, this variable seems to be terminal-specific due to its nature.

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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16  5:57   ` Alexander Shukaev
@ 2019-12-16 15:30     ` Eli Zaretskii
  2019-12-16 15:51       ` Alexander Shukaev
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2019-12-16 15:30 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: emacs-devel

> Date: Mon, 16 Dec 2019 05:57:59 +0000
> From: Alexander Shukaev <emacs@Alexander.Shukaev.name>
> 
> The expectation is that 'normal-erase-is-backspace' does the right thing in different terminal of course. But
> that's just an example, and aside from it, this variable seems to be terminal-specific due to its nature.

Do you have a real-life situation where it is important to have
'normal-erase-is-backspace' to be different on different terminals?

We have some infrastructure to record the value in a terminal
parameter, but I don't see the mode function called when we switch
frames.  And a mode cannot be terminal- or frame-specific.

So it looks like if someone intended to make this work differently on
different terminals, they didn't finish the job.  Or maybe I missing
something; but if not, the question is whether we really need this
stuff nowadays, or is it obsolete and should be removed at some future
point.



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16 15:30     ` Eli Zaretskii
@ 2019-12-16 15:51       ` Alexander Shukaev
  0 siblings, 0 replies; 13+ messages in thread
From: Alexander Shukaev @ 2019-12-16 15:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/html, Size: 2179 bytes --]

[-- Attachment #2: Type: text/plain, Size: 1675 bytes --]

I don't think this can be deprecated.  That logic to determine the behavior of backspace and delete keys is important.  I saw 'terminal-parameter' being used there, plus there are variables like 'local-function-key-map', which is supposed to be per-frame as that is it's purpose in the first place, and it even seems to have been introduced exactly for this 'normal-erase-is-backspace' use case because it's only directly mapped in that function.  So I expected 'tty-erase-char' to also be frame-specific, otherwise, this is indeed unfinished and won't work even in the simple case of having both one GUI and one terminal clients at the same time.

On December 16, 2019 4:30:10 PM GMT+01:00, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Mon, 16 Dec 2019 05:57:59 +0000
>> From: Alexander Shukaev <emacs@Alexander.Shukaev.name>
>> 
>> The expectation is that 'normal-erase-is-backspace' does the right
>thing in different terminal of course. But
>> that's just an example, and aside from it, this variable seems to be
>terminal-specific due to its nature.
>
>Do you have a real-life situation where it is important to have
>'normal-erase-is-backspace' to be different on different terminals?
>
>We have some infrastructure to record the value in a terminal
>parameter, but I don't see the mode function called when we switch
>frames.  And a mode cannot be terminal- or frame-specific.
>
>So it looks like if someone intended to make this work differently on
>different terminals, they didn't finish the job.  Or maybe I missing
>something; but if not, the question is whether we really need this
>stuff nowadays, or is it obsolete and should be removed at some future
>point.

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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16  5:19 ` Eli Zaretskii
  2019-12-16  5:57   ` Alexander Shukaev
@ 2019-12-16 16:02   ` Andreas Schwab
  2019-12-16 16:36     ` Alexander Shukaev
  2019-12-16 17:01     ` Eli Zaretskii
  1 sibling, 2 replies; 13+ messages in thread
From: Andreas Schwab @ 2019-12-16 16:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alexander Shukaev, emacs-devel

On Dez 16 2019, Eli Zaretskii wrote:

> tty-erase-char is a global variable, so it is not per terminal.
>
> But I don't think I understand what you mean by "frame refers to a different value" in this context.  What do you think Emacs does with the value of this variable, that you need to be specific to a frame?

Currently, tty-erase-char is set to the ERASE character of the last
opened terminal.  Since normal-erase-is-backspace-setup-frame is
normally only called once when the frame is created, this happens to
work out right.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16 16:02   ` Andreas Schwab
@ 2019-12-16 16:36     ` Alexander Shukaev
  2019-12-16 17:01     ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Alexander Shukaev @ 2019-12-16 16:36 UTC (permalink / raw)
  To: Andreas Schwab, Eli Zaretskii; +Cc: emacs-devel

On 12/16/19 5:02 PM, Andreas Schwab wrote:
> On Dez 16 2019, Eli Zaretskii wrote:
> 
>> tty-erase-char is a global variable, so it is not per terminal.
>>
>> But I don't think I understand what you mean by "frame refers to a different value" in this context.  What do you think Emacs does with the value of this variable, that you need to be specific to a frame?
> 
> Currently, tty-erase-char is set to the ERASE character of the last
> opened terminal.  Since normal-erase-is-backspace-setup-frame is
> normally only called once when the frame is created, this happens to
> work out right.
> 
> Andreas.
> 

Cool!  That's the part I didn't get from the C code.  Thanks for 
confirming!  It's worth documenting I guess though.



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16 16:02   ` Andreas Schwab
  2019-12-16 16:36     ` Alexander Shukaev
@ 2019-12-16 17:01     ` Eli Zaretskii
  2019-12-16 17:15       ` Andreas Schwab
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2019-12-16 17:01 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs, emacs-devel

> From: Andreas Schwab <schwab@suse.de>
> Cc: emacs-devel@gnu.org, Alexander Shukaev <emacs@Alexander.Shukaev.name>
> Date: Mon, 16 Dec 2019 17:02:56 +0100
> 
> On Dez 16 2019, Eli Zaretskii wrote:
> 
> > tty-erase-char is a global variable, so it is not per terminal.
> >
> > But I don't think I understand what you mean by "frame refers to a different value" in this context.  What do you think Emacs does with the value of this variable, that you need to be specific to a frame?
> 
> Currently, tty-erase-char is set to the ERASE character of the last
> opened terminal.  Since normal-erase-is-backspace-setup-frame is
> normally only called once when the frame is created, this happens to
> work out right.

tty-erase-char is also set whenever init_sys_modes is called, and
many/most of its callers are generally supposed to be called for the
controlling terminal only.  If one of those callers is actually
called, tty-erase-char will be reset to the ERASE character of the
controlling terminal, AFAIU.



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16 17:01     ` Eli Zaretskii
@ 2019-12-16 17:15       ` Andreas Schwab
  2019-12-16 17:44         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2019-12-16 17:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs, emacs-devel

On Dez 16 2019, Eli Zaretskii wrote:

>> From: Andreas Schwab <schwab@suse.de>
>> Cc: emacs-devel@gnu.org, Alexander Shukaev <emacs@Alexander.Shukaev.name>
>> Date: Mon, 16 Dec 2019 17:02:56 +0100
>> 
>> On Dez 16 2019, Eli Zaretskii wrote:
>> 
>> > tty-erase-char is a global variable, so it is not per terminal.
>> >
>> > But I don't think I understand what you mean by "frame refers to a different value" in this context.  What do you think Emacs does with the value of this variable, that you need to be specific to a frame?
>> 
>> Currently, tty-erase-char is set to the ERASE character of the last
>> opened terminal.  Since normal-erase-is-backspace-setup-frame is
>> normally only called once when the frame is created, this happens to
>> work out right.
>
> tty-erase-char is also set whenever init_sys_modes is called, and
> many/most of its callers are generally supposed to be called for the
> controlling terminal only.  If one of those callers is actually
> called, tty-erase-char will be reset to the ERASE character of the
> controlling terminal, AFAIU.

Emacs can have multiple controlling terminals, if there are multiple
terminals.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16 17:15       ` Andreas Schwab
@ 2019-12-16 17:44         ` Eli Zaretskii
  2019-12-16 18:17           ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2019-12-16 17:44 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs, emacs-devel

> From: Andreas Schwab <schwab@suse.de>
> Cc: emacs-devel@gnu.org,  emacs@Alexander.Shukaev.name
> Date: Mon, 16 Dec 2019 18:15:13 +0100
> 
> >> Currently, tty-erase-char is set to the ERASE character of the last
> >> opened terminal.  Since normal-erase-is-backspace-setup-frame is
> >> normally only called once when the frame is created, this happens to
> >> work out right.
> >
> > tty-erase-char is also set whenever init_sys_modes is called, and
> > many/most of its callers are generally supposed to be called for the
> > controlling terminal only.  If one of those callers is actually
> > called, tty-erase-char will be reset to the ERASE character of the
> > controlling terminal, AFAIU.
> 
> Emacs can have multiple controlling terminals, if there are multiple
> terminals.

OK, but still, if one calls, say, set-input-meta-mode, tty-erase-char
will be reset as appropriate for the TERMINAL argument, and that is
not necessarily the last-frame value.



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16 17:44         ` Eli Zaretskii
@ 2019-12-16 18:17           ` Andreas Schwab
  2019-12-16 18:29             ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2019-12-16 18:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs, emacs-devel

On Dez 16 2019, Eli Zaretskii wrote:

> OK, but still, if one calls, say, set-input-meta-mode, tty-erase-char
> will be reset as appropriate for the TERMINAL argument, and that is
> not necessarily the last-frame value.

It is the last-frame value when a frame was just created on a new
terminal, which is why normal-erase-is-backspace-setup-frame works by
chance.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16 18:17           ` Andreas Schwab
@ 2019-12-16 18:29             ` Eli Zaretskii
  2019-12-16 19:19               ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2019-12-16 18:29 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs, emacs-devel

> From: Andreas Schwab <schwab@suse.de>
> Cc: emacs@Alexander.Shukaev.name,  emacs-devel@gnu.org
> Date: Mon, 16 Dec 2019 19:17:23 +0100
> 
> On Dez 16 2019, Eli Zaretskii wrote:
> 
> > OK, but still, if one calls, say, set-input-meta-mode, tty-erase-char
> > will be reset as appropriate for the TERMINAL argument, and that is
> > not necessarily the last-frame value.
> 
> It is the last-frame value when a frame was just created on a new
> terminal, which is why normal-erase-is-backspace-setup-frame works by
> chance.

I agree, but the "by chance" part worries me.  This whole business
looks quite fragile.



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

* Re: Daemon/Client, Multiple Terminals, and `tty-erase-char'
  2019-12-16 18:29             ` Eli Zaretskii
@ 2019-12-16 19:19               ` Andreas Schwab
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Schwab @ 2019-12-16 19:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs, emacs-devel

On Dez 16 2019, Eli Zaretskii wrote:

>> From: Andreas Schwab <schwab@suse.de>
>> Cc: emacs@Alexander.Shukaev.name,  emacs-devel@gnu.org
>> Date: Mon, 16 Dec 2019 19:17:23 +0100
>> 
>> On Dez 16 2019, Eli Zaretskii wrote:
>> 
>> > OK, but still, if one calls, say, set-input-meta-mode, tty-erase-char
>> > will be reset as appropriate for the TERMINAL argument, and that is
>> > not necessarily the last-frame value.
>> 
>> It is the last-frame value when a frame was just created on a new
>> terminal, which is why normal-erase-is-backspace-setup-frame works by
>> chance.
>
> I agree, but the "by chance" part worries me.  This whole business
> looks quite fragile.

tty-erase-char should really be a function with a terminal parameter.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

end of thread, other threads:[~2019-12-16 19:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16  4:00 Daemon/Client, Multiple Terminals, and `tty-erase-char' Alexander Shukaev
2019-12-16  5:19 ` Eli Zaretskii
2019-12-16  5:57   ` Alexander Shukaev
2019-12-16 15:30     ` Eli Zaretskii
2019-12-16 15:51       ` Alexander Shukaev
2019-12-16 16:02   ` Andreas Schwab
2019-12-16 16:36     ` Alexander Shukaev
2019-12-16 17:01     ` Eli Zaretskii
2019-12-16 17:15       ` Andreas Schwab
2019-12-16 17:44         ` Eli Zaretskii
2019-12-16 18:17           ` Andreas Schwab
2019-12-16 18:29             ` Eli Zaretskii
2019-12-16 19:19               ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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