all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* vterm and Meta?
@ 2023-08-01 11:55 hw
  2023-08-01 12:12 ` Thibaut Verron
  2023-08-01 19:01 ` Akib Azmain Turja
  0 siblings, 2 replies; 36+ messages in thread
From: hw @ 2023-08-01 11:55 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I'm trying out vterm and it turns out that I can't use the ESC key
when within a vterm buffer: i. e. I don't have the meta key anymore
because that gets sent to the terminal rather than emacs.

According to [1], I could maybe remove the ESC key from vterm-mode-map
--- but it seems desirable to be able to use the ESC key for programs
that might run in vterm.

How do you deal with this?  Do you use another key for the meta key
other programs are less likely to make use of than the ESC key?


[1]: https://github.com/akermu/emacs-libvterm#shell-side-configuration




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

* Re: vterm and Meta?
  2023-08-01 11:55 vterm and Meta? hw
@ 2023-08-01 12:12 ` Thibaut Verron
  2023-08-01 14:21   ` hw
  2023-08-01 19:01 ` Akib Azmain Turja
  1 sibling, 1 reply; 36+ messages in thread
From: Thibaut Verron @ 2023-08-01 12:12 UTC (permalink / raw)
  To: hw, help-gnu-emacs

Hi,

Are you using emacs in a terminal?

If not, Meta is usually bound to a modifier key (afaik by default the 
one immediately left of the space bar, e.g. alt on PC keyboards), and 
that works in vterm.

If you don't usually run programs using the Esc key in vterm, you can 
unbind it and send it with vterm-send-next-key when necessary.

Best wishes,

Thibaut

On 01/08/2023 13:55, hw wrote:
> Hi,
>
> I'm trying out vterm and it turns out that I can't use the ESC key
> when within a vterm buffer: i. e. I don't have the meta key anymore
> because that gets sent to the terminal rather than emacs.
>
> According to [1], I could maybe remove the ESC key from vterm-mode-map
> --- but it seems desirable to be able to use the ESC key for programs
> that might run in vterm.
>
> How do you deal with this?  Do you use another key for the meta key
> other programs are less likely to make use of than the ESC key?
>
>
> [1]: https://github.com/akermu/emacs-libvterm#shell-side-configuration
>
>



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

* Re: vterm and Meta?
  2023-08-01 12:12 ` Thibaut Verron
@ 2023-08-01 14:21   ` hw
  2023-08-01 14:40     ` how to configure Meta key with wayland (was: vterm and Meta?) hw
                       ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: hw @ 2023-08-01 14:21 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 2023-08-01 at 14:12 +0200, Thibaut Verron wrote:
> Hi,
> 
> Are you using emacs in a terminal?

sometimes

> If not, Meta is usually bound to a modifier key (afaik by default the 
> one immediately left of the space bar, e.g. alt on PC keyboards), and 
> that works in vterm.

Uhm, I've been using emacs for over 30 years and in all these years,
the ESC key was always used for a meta key across all instances by
default.  It's the same when running emacs in a terminal, as an X11
client or with wayland.

The key left of the space bar has always been the Alt key on all PC
keyboards I've used so far.  Pressing, for example, Alt-x, inserts x
into the buffer (like into this buffer I'm writing this reply in, and
into the vterm buffer).

How is it that it's different for you?

> If you don't usually run programs using the Esc key in vterm, you can 
> unbind it and send it with vterm-send-next-key when necessary.

Hm, true, I can try that.  It's not like I need the ESC key too often
in a terminal.  Somehow I didn't think of that, thank you :)

But then, maybe it makes sense to reconfigure things to use the Alt
key instead of ESC?  Apparently Alt doesn't do anything now and may be
less awkward to type.  Hmm ...




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

* how to configure Meta key with wayland (was: vterm and Meta?)
  2023-08-01 14:21   ` hw
@ 2023-08-01 14:40     ` hw
  2023-08-01 15:05     ` vterm and Meta? Spencer Baugh
  2023-08-01 15:09     ` Thibaut Verron
  2 siblings, 0 replies; 36+ messages in thread
From: hw @ 2023-08-01 14:40 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 2023-08-01 at 16:21 +0200, hw wrote:
>
> But then, maybe it makes sense to reconfigure things to use the Alt
> key instead of ESC?  Apparently Alt doesn't do anything now and may be
> less awkward to type.  Hmm ...

Ok, how would I configure this?  I couldn't find anything useful when
searching for like 'emacs change meta key wayland'.

When I look at the keyboard display in gnome, it shows Meta L and Meta
R on the left and right Alt keys, respectively.  Why is emacs not using
the apparently available Meta key(s) and uses ESC instead?




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

* Re: vterm and Meta?
  2023-08-01 14:21   ` hw
  2023-08-01 14:40     ` how to configure Meta key with wayland (was: vterm and Meta?) hw
@ 2023-08-01 15:05     ` Spencer Baugh
  2023-08-01 16:36       ` hw
  2023-08-01 15:09     ` Thibaut Verron
  2 siblings, 1 reply; 36+ messages in thread
From: Spencer Baugh @ 2023-08-01 15:05 UTC (permalink / raw)
  To: help-gnu-emacs

hw <hw@adminart.net> writes:
> On Tue, 2023-08-01 at 14:12 +0200, Thibaut Verron wrote:
>> Hi,
>> 
>> Are you using emacs in a terminal?
>
> sometimes
>
>> If not, Meta is usually bound to a modifier key (afaik by default the 
>> one immediately left of the space bar, e.g. alt on PC keyboards), and 
>> that works in vterm.
>
> Uhm, I've been using emacs for over 30 years and in all these years,
> the ESC key was always used for a meta key across all instances by
> default.  It's the same when running emacs in a terminal, as an X11
> client or with wayland.
>
> The key left of the space bar has always been the Alt key on all PC
> keyboards I've used so far.  Pressing, for example, Alt-x, inserts x
> into the buffer (like into this buffer I'm writing this reply in, and
> into the vterm buffer).
>
> How is it that it's different for you?
>
>> If you don't usually run programs using the Esc key in vterm, you can 
>> unbind it and send it with vterm-send-next-key when necessary.
>
> Hm, true, I can try that.  It's not like I need the ESC key too often
> in a terminal.  Somehow I didn't think of that, thank you :)
>
> But then, maybe it makes sense to reconfigure things to use the Alt
> key instead of ESC?  Apparently Alt doesn't do anything now and may be
> less awkward to type.  Hmm ...

It's possible to separate these in graphical frames.  I think you could

(define-key local-function-key-map (kbd "<escape>") nil)

to make <escape> no longer map to ESC.  Then you can remove the ESC
binding in vterm and add an <escape> binding.  Then Meta bindings and
<escape> will be separate.

(I know this because I figured it out for some evil-mode users and wrote
it up here: https://github.com/emacs-evil/evil/issues/1780 )




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

* Re: vterm and Meta?
  2023-08-01 14:21   ` hw
  2023-08-01 14:40     ` how to configure Meta key with wayland (was: vterm and Meta?) hw
  2023-08-01 15:05     ` vterm and Meta? Spencer Baugh
@ 2023-08-01 15:09     ` Thibaut Verron
  2023-08-01 16:25       ` hw
  2 siblings, 1 reply; 36+ messages in thread
From: Thibaut Verron @ 2023-08-01 15:09 UTC (permalink / raw)
  To: hw, help-gnu-emacs

On 01/08/2023 16:21, hw wrote:
>
>> If not, Meta is usually bound to a modifier key (afaik by default the
>> one immediately left of the space bar, e.g. alt on PC keyboards), and
>> that works in vterm.
> Uhm, I've been using emacs for over 30 years and in all these years,
> the ESC key was always used for a meta key across all instances by
> default.  It's the same when running emacs in a terminal, as an X11
> client or with wayland.

Yes, that is still the case. Alt is bound to Meta (as a modifier) on GUI 
clients, and so is Esc (as a prefix).

> The key left of the space bar has always been the Alt key on all PC
> keyboards I've used so far.  Pressing, for example, Alt-x, inserts x
> into the buffer (like into this buffer I'm writing this reply in, and
> into the vterm buffer).
>
> How is it that it's different for you?

I have no idea! It should be the default behavior, at least for GUI 
Emacs: Meta (the emacs modifier) is bound to Alt (the modifier key), and 
Alt is free to bind to another modifier. I would guess that either your 
keyboard has an unconventional mapping, or your Emacs has an 
unconventional setting.

How is it with emacs -q?

What key does C-h k Alt-x look up for you? M-x, A-x, or x?

Best wishes,

Thibaut

PS. I just tried it in a terminal and it also works there, I was not 
expecting it. But it might depend on the capabilities of your terminal 
emulator.




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

* Re: vterm and Meta?
  2023-08-01 15:09     ` Thibaut Verron
@ 2023-08-01 16:25       ` hw
  2023-08-01 19:54         ` Thibaut Verron
  0 siblings, 1 reply; 36+ messages in thread
From: hw @ 2023-08-01 16:25 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 2023-08-01 at 17:09 +0200, Thibaut Verron wrote:
> On 01/08/2023 16:21, hw wrote:
> > 
> > > If not, Meta is usually bound to a modifier key (afaik by default the
> > > one immediately left of the space bar, e.g. alt on PC keyboards), and
> > > that works in vterm.
> > Uhm, I've been using emacs for over 30 years and in all these years,
> > the ESC key was always used for a meta key across all instances by
> > default.  It's the same when running emacs in a terminal, as an X11
> > client or with wayland.
> 
> Yes, that is still the case. Alt is bound to Meta (as a modifier) on GUI 
> clients, and so is Esc (as a prefix).

Alt doesn't really do much.

> > The key left of the space bar has always been the Alt key on all PC
> > keyboards I've used so far.  Pressing, for example, Alt-x, inserts x
> > into the buffer (like into this buffer I'm writing this reply in, and
> > into the vterm buffer).
> > 
> > How is it that it's different for you?
> 
> I have no idea! It should be the default behavior, at least for GUI 
> Emacs: Meta (the emacs modifier) is bound to Alt (the modifier key), and 
> Alt is free to bind to another modifier. I would guess that either your 
> keyboard has an unconventional mapping, or your Emacs has an 
> unconventional setting.

I have used quite a few different keyboards over the decades, so
that's probably not it.

> How is it with emacs -q?
> 
> What key does C-h k Alt-x look up for you? M-x, A-x, or x?

It looks up x: "runs the command self-insert-command (found in
global-map), which is an interactive built-in function in ‘C source
code’ ..."

It used to be possible to do stuff with key bindings through xmodmap.
I haven't been able to do anything like that with wayland.

> 
> Best wishes,
> 
> Thibaut
> 
> PS. I just tried it in a terminal and it also works there, I was not 
> expecting it. But it might depend on the capabilities of your terminal 
> emulator.

Alt or ESC, or both?




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

* Re: vterm and Meta?
  2023-08-01 15:05     ` vterm and Meta? Spencer Baugh
@ 2023-08-01 16:36       ` hw
  2023-08-03 19:56         ` Spencer Baugh
  0 siblings, 1 reply; 36+ messages in thread
From: hw @ 2023-08-01 16:36 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 2023-08-01 at 11:05 -0400, Spencer Baugh wrote:
> hw <hw@adminart.net> writes:
> > On Tue, 2023-08-01 at 14:12 +0200, Thibaut Verron wrote:
> > > Hi,
> > > 
> > > Are you using emacs in a terminal?
> > 
> > sometimes
> > 
> > > If not, Meta is usually bound to a modifier key (afaik by default the 
> > > one immediately left of the space bar, e.g. alt on PC keyboards), and 
> > > that works in vterm.
> > 
> > Uhm, I've been using emacs for over 30 years and in all these years,
> > the ESC key was always used for a meta key across all instances by
> > default.  It's the same when running emacs in a terminal, as an X11
> > client or with wayland.
> > 
> > The key left of the space bar has always been the Alt key on all PC
> > keyboards I've used so far.  Pressing, for example, Alt-x, inserts x
> > into the buffer (like into this buffer I'm writing this reply in, and
> > into the vterm buffer).
> > 
> > How is it that it's different for you?
> > 
> > > If you don't usually run programs using the Esc key in vterm, you can 
> > > unbind it and send it with vterm-send-next-key when necessary.
> > 
> > Hm, true, I can try that.  It's not like I need the ESC key too often
> > in a terminal.  Somehow I didn't think of that, thank you :)
> > 
> > But then, maybe it makes sense to reconfigure things to use the Alt
> > key instead of ESC?  Apparently Alt doesn't do anything now and may be
> > less awkward to type.  Hmm ...
> 
> It's possible to separate these in graphical frames.  I think you could
> 
> (define-key local-function-key-map (kbd "<escape>") nil)
> 
> to make <escape> no longer map to ESC.  Then you can remove the ESC
> binding in vterm and add an <escape> binding.  Then Meta bindings and
> <escape> will be separate.
> 
> (I know this because I figured it out for some evil-mode users and wrote
> it up here: https://github.com/emacs-evil/evil/issues/1780 )

Cool, only when I disable the only Meta key I have, I won't have a
Meta key at all, would I?  I'd have to somehow configure some of the
Alt keys as Meta first.




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

* Re: vterm and Meta?
  2023-08-01 11:55 vterm and Meta? hw
  2023-08-01 12:12 ` Thibaut Verron
@ 2023-08-01 19:01 ` Akib Azmain Turja
  2023-08-02  0:45   ` hw
  1 sibling, 1 reply; 36+ messages in thread
From: Akib Azmain Turja @ 2023-08-01 19:01 UTC (permalink / raw)
  To: hw; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

hw <hw@adminart.net> writes:

> Hi,
>
> I'm trying out vterm and it turns out that I can't use the ESC key
> when within a vterm buffer: i. e. I don't have the meta key anymore
> because that gets sent to the terminal rather than emacs.
>
> According to [1], I could maybe remove the ESC key from vterm-mode-map
> --- but it seems desirable to be able to use the ESC key for programs
> that might run in vterm.
>
> How do you deal with this?  Do you use another key for the meta key
> other programs are less likely to make use of than the ESC key?
>
>
> [1]: https://github.com/akermu/emacs-libvterm#shell-side-configuration
>
>

I use Eat BTW.  Eat doesn't bind 'ESC', instead it binds 'ESC ESC' to
send ESC.  This allows me to send meta-keys.  When I need to send ESC, I
just press ESC twice.

I believe this can be done in Vterm too.

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: vterm and Meta?
  2023-08-01 16:25       ` hw
@ 2023-08-01 19:54         ` Thibaut Verron
  2023-08-02  0:39           ` hw
  0 siblings, 1 reply; 36+ messages in thread
From: Thibaut Verron @ 2023-08-01 19:54 UTC (permalink / raw)
  To: help-gnu-emacs, hw

> It looks up x: "runs the command self-insert-command (found in
> global-map), which is an interactive built-in function in ‘C source
> code’ ..."

Even with emacs -q?

Are you perhaps trying to use Meta like you use Esc, releasing Alt before you press x ?

> Alt or ESC, or both?

Both, but I'm only surprised about Alt, Esc should always work.

On Tue Aug 1, 2023, 04:25 PM GMT, hw <mailto:hw@adminart.net> wrote:
> On Tue, 2023-08-01 at 17:09 +0200, Thibaut Verron wrote:
>> On 01/08/2023 16:21, hw wrote:
>> >
>> > > If not, Meta is usually bound to a modifier key (afaik by default the
>> > > one immediately left of the space bar, e.g. alt on PC keyboards), and
>> > > that works in vterm.
>> > Uhm, I've been using emacs for over 30 years and in all these years,
>> > the ESC key was always used for a meta key across all instances by
>> > default. It's the same when running emacs in a terminal, as an X11
>> > client or with wayland.
>>
>> Yes, that is still the case. Alt is bound to Meta (as a modifier) on GUI
>> clients, and so is Esc (as a prefix).
>
> Alt doesn't really do much.
>> > The key left of the space bar has always been the Alt key on all PC
>> > keyboards I've used so far. Pressing, for example, Alt-x, inserts x
>> > into the buffer (like into this buffer I'm writing this reply in, and
>> > into the vterm buffer).
>> >
>> > How is it that it's different for you?
>>
>> I have no idea! It should be the default behavior, at least for GUI
>> Emacs: Meta (the emacs modifier) is bound to Alt (the modifier key), and
>> Alt is free to bind to another modifier. I would guess that either your
>> keyboard has an unconventional mapping, or your Emacs has an
>> unconventional setting.
>
> I have used quite a few different keyboards over the decades, so
> that's probably not it.
>> How is it with emacs -q?
>>
>> What key does C-h k Alt-x look up for you? M-x, A-x, or x?
>
> It looks up x: "runs the command self-insert-command (found in
> global-map), which is an interactive built-in function in ‘C source
> code’ ..."
>
> It used to be possible to do stuff with key bindings through xmodmap.
> I haven't been able to do anything like that with wayland.
>>
>> Best wishes,
>>
>> Thibaut
>>
>> PS. I just tried it in a terminal and it also works there, I was not
>> expecting it. But it might depend on the capabilities of your terminal
>> emulator.
>
> Alt or ESC, or both?
>
>


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

* Re: vterm and Meta?
  2023-08-01 19:54         ` Thibaut Verron
@ 2023-08-02  0:39           ` hw
  2023-08-02  7:54             ` Thibaut Verron
  0 siblings, 1 reply; 36+ messages in thread
From: hw @ 2023-08-02  0:39 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 2023-08-01 at 19:54 +0000, Thibaut Verron wrote:
> > It looks up x: "runs the command self-insert-command (found in
> > global-map), which is an interactive built-in function in ‘C source
> > code’ ..."
> 
> Even with emacs -q?

With -Q ... with -q, it says "x is undefined" in the message buffer.

> Are you perhaps trying to use Meta like you use Esc, releasing Alt before you press x ?

No, I'm pressing Alt-x without letting off of Alt.  Not having to let
off like with ESC makes it seem so interesting to be able to use Alt
instead of ESC for Meta.

> > Alt or ESC, or both?
> 
> Both, but I'm only surprised about Alt, Esc should always work.

emacs -q -nw in gnome terminal also says "x is undefined".




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

* Re: vterm and Meta?
  2023-08-01 19:01 ` Akib Azmain Turja
@ 2023-08-02  0:45   ` hw
  2023-08-02  9:02     ` Akib Azmain Turja
  0 siblings, 1 reply; 36+ messages in thread
From: hw @ 2023-08-02  0:45 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 2023-08-02 at 01:01 +0600, Akib Azmain Turja wrote:
> hw <hw@adminart.net> writes:
> 
> > Hi,
> > 
> > I'm trying out vterm and it turns out that I can't use the ESC key
> > when within a vterm buffer: i. e. I don't have the meta key anymore
> > because that gets sent to the terminal rather than emacs.
> > 
> > According to [1], I could maybe remove the ESC key from vterm-mode-map
> > --- but it seems desirable to be able to use the ESC key for programs
> > that might run in vterm.
> > 
> > How do you deal with this?  Do you use another key for the meta key
> > other programs are less likely to make use of than the ESC key?
> > 
> > 
> > [1]: https://github.com/akermu/emacs-libvterm#shell-side-configuration
> > 
> > 
> 
> I use Eat BTW.

Eat?  Is that another terminal for emacs?

> Eat doesn't bind 'ESC', instead it binds 'ESC ESC' to
> send ESC.  This allows me to send meta-keys.  When I need to send ESC, I
> just press ESC twice.

So do you also need to use ESC as Meta key?

> I believe this can be done in Vterm too.

Perhaps it can ...  It would be easier if I could use Alt instead of
ESC for Meta.  How could I do that?





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

* Re: vterm and Meta?
  2023-08-02  0:39           ` hw
@ 2023-08-02  7:54             ` Thibaut Verron
  2023-08-02 14:21               ` hw
  0 siblings, 1 reply; 36+ messages in thread
From: Thibaut Verron @ 2023-08-02  7:54 UTC (permalink / raw)
  To: help-gnu-emacs, hw

> With -Q ... with -q, it says "x is undefined" in the message buffer.
That is... extremely strange.

What about C-h k x ?

What is your operating system, emacs version, etc?

Does the alt key on your keyboard work in other programs?
If you are on X, can you use xev to confirm that it sends the correct keycode?

On Wed Aug 2, 2023, 12:39 AM GMT, hw <mailto:hw@adminart.net> wrote:
> On Tue, 2023-08-01 at 19:54 +0000, Thibaut Verron wrote:
>> > It looks up x: "runs the command self-insert-command (found in
>> > global-map), which is an interactive built-in function in ‘C source
>> > code’ ..."
>>
>> Even with emacs -q?
>
> With -Q ... with -q, it says "x is undefined" in the message buffer.
>> Are you perhaps trying to use Meta like you use Esc, releasing Alt before you press x ?
>
> No, I'm pressing Alt-x without letting off of Alt. Not having to let
> off like with ESC makes it seem so interesting to be able to use Alt
> instead of ESC for Meta.
>> > Alt or ESC, or both?
>>
>> Both, but I'm only surprised about Alt, Esc should always work.
>
> emacs -q -nw in gnome terminal also says "x is undefined".
>
>


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

* Re: vterm and Meta?
  2023-08-02  0:45   ` hw
@ 2023-08-02  9:02     ` Akib Azmain Turja
  2023-08-02 18:01       ` Emanuel Berg
  2023-08-03 14:15       ` hw
  0 siblings, 2 replies; 36+ messages in thread
From: Akib Azmain Turja @ 2023-08-02  9:02 UTC (permalink / raw)
  To: hw; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]

hw <hw@adminart.net> writes:

> On Wed, 2023-08-02 at 01:01 +0600, Akib Azmain Turja wrote:
>> hw <hw@adminart.net> writes:
>> 
>> > Hi,
>> > 
>> > I'm trying out vterm and it turns out that I can't use the ESC key
>> > when within a vterm buffer: i. e. I don't have the meta key anymore
>> > because that gets sent to the terminal rather than emacs.
>> > 
>> > According to [1], I could maybe remove the ESC key from vterm-mode-map
>> > --- but it seems desirable to be able to use the ESC key for programs
>> > that might run in vterm.
>> > 
>> > How do you deal with this?  Do you use another key for the meta key
>> > other programs are less likely to make use of than the ESC key?
>> > 
>> > 
>> > [1]: https://github.com/akermu/emacs-libvterm#shell-side-configuration
>> > 
>> > 
>> 
>> I use Eat BTW.
>
> Eat?  Is that another terminal for emacs?

Yes.  https://codeberg.org/akib/emacs-eat  :D
Disclaimer:  I'm the author.  ;)

>
>> Eat doesn't bind 'ESC', instead it binds 'ESC ESC' to
>> send ESC.  This allows me to send meta-keys.  When I need to send ESC, I
>> just press ESC twice.
>
> So do you also need to use ESC as Meta key?

I usually use Alt as Meta key, but I can also use ESC as the meta
(though I hardly do that, Alt is easier for me).

>> I believe this can be done in Vterm too.
>
> Perhaps it can ...  It would be easier if I could use Alt instead of
> ESC for Meta.  How could I do that?

VTerm is a nice terminal emulator, but it's key bindings are kinda
messed up IMHO.  You need to fix it yourself.  It isn't tough, but I
forgot exactly how to do it.

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: vterm and Meta?
  2023-08-02  7:54             ` Thibaut Verron
@ 2023-08-02 14:21               ` hw
  2023-08-02 14:29                 ` hw
  2023-08-02 15:05                 ` Thibaut Verron
  0 siblings, 2 replies; 36+ messages in thread
From: hw @ 2023-08-02 14:21 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 2023-08-02 at 07:54 +0000, Thibaut Verron wrote:
> > With -Q ... with -q, it says "x is undefined" in the message buffer.
> That is... extremely strange.

What do you expect to happen?

> What about C-h k x ?

emacs -Q: x runs the command self-insert-command
emacs -q: x is undefined

> What is your operating system, emacs version, etc?

Fedora Workstation 38


# emacs --version
GNU Emacs 30.0.50
Development version 19777b7c864f on master branch; build date 2023-07-30.


I compiled it the other day following [1] because I wanted a version
that works with wayland.  So far, it works fine :)


[1]: https://github.com/NapoleonWils0n/cerberus/blob/master/fedora/emacs-build-fedora.org

> Does the alt key on your keyboard work in other programs?

Yes, when I look at the display of the keyobard layout in gnome that
you can display through Settings, it shows the Alt key pressed.

Now I tried Libreoffice calc and it doesn't seem to work as
expected. When I press Ctrl+Alt+C, using the *left* Alt key, it looks
as if the cell was copied.  Using the *right* Alt key for Ctrl+Alt+C
brings up a yellowish window which is probably what should happen
because Ctrl+Alt+C is supposed to insert a comment.

Oh, interestingly, pressing Alt-x in Emacs does work when I use the
*right* Alt key!  That's something new!

> If you are on X, can you use xev to confirm that it sends the correct keycode?

I could switch back to see what it sends, but since I want to use
wayland, there isn't much point ...

When I start xev in vterm in emacs in wayland, it says


KeyPress event, serial 38, synthetic NO, window 0xe00001,
    root 0x378, subw 0x0, time 44020369, (3073,685), root:(3123,812),
    state 0x10, keycode 64 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0xe00001,
    root 0x378, subw 0x0, time 44020562, (3073,685), root:(3123,812),
    state 0x90, keycode 64 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False


for *left* Alt and


KeyPress event, serial 38, synthetic NO, window 0xe00001,
    root 0x378, subw 0x0, time 44174354, (159,-25), root:(209,102),
    state 0x10, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0xe00001,
    root 0x378, subw 0x0, time 44174482, (159,-25), root:(209,102),
    state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False


for *right* Alt.  I guess it should say Alt_L for *left* Alt.

So at least that's interesting --- but how do I get the left Alt key
to work right?

I haven't been able to find out how to change keyboard layouts with
wayland.  There must be some place where they are defined because
there is many premade keyboard layouts I can pick from for all kinds
of different languages.




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

* Re: vterm and Meta?
  2023-08-02 14:21               ` hw
@ 2023-08-02 14:29                 ` hw
  2023-08-02 15:10                   ` Yuri Khan
  2023-08-02 15:05                 ` Thibaut Verron
  1 sibling, 1 reply; 36+ messages in thread
From: hw @ 2023-08-02 14:29 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 2023-08-02 at 16:21 +0200, hw wrote:
> 
> So at least that's interesting --- but how do I get the left Alt key
> to work right?

This seems to be one of these stupid gnome issues.  In gnome, there is
Settings-->Keyboard-->Alternate Characters Key, and the key you pick
there gets disabled :(

How do I turn this off?  I don't need this and it gets in the way.




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

* Re: vterm and Meta?
  2023-08-02 14:21               ` hw
  2023-08-02 14:29                 ` hw
@ 2023-08-02 15:05                 ` Thibaut Verron
  2023-08-03 13:50                   ` hw
  1 sibling, 1 reply; 36+ messages in thread
From: Thibaut Verron @ 2023-08-02 15:05 UTC (permalink / raw)
  To: hw, help-gnu-emacs

On 02/08/2023 16:21, hw wrote:
> On Wed, 2023-08-02 at 07:54 +0000, Thibaut Verron wrote:
>>> With -Q ... with -q, it says "x is undefined" in the message buffer.
>> That is... extremely strange.
> What do you expect to happen?

It's one thing that Alt-x is translated as x, but I don't get x why x 
isn't mapped to self-insert-command.

Not really relevant to your problem, just curious.

>> What about C-h k x ?
> emacs -Q: x runs the command self-insert-command
> emacs -q: x is undefined
>> If you are on X, can you use xev to confirm that it sends the correct keycode?
> I could switch back to see what it sends, but since I want to use
> wayland, there isn't much point ...

It is just that xev is a X utility, I didn't expect it to work at all on 
wayland.

It would still be nice to know if it is the same on X (then the problem 
is with your general configuration) or not (then the problem is with 
wayland), but already your results give a lot of information.


> When I start xev in vterm in emacs in wayland, it says

> KeyPress event, serial 38, synthetic NO, window 0xe00001,
>      root 0x378, subw 0x0, time 44020369, (3073,685), root:(3123,812),
>      state 0x10, keycode 64 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
>      XLookupString gives 0 bytes:
>      XmbLookupString gives 0 bytes:
>      XFilterEvent returns: False
>
> KeyRelease event, serial 38, synthetic NO, window 0xe00001,
>      root 0x378, subw 0x0, time 44020562, (3073,685), root:(3123,812),
>      state 0x90, keycode 64 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
>      XLookupString gives 0 bytes:
>      XFilterEvent returns: False

Assuming that xev works fine with wayland, yes that doesn't seem right.


> for *left* Alt and
>
>
> KeyPress event, serial 38, synthetic NO, window 0xe00001,
>      root 0x378, subw 0x0, time 44174354, (159,-25), root:(209,102),
>      state 0x10, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
>      XLookupString gives 0 bytes:
>      XmbLookupString gives 0 bytes:
>      XFilterEvent returns: False
>
> KeyRelease event, serial 38, synthetic NO, window 0xe00001,
>      root 0x378, subw 0x0, time 44174482, (159,-25), root:(209,102),
>      state 0x18, keycode 108 (keysym 0xffea, Alt_R), same_screen YES,
>      XLookupString gives 0 bytes:
>      XFilterEvent returns: False
>
>
> for *right* Alt.  I guess it should say Alt_L for *left* Alt.

So that confirms that your right alt should work as meta.


> So at least that's interesting --- but how do I get the left Alt key
> to work right?
>
> I haven't been able to find out how to change keyboard layouts with
> wayland.  There must be some place where they are defined because
> there is many premade keyboard layouts I can pick from for all kinds
> of different languages.
>
> This seems to be one of these stupid gnome issues.  In gnome, there is
> Settings-->Keyboard-->Alternate Characters Key, and the key you pick
> there gets disabled 🙁
>
> How do I turn this off?  I don't need this and it gets in the way.

Unfortunately I use neither gnome nor wayland. On X, regardless of the 
DE I'd use setxkbmap to get my keyboard exactly as I want it, is there 
something like that on wayland?

Otherwise, perhaps selecting a keyboard layout without 3rd level 
characters would do the trick -- but you already said you don't know how 
to change keyboard layouts.

If one alt/meta is enough for you, you could also just set this key to 
be right alt and then left alt should work fine.


Best wishes,

Thibaut




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

* Re: vterm and Meta?
  2023-08-02 14:29                 ` hw
@ 2023-08-02 15:10                   ` Yuri Khan
  2023-08-03 14:02                     ` hw
  2023-08-03 19:46                     ` tpeplt
  0 siblings, 2 replies; 36+ messages in thread
From: Yuri Khan @ 2023-08-02 15:10 UTC (permalink / raw)
  To: hw; +Cc: help-gnu-emacs

On Wed, 2 Aug 2023 at 21:30, hw <hw@adminart.net> wrote:

> This seems to be one of these stupid gnome issues.  In gnome, there is
> Settings-->Keyboard-->Alternate Characters Key, and the key you pick
> there gets disabled :(

Indeed. See merge request
<https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/910>
and several bug reports linked from there.

> How do I turn this off?  I don't need this and it gets in the way.

(a) sacrifice a less important key (maybe right Alt or right Super)
(b) wait for a future release of GNOME in which that MR will be merged
(c) migrate to Ubuntu which applies that MR as a distro patch
(d) migrate off GNOME to a compositor that gives you direct control
over xkb options
(e) use Gnome Tweaks to disable that option and avoid the Settings →
Keyboard panel



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

* Re: vterm and Meta?
  2023-08-02  9:02     ` Akib Azmain Turja
@ 2023-08-02 18:01       ` Emanuel Berg
  2023-08-03 14:15       ` hw
  1 sibling, 0 replies; 36+ messages in thread
From: Emanuel Berg @ 2023-08-02 18:01 UTC (permalink / raw)
  To: help-gnu-emacs

Akib Azmain Turja wrote:

> VTerm is a nice terminal emulator

Yeah, fast!

> but it's key bindings are kinda messed up IMHO

That was my experience as well, well, not messed up
necessarily, I'm sure they made sense to the person who set
them up ...

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: vterm and Meta?
  2023-08-02 15:05                 ` Thibaut Verron
@ 2023-08-03 13:50                   ` hw
  0 siblings, 0 replies; 36+ messages in thread
From: hw @ 2023-08-03 13:50 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 2023-08-02 at 17:05 +0200, Thibaut Verron wrote:
> On 02/08/2023 16:21, hw wrote:
> > On Wed, 2023-08-02 at 07:54 +0000, Thibaut Verron wrote:
> > > > With -Q ... with -q, it says "x is undefined" in the message buffer.
> > > That is... extremely strange.
> > What do you expect to happen?
> 
> It's one thing that Alt-x is translated as x, but I don't get x why x 
> isn't mapped to self-insert-command.
> 
> Not really relevant to your problem, just curious.

Apparently the splash-screen doesn't have x defined.  I tried this
under X11 with Fedoras emacs; the version I compiled doesn't like to
run under X11:


/usr/bin/emacs --version
GNU Emacs 28.2

in the splash screen:
GNU Emacs 28.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8)
 of 2023-06-05

with the so-called Alternate Characters Key set to Right Super: 
Left-Alt works as Meta

/usr/bin/emacs -q

in the splash screen:
C-h k Alt-x: M-x runs the command execute-extended-command
C-h k x: x is undefined
C-h k l: l is undefined
C-h k x: q runs the command exit-splash-screen

in the *scratch* buffer:
C-h k x: x runs the command self-insert-command
C-h k q: q runs the command self-insert-command
C-h k l: l runs the command self-insert-command


/usr/bin/emacs -Q
doesn't show the splash screen

in the *scratch* buffer:
C-h k Alt-x: M-x runs the command execute-extended-command
C-h k x: x runs the command self-insert-command
C-h k q: q runs the command self-insert-command
C-h k l: l runs the command self-insert-command


with the so-called Alternate Characters Key set to Left Alt:
Left-Alt doesn't work as Meta

/usr/bin/emacs -q

in the splash screen:

C-h k Alt-x: x is undefined
C-h k x: x is undefined
C-h k l: l is undefined
C-h k x: q runs the command exit-splash-screen

in the *scratch* buffer:
C-h k x: x runs the command self-insert-command
C-h k q: q runs the command self-insert-command
C-h k l: l runs the command self-insert-command


/usr/bin/emacs -Q
doesn't show the splash screen

in the *scratch* buffer:
C-h k Alt-x: x runs the command self-insert-command
C-h k x: x runs the command self-insert-command
C-h k q: q runs the command self-insert-command
C-h k l: l runs the command self-insert-command


That seems pretty consistent.

> > > What about C-h k x ?
> > emacs -Q: x runs the command self-insert-command
> > emacs -q: x is undefined
> > > If you are on X, can you use xev to confirm that it sends the correct keycode?
> > I could switch back to see what it sends, but since I want to use
> > wayland, there isn't much point ...
> 
> It is just that xev is a X utility, I didn't expect it to work at all on 
> wayland.

Wayland is pretty cool :)

> It would still be nice to know if it is the same on X (then the problem 
> is with your general configuration) or not (then the problem is with 
> wayland), but already your results give a lot of information.

See above ... The problem is the stupid idea to have a so-called
Alternate Characters Key without an option to turn that off.

I understand the idea that there could be characters that are
unreachable with such a key.  Yet what and which characters those are
would depend on the keyboard layout both in soft- and hardware.

This is very problematic, though: For example, when I use a German
keyboard layout in software, I don't have a right Alt key but AltGr
like I would have with keyboard that has a physical layout like that.
In that case, I would need to pick AltGr as so-called Alternate
Characters Key --- but I can't pick that because the option just isn't
there.

And I don't need it because AltGr is this very key, so again I would
turn it off if I could rather than wasting a precious key for this.
(I don't know what a "Right Super" key is supposed to be, though.
I've never seen a keyboard that has one.)

An why isn't this key called ISO_level_shift3 so it would make sense?
"Alternate Characters Key" doesn't make any sense to anyone.  If we
could just turn it off, I guess everyone would be happy ...

> [...]
> > This seems to be one of these stupid gnome issues.  In gnome, there is
> > Settings-->Keyboard-->Alternate Characters Key, and the key you pick
> > there gets disabled 🙁
> > 
> > How do I turn this off?  I don't need this and it gets in the way.
> 
> Unfortunately I use neither gnome nor wayland. On X, regardless of the 
> DE I'd use setxkbmap to get my keyboard exactly as I want it, is there 
> something like that on wayland?

I couldn't find anything with wayland that would allow one to
configure they keyboard layout.  With gnome and KDE I expect to find
something in the settings that lets us configure every key on the
keyboard we're using to whatever we like, but it's missing.  It was
relatively easy with xkbmap with X11.
 
> Otherwise, perhaps selecting a keyboard layout without 3rd level 
> characters would do the trick -- but you already said you don't know how 
> to change keyboard layouts.

I can only pick from the ones that are predefined, they're in the
settings.  But I can't change the keyboard layout.

It's fine as long as I'm using a keyboard with a physical US layout.
If I were to use a German keyboard it would drive me insane because
there are some keys I need to reconfigure for it to be usable, and I
can't do that with wayland.

> If one alt/meta is enough for you, you could also just set this key to 
> be right alt and then left alt should work fine.

It's a big advantage to me to have both Alt keys working.  When they
came up with the idea of an AltGr key, they should never have omitted
the right Alt key.  (German keyboard layouts are quite
awful. Frequently used keys are difficult to access on
them. Programmers pick keys that are easy to use on their keyboards,
and I'm guessing that 90% or more of them must have US keyboards,
making everthing difficult for everyone else.  I can't blame them,
it's something that doesn't come to mind.  The so-called Alternate
Characters Key is one of these examples, they simply don't get it
because it's entirely outside their experience, and things like that
don't get fixed for many years ...)

Now what wonders me is why the left Alt key never worked before in
emacs.  It hasn't worked for like 30 years and now it finally does.
ESC for meta is not a good replacement.




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

* Re: vterm and Meta?
  2023-08-02 15:10                   ` Yuri Khan
@ 2023-08-03 14:02                     ` hw
  2023-08-03 19:46                     ` tpeplt
  1 sibling, 0 replies; 36+ messages in thread
From: hw @ 2023-08-03 14:02 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 2023-08-02 at 22:10 +0700, Yuri Khan wrote:
> On Wed, 2 Aug 2023 at 21:30, hw <hw@adminart.net> wrote:
> 
> > This seems to be one of these stupid gnome issues.  In gnome, there is
> > Settings-->Keyboard-->Alternate Characters Key, and the key you pick
> > there gets disabled :(
> 
> Indeed. See merge request
> <https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/910>
> and several bug reports linked from there.

Yeah there's bug reports going back 2 years or longer.

> > How do I turn this off?  I don't need this and it gets in the way.
> 
> (a) sacrifice a less important key (maybe right Alt or right Super)

Right Alt is very important; I don't seem to have right Super, so I
set that.

> (b) wait for a future release of GNOME in which that MR will be merged

Haha, when will that be?

> (c) migrate to Ubuntu which applies that MR as a distro patch

Uh no, I'm not touching Ubuntu.

> (d) migrate off GNOME to a compositor that gives you direct control
> over xkb options

Are there any?

> (e) use Gnome Tweaks to disable that option and avoid the Settings →
> Keyboard panel

Fedora gives us only a dumbed-down version of tweaks.  Hmm ... "Key to
choose the 3rd level"?  It has more options than in settings, but
still no option to disable it.  Ah, hm, I can pick none of these
options, maybe that disables it?




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

* Re: vterm and Meta?
  2023-08-02  9:02     ` Akib Azmain Turja
  2023-08-02 18:01       ` Emanuel Berg
@ 2023-08-03 14:15       ` hw
  2023-08-03 18:49         ` Akib Azmain Turja
  1 sibling, 1 reply; 36+ messages in thread
From: hw @ 2023-08-03 14:15 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 2023-08-02 at 15:02 +0600, Akib Azmain Turja wrote:
> hw <hw@adminart.net> writes:
> 
> > On Wed, 2023-08-02 at 01:01 +0600, Akib Azmain Turja wrote:
> > > hw <hw@adminart.net> writes:
> > > 
> > > > Hi,
> > > > 
> > > > I'm trying out vterm and it turns out that I can't use the ESC key
> > > > when within a vterm buffer: i. e. I don't have the meta key anymore
> > > > because that gets sent to the terminal rather than emacs.
> > > > 
> > > > According to [1], I could maybe remove the ESC key from vterm-mode-map
> > > > --- but it seems desirable to be able to use the ESC key for programs
> > > > that might run in vterm.
> > > > 
> > > > How do you deal with this?  Do you use another key for the meta key
> > > > other programs are less likely to make use of than the ESC key?
> > > > 
> > > > 
> > > > [1]: https://github.com/akermu/emacs-libvterm#shell-side-configuration
> > > > 
> > > > 
> > > 
> > > I use Eat BTW.
> > 
> > Eat?  Is that another terminal for emacs?
> 
> Yes.  https://codeberg.org/akib/emacs-eat  :D
> Disclaimer:  I'm the author.  ;)

Cool, it looks interesting :)

I haven't seen vterm flicker, though.  Perhaps it's because I'm
running emacs on wayland?

> > > Eat doesn't bind 'ESC', instead it binds 'ESC ESC' to
> > > send ESC.  This allows me to send meta-keys.  When I need to send ESC, I
> > > just press ESC twice.
> > 
> > So do you also need to use ESC as Meta key?
> 
> I usually use Alt as Meta key, but I can also use ESC as the meta
> (though I hardly do that, Alt is easier for me).

Yes, Alt is much easier.  It never worked before, though.

> > > I believe this can be done in Vterm too.
> > 
> > Perhaps it can ...  It would be easier if I could use Alt instead of
> > ESC for Meta.  How could I do that?
> 
> VTerm is a nice terminal emulator, but it's key bindings are kinda
> messed up IMHO.  You need to fix it yourself.  It isn't tough, but I
> forgot exactly how to do it.

Hm, I've found that I can't use emacs on a remote machine when
connecting via ssh in vterm to a tmux session on that machine because
the local emacs intercepts the key presses and it uses them for itself
before they make it to the remote emacs.

I'm not sure what to do about that yet ...  Mabe eat is the way to go?




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

* Re: vterm and Meta?
  2023-08-03 14:15       ` hw
@ 2023-08-03 18:49         ` Akib Azmain Turja
  2023-08-04 20:30           ` hw
  0 siblings, 1 reply; 36+ messages in thread
From: Akib Azmain Turja @ 2023-08-03 18:49 UTC (permalink / raw)
  To: hw; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2913 bytes --]

hw <hw@adminart.net> writes:

> On Wed, 2023-08-02 at 15:02 +0600, Akib Azmain Turja wrote:
>> hw <hw@adminart.net> writes:
>> 
>> > On Wed, 2023-08-02 at 01:01 +0600, Akib Azmain Turja wrote:
>> > > hw <hw@adminart.net> writes:
>> > > 
>> > > > Hi,
>> > > > 
>> > > > I'm trying out vterm and it turns out that I can't use the ESC key
>> > > > when within a vterm buffer: i. e. I don't have the meta key anymore
>> > > > because that gets sent to the terminal rather than emacs.
>> > > > 
>> > > > According to [1], I could maybe remove the ESC key from vterm-mode-map
>> > > > --- but it seems desirable to be able to use the ESC key for programs
>> > > > that might run in vterm.
>> > > > 
>> > > > How do you deal with this?  Do you use another key for the meta key
>> > > > other programs are less likely to make use of than the ESC key?
>> > > > 
>> > > > 
>> > > > [1]: https://github.com/akermu/emacs-libvterm#shell-side-configuration
>> > > > 
>> > > > 
>> > > 
>> > > I use Eat BTW.
>> > 
>> > Eat?  Is that another terminal for emacs?
>> 
>> Yes.  https://codeberg.org/akib/emacs-eat  :D
>> Disclaimer:  I'm the author.  ;)
>
> Cool, it looks interesting :)
>
> I haven't seen vterm flicker, though.  Perhaps it's because I'm
> running emacs on wayland?
>

VTerm doesn't usually flicker in most cases, but some heavy full-screen
problems (like Emacs) flickers on my machine.

However, my machine is 11 years old.  So maybe my machine isn't fast
enough.  ;)

>> > > Eat doesn't bind 'ESC', instead it binds 'ESC ESC' to
>> > > send ESC.  This allows me to send meta-keys.  When I need to send ESC, I
>> > > just press ESC twice.
>> > 
>> > So do you also need to use ESC as Meta key?
>> 
>> I usually use Alt as Meta key, but I can also use ESC as the meta
>> (though I hardly do that, Alt is easier for me).
>
> Yes, Alt is much easier.  It never worked before, though.
>
>> > > I believe this can be done in Vterm too.
>> > 
>> > Perhaps it can ...  It would be easier if I could use Alt instead of
>> > ESC for Meta.  How could I do that?
>> 
>> VTerm is a nice terminal emulator, but it's key bindings are kinda
>> messed up IMHO.  You need to fix it yourself.  It isn't tough, but I
>> forgot exactly how to do it.
>
> Hm, I've found that I can't use emacs on a remote machine when
> connecting via ssh in vterm to a tmux session on that machine because
> the local emacs intercepts the key presses and it uses them for itself
> before they make it to the remote emacs.
>
> I'm not sure what to do about that yet ...  Mabe eat is the way to go?

Eat makes running Emacs inside Emacs (inside Emacs...) completely
effortless.  :D

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: vterm and Meta?
  2023-08-02 15:10                   ` Yuri Khan
  2023-08-03 14:02                     ` hw
@ 2023-08-03 19:46                     ` tpeplt
  2023-08-03 21:32                       ` hw
  1 sibling, 1 reply; 36+ messages in thread
From: tpeplt @ 2023-08-03 19:46 UTC (permalink / raw)
  To: Yuri Khan; +Cc: hw, help-gnu-emacs

Yuri Khan <yuri.v.khan@gmail.com> writes:
>
>> How do I turn this off?  I don't need this and it gets in the way.
>
> (a) sacrifice a less important key (maybe right Alt or right Super)
> (b) wait for a future release of GNOME in which that MR will be merged
> (c) migrate to Ubuntu which applies that MR as a distro patch
> (d) migrate off GNOME to a compositor that gives you direct control
> over xkb options
> (e) use Gnome Tweaks to disable that option and avoid the Settings →
> Keyboard panel

Having read this thread so far, there has been no mention of the
following.

As the ASCII table points out, ‘[’ is the control character for ESC
(escape).  Helpfully, Emacs recognizes this so it can be used as an
alternative to reaching for the <Esc> key or a poorly-located <Alt> or
<Meta> key.  It can work on both terminal and graphical Emacs.

If your hands allow this combination (the <Ctrl> key must be held down
while reaching for and pressing the ‘[’ key), then this can be a good
combination for Emacs that reduces or eliminates repetitive-stress
injuries (RSI).

Here is a keyboard remapping suggestion (bottom row of keyboard):

   [alt/meta] [ctrl] [      space      ] [ctrl] [alt/meta]

With this arrangement, the Ctrl-[ combination for the Meta key is
pressed with your left thumb (short reach) and right pinkie (short
reach).  A key combination such as C-M-v (the ‘scroll-other-window’
command) is performed by pressing and holding the <Ctrl> key while
pressing the ‘[’ key.  Then those keys are released just as would be
done when pressing the <Esc> key and the <Ctrl>-v key will complete the
key combination.

The <Alt> key can then be left to use (only) for those key combinations
where you need to repeat some key combination, such as <M-v> (the
‘scroll-down-command’).  Simply press and hold the <Alt> key while
repeatedly pressing the ‘v’ as needed.  If you don’t need to repeat a
Meta key combination, use <Ctrl>-[ instead.

The advantage of this approach is that the long thumb reach for either
<Alt> key is avoided except for rare instances, while the short thumb
reach is used for frequent instances of <Ctrl> or <Ctrl>-[.  There is
also an extra benefit for touch typists -- it is much more rare that
unused fingers need to be lifted from the home keys.

If it is available to you, the ‘gnome-tweaks’ package can be used to
remap the Alt and Ctrl keys.  Within the gnome-tweaks application, see
the "Keyboard & Mouse" settings and then select the "Additional Layout
Options".

--



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

* Re: vterm and Meta?
  2023-08-01 16:36       ` hw
@ 2023-08-03 19:56         ` Spencer Baugh
  0 siblings, 0 replies; 36+ messages in thread
From: Spencer Baugh @ 2023-08-03 19:56 UTC (permalink / raw)
  To: help-gnu-emacs

hw <hw@adminart.net> writes:

> On Tue, 2023-08-01 at 11:05 -0400, Spencer Baugh wrote:
>> hw <hw@adminart.net> writes:
>> > On Tue, 2023-08-01 at 14:12 +0200, Thibaut Verron wrote:
>> > > Hi,
>> > > 
>> > > Are you using emacs in a terminal?
>> > 
>> > sometimes
>> > 
>> > > If not, Meta is usually bound to a modifier key (afaik by default the 
>> > > one immediately left of the space bar, e.g. alt on PC keyboards), and 
>> > > that works in vterm.
>> > 
>> > Uhm, I've been using emacs for over 30 years and in all these years,
>> > the ESC key was always used for a meta key across all instances by
>> > default.  It's the same when running emacs in a terminal, as an X11
>> > client or with wayland.
>> > 
>> > The key left of the space bar has always been the Alt key on all PC
>> > keyboards I've used so far.  Pressing, for example, Alt-x, inserts x
>> > into the buffer (like into this buffer I'm writing this reply in, and
>> > into the vterm buffer).
>> > 
>> > How is it that it's different for you?
>> > 
>> > > If you don't usually run programs using the Esc key in vterm, you can 
>> > > unbind it and send it with vterm-send-next-key when necessary.
>> > 
>> > Hm, true, I can try that.  It's not like I need the ESC key too often
>> > in a terminal.  Somehow I didn't think of that, thank you :)
>> > 
>> > But then, maybe it makes sense to reconfigure things to use the Alt
>> > key instead of ESC?  Apparently Alt doesn't do anything now and may be
>> > less awkward to type.  Hmm ...
>> 
>> It's possible to separate these in graphical frames.  I think you could
>> 
>> (define-key local-function-key-map (kbd "<escape>") nil)
>> 
>> to make <escape> no longer map to ESC.  Then you can remove the ESC
>> binding in vterm and add an <escape> binding.  Then Meta bindings and
>> <escape> will be separate.
>> 
>> (I know this because I figured it out for some evil-mode users and wrote
>> it up here: https://github.com/emacs-evil/evil/issues/1780 )
>
> Cool, only when I disable the only Meta key I have, I won't have a
> Meta key at all, would I?  I'd have to somehow configure some of the
> Alt keys as Meta first.

No.  Alt will still be translated to send ESC, so it will still work as
Meta.




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

* Re: vterm and Meta?
  2023-08-03 19:46                     ` tpeplt
@ 2023-08-03 21:32                       ` hw
  2023-08-03 22:29                         ` tpeplt
  0 siblings, 1 reply; 36+ messages in thread
From: hw @ 2023-08-03 21:32 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 2023-08-03 at 15:46 -0400, tpeplt wrote:
> Yuri Khan <yuri.v.khan@gmail.com> writes:
> > 
> > > How do I turn this off?  I don't need this and it gets in the way.
> > 
> > (a) sacrifice a less important key (maybe right Alt or right Super)
> > (b) wait for a future release of GNOME in which that MR will be merged
> > (c) migrate to Ubuntu which applies that MR as a distro patch
> > (d) migrate off GNOME to a compositor that gives you direct control
> > over xkb options
> > (e) use Gnome Tweaks to disable that option and avoid the Settings →
> > Keyboard panel
> 
> Having read this thread so far, there has been no mention of the
> following.
> 
> As the ASCII table points out, ‘[’ is the control character for ESC
> (escape).  Helpfully, Emacs recognizes this so it can be used as an
> alternative to reaching for the <Esc> key or a poorly-located <Alt> or
> <Meta> key.  It can work on both terminal and graphical Emacs.

That actually works without any ado, at least under wayland.

> If your hands allow this combination (the <Ctrl> key must be held down
> while reaching for and pressing the ‘[’ key), then this can be a good
> combination for Emacs that reduces or eliminates repetitive-stress
> injuries (RSI).
> 
> Here is a keyboard remapping suggestion (bottom row of keyboard):
> 
>    [alt/meta] [ctrl] [      space      ] [ctrl] [alt/meta]
> 
> With this arrangement, the Ctrl-[ combination for the Meta key is
> pressed with your left thumb (short reach) and right pinkie (short
> reach).  A key combination such as C-M-v (the ‘scroll-other-window’
> command) is performed by pressing and holding the <Ctrl> key while
> pressing the ‘[’ key.  Then those keys are released just as would be
> done when pressing the <Esc> key and the <Ctrl>-v key will complete the
> key combination.

Try it on a keyboard shown in [1] (which is an awesome keyboard
indeed), or on a German keyboard :)  It's awkward to press.  Swapping
Ctrl with Alt on the right would make it easier, but that would take
some getting used to.

On a German keyboard, Ctrl-[ is virtually inaccessible because you
would have to press AltGr+Shift+8, and the only AltGr key you get is
on the right.


[1]: https://www.pckeyboard.com/mm5/merchant.mvc?Screen=PROD&Product_Code=UB40B5A

> The <Alt> key can then be left to use (only) for those key combinations
> where you need to repeat some key combination, such as <M-v> (the
> ‘scroll-down-command’).  Simply press and hold the <Alt> key while
> repeatedly pressing the ‘v’ as needed.  If you don’t need to repeat a
> Meta key combination, use <Ctrl>-[ instead.

Well, I don't use M-v.  Like I said, Alt for Meta hasn't been working
ever since I came across emacs about 30 years ago.  That was on an
Atari ST. Meta has always been ESC, and using that for movement is no
fun.

> The advantage of this approach is that the long thumb reach for either
> <Alt> key is avoided except for rare instances, while the short thumb
> reach is used for frequent instances of <Ctrl> or <Ctrl>-[.  There is
> also an extra benefit for touch typists -- it is much more rare that
> unused fingers need to be lifted from the home keys.

I always take my fingers off the home row for moving around, except
for Ctrl-a and Ctrl-e.  That way I can use the cursor keys and
PgDown/PgUp keys --- it's what makes sense to me.

Ctrl and Alt are special keys for me which aren't included in
10-finger typing.  Typewriters don't have these keys, and they are
very awkwardly positioned ...  I'd be impressed if you can use these
keys just like all the others.

> If it is available to you, the ‘gnome-tweaks’ package can be used to
> remap the Alt and Ctrl keys.  Within the gnome-tweaks application, see
> the "Keyboard & Mouse" settings and then select the "Additional Layout
> Options".

Right --- yet what makes Alt for Meta so great is that you can do
stuff directly, like M-x right away puts you into the minibuffer where
you can enter the name of the function you want to call.  Having to
use ESC or Ctrl-[ makes this awkward because you have to press ESC
first and then x.  That has always been weird.




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

* Re: vterm and Meta?
  2023-08-03 21:32                       ` hw
@ 2023-08-03 22:29                         ` tpeplt
  2023-08-04 20:08                           ` hw
  0 siblings, 1 reply; 36+ messages in thread
From: tpeplt @ 2023-08-03 22:29 UTC (permalink / raw)
  To: hw; +Cc: help-gnu-emacs

hw <hw@adminart.net> writes:

>> 
>> Here is a keyboard remapping suggestion (bottom row of keyboard):
>> 
>>    [alt/meta] [ctrl] [      space      ] [ctrl] [alt/meta]
>> 
>> With this arrangement, the Ctrl-[ combination for the Meta key is
>> pressed with your left thumb (short reach) and right pinkie (short
>> reach).  A key combination such as C-M-v (the ‘scroll-other-window’
>> command) is performed by pressing and holding the <Ctrl> key while
>> pressing the ‘[’ key.  Then those keys are released just as would be
>> done when pressing the <Esc> key and the <Ctrl>-v key will complete the
>> key combination.
>
> Try it on a keyboard shown in [1] (which is an awesome keyboard
> indeed), or on a German keyboard :)  It's awkward to press.  Swapping
> Ctrl with Alt on the right would make it easier, but that would take
> some getting used to.
>
> On a German keyboard, Ctrl-[ is virtually inaccessible because you
> would have to press AltGr+Shift+8, and the only AltGr key you get is
> on the right.
>
>
> [1]:
> https://www.pckeyboard.com/mm5/merchant.mvc?Screen=PROD&Product_Code=UB40B5A
>

If I am seeing this photo correctly, there are <Alt> keys immediately to
the left and right of the space bar.  These are the ones to swap with
the <Ctrl> keys (which I cannot locate in the picture).  The ‘[’ key is
immediately to the right of the ‘P’ key.  Those are the same locations
as I am referring to.  Use the left thumb to press and hold the <Alt>
key while the right pinkie presses the ‘[’ key.  This is a minimal
amount of reach and does not contort either the left or right hand.  The
combination is used the same way that the <Esc> key is used: Press and
release the two keys (think <Meta>) and then press the next key in the
combination.  This avoids having to press and hold the <Alt> key in
combination with the <Ctrl> key.

This might not be to your taste (just as Emacs’s key combinations drive
some people to use vi).  It can work very well and until I had moved to
this arrangement years ago, I routinely had RSI problems.

>
>> The advantage of this approach is that the long thumb reach for either
>> <Alt> key is avoided except for rare instances, while the short thumb
>> reach is used for frequent instances of <Ctrl> or <Ctrl>-[.  There is
>> also an extra benefit for touch typists -- it is much more rare that
>> unused fingers need to be lifted from the home keys.
>
> I always take my fingers off the home row for moving around, except
> for Ctrl-a and Ctrl-e.  That way I can use the cursor keys and
> PgDown/PgUp keys --- it's what makes sense to me.
>

If you move the <Ctrl> keys to the sides of the <Space> bar, then many
Ctrl sequences become available.  <Ctrl>-n/<Ctrl>-p can quickly replace
the Up/Down arrow keys.  <Ctrl> becomes a second <Shift> key, but more
easily reached than <Shift>.

> Ctrl and Alt are special keys for me which aren't included in
> 10-finger typing.  Typewriters don't have these keys, and they are
> very awkwardly positioned ...  I'd be impressed if you can use these
> keys just like all the others.
>

Once re-positioned, the <Ctrl> keys are not much more difficult to reach
for your thumbs than the <Space> bar and easier to reach than the
<Shift> keys (using your stronger thumbs rather than your weaker pinkies).

>> If it is available to you, the ‘gnome-tweaks’ package can be used to
>> remap the Alt and Ctrl keys.  Within the gnome-tweaks application, see
>> the "Keyboard & Mouse" settings and then select the "Additional Layout
>> Options".
>
> Right --- yet what makes Alt for Meta so great is that you can do
> stuff directly, like M-x right away puts you into the minibuffer where
> you can enter the name of the function you want to call.  Having to
> use ESC or Ctrl-[ makes this awkward because you have to press ESC
> first and then x.  That has always been weird.

It should be less weird if you reposition the <Ctrl> keys next to the
<Space> bar.  It puts them within reach of some of your strongest
fingers -- your thumbs.  Once done, it becomes a touch-typing exercise
where you learn to think <Meta> when reaching for <Ctrl> with your left
thumb and [ with your right pinkie.  Touch typing requires repetitious
practicing, as you likely know well.

A suggestion to try is to reposition the keys and go through the Emacs
Tutorial (C-h t).  That would provide practice using many Ctrl key
combinations and could help you decide whether this new approach is to
your liking.

--



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

* Re: vterm and Meta?
  2023-08-03 22:29                         ` tpeplt
@ 2023-08-04 20:08                           ` hw
  2023-08-04 21:20                             ` PierGianLuca
  2023-08-04 21:42                             ` tpeplt
  0 siblings, 2 replies; 36+ messages in thread
From: hw @ 2023-08-04 20:08 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 2023-08-03 at 18:29 -0400, tpeplt wrote:
> hw <hw@adminart.net> writes:
> 
> > > 
> > > Here is a keyboard remapping suggestion (bottom row of keyboard):
> > > 
> > >    [alt/meta] [ctrl] [      space      ] [ctrl] [alt/meta]
> > > 
> >  [...]
> > 
> > [1]:
> > https://www.pckeyboard.com/mm5/merchant.mvc?Screen=PROD&Product_Code=UB40B5A
> > 
> 
> If I am seeing this photo correctly, there are <Alt> keys immediately to
> the left and right of the space bar.  These are the ones to swap with
> the <Ctrl> keys (which I cannot locate in the picture).

The Ctrl keys are left and right to the Alt keys.

> The ‘[’ key is immediately to the right of the ‘P’ key.  Those are
> the same locations as I am referring to.  Use the left thumb to
> press and hold the <Alt> key while the right pinkie presses the ‘[’
> key.  This is a minimal amount of reach and does not contort either
> the left or right hand.  The combination is used the same way that
> the <Esc> key is used: Press and release the two keys (think <Meta>)
> and then press the next key in the combination.  This avoids having
> to press and hold the <Alt> key in combination with the <Ctrl> key.
> 
> This might not be to your taste (just as Emacs’s key combinations drive
> some people to use vi).  It can work very well and until I had moved to
> this arrangement years ago, I routinely had RSI problems.

Well, it surely is a possibility.  For me, it would be much easier to
just press ESC like I have done for about 30 years.  ESC always worked
while Alt never did, and it has the big advantage that it doesn't
require configuration.

When you use emacs on different computers only one of which has an US
keyboard while the others have German keyboards, one of them being a
laptop (and laptop keyboards suck in multiple ways), you'd have to do
too much configuration.  Add to that a bunch of remote machines on
which you also have to configure things and it becomes too tedious.
It's not only the keyboard that needs work.

It would be great progress if I can get the Alt key to work as Meta
everywhere.

When you unexcpetedly find yourself thrown into vi, its key bindings
have the killer problem that you have to press ESC to get out of
editing mode, and that doesn't always work, mostly with no indication
weather it did work or not.  And since I'm not used to the key
bindings in vi, chances are that I accidentially edit something and
mess things up.  So I quit vi and use emacs instead in case I suddenly
end up in vi.

I tried to learn vi a while ago but it's lacking basic things like
indent-region and about everything else I have in emacs out of the
box.  After that, I can't even say anymore that there are only two
good editors and that everyone should pick whatever they get along
with better.  Vi is a raw and rudimentary implementation of an editor
like so many others while emacs is the tool you ultimately want.  If
you want raw and rudimentary, why would you use vi?  Geany is nice,
too, like many others.

> > > The advantage of this approach is that the long thumb reach for either
> > > <Alt> key is avoided except for rare instances, while the short thumb
> > > reach is used for frequent instances of <Ctrl> or <Ctrl>-[.  There is
> > > also an extra benefit for touch typists -- it is much more rare that
> > > unused fingers need to be lifted from the home keys.
> > 
> > I always take my fingers off the home row for moving around, except
> > for Ctrl-a and Ctrl-e.  That way I can use the cursor keys and
> > PgDown/PgUp keys --- it's what makes sense to me.
> > 
> 
> If you move the <Ctrl> keys to the sides of the <Space> bar, then many
> Ctrl sequences become available.

I'm finding it much easier to slightly move my left hand to press left
Ctrl where it is with my little finger.  With Ctrl and Alt swapped, I
can't really bend my right thumb to reach right Ctrl whereas I can
press it with my little finger when the keys aren't swapped.

> <Ctrl>-n/<Ctrl>-p can quickly replace the Up/Down arrow keys.

The dedicated movement keys replaced the ideosyncratic movement keys
the emacs tutorial suggested not only quickly but right away (see
below) :)

> <Ctrl> becomes a second <Shift> key, but more easily reached than
> <Shift>.

Shift is easier to reach than Ctrl, especially when you swap Alt and
Ctrl, unless you configure CapsLock as Ctrl, which I have.  You could
also configure CapsLock as Alt so it becomes Meta and use CapsLock-a
instead of M-x, and so on.

Hm, thinking of it, CapsLock as Alt seems to make way more sense since
I almost never use that anyway ...  But how do I configure CapsLock as
Alt in wayland?

Shift needs to be easy to reach, you'll notice when you write German.

> > Ctrl and Alt are special keys for me which aren't included in
> > 10-finger typing.  Typewriters don't have these keys, and they are
> > very awkwardly positioned ...  I'd be impressed if you can use these
> > keys just like all the others.
> > 
> 
> Once re-positioned, the <Ctrl> keys are not much more difficult to reach
> for your thumbs than the <Space> bar

That's not true, I have to bend my left thumb, and on the right I have
to raise my whole arm to bend my thumb that far.  Pressing the space
bar doesn't require bending.

> and easier to reach than the <Shift> keys (using your stronger
> thumbs rather than your weaker pinkies).

Shift is easier to reach, even if only because I'm more used to that.

The springs buckle easily enough to press keys with my little fingers.
Even when the keyboard is worn out, it's not the springs that hinder
the movement of the keys but the debris that got into them (you can't
really get that out anymore at that point, so you never turn a
keyboard upside down) and the wobblyness of the key stems which makes
them rub inside their holders once they're angled too much.  That gets
only worse over time but the springs remain fine :)  That is how even
a Model M wears out eventually.

> > > If it is available to you, the ‘gnome-tweaks’ package can be used to
> > > remap the Alt and Ctrl keys.  Within the gnome-tweaks application, see
> > > the "Keyboard & Mouse" settings and then select the "Additional Layout
> > > Options".
> > 
> > Right --- yet what makes Alt for Meta so great is that you can do
> > stuff directly, like M-x right away puts you into the minibuffer where
> > you can enter the name of the function you want to call.  Having to
> > use ESC or Ctrl-[ makes this awkward because you have to press ESC
> > first and then x.  That has always been weird.
> 
> It should be less weird if you reposition the <Ctrl> keys next to the
> <Space> bar.

That would be totally weird.  And it would create issues, like how am
I supposed to press Cltr-l without bending my hand when the Ctrl key
is misplaced?

> It puts them within reach of some of your strongest fingers -- your
> thumbs.

Not eactly, and only on the left.  Right Ctrl would be become
inaccessible.

Have you ever used a Model M keyboard (or the 122 key variant)?  They
are reasonably --- i. e. like perfectly --- sized and the key spacing
is perfect.  On all other keyboards I've tried, the spacing is too
small and they give me a cramped feeling.  But when your hands are
larger or smaller than mine, you may see that totally different.

If you want to get a Model M, go for it.  It's still overall the best
keyboard you can get.  The original ones have become expensive and
hard to find and may be worn out after 30 years.  Fortunately, you can
get a new one from Unicomp, and that's very likely the better deal.

> Once done, it becomes a touch-typing exercise where you learn to
> think <Meta> when reaching for <Ctrl> with your left thumb and [
> with your right pinkie.  Touch typing requires repetitious
> practicing, as you likely know well.

Yes, and it also requires that you find the keyboard that is best for
you and is configured for your needs and that you use nothing else.
When you come across different keyboards made for different languages
and not configured for your needs, this approach doesn't work so well.

And my thumbs are pretty much the last fingers I'd use to press Ctrl
when the rest of my fingers are at the home row.  The home row is
great for typing, not for moving around.  I either type or move
around, and for moving around, the dedicated movement keys are very
convenient.  How much do you move around on a typewriter?

> A suggestion to try is to reposition the keys and go through the Emacs
> Tutorial (C-h t).  That would provide practice using many Ctrl key
> combinations and could help you decide whether this new approach is to
> your liking.

I did that in the 90ies on my Atari ST.  You can still find pictures
of the keyboards they used.  How much sense do you think that tutorial
made with these keyboards (their German version) --- and no, Alt
didn't work for Meta but ESC did.

It has been like that since then, the only Meta key was ESC.  Using
the dedicated movement keys made total sense and all the key bindings
for movement in the tutorial have never made sense, and they still
don't make sense today.  The only exception is Ctrl-a and Ctrl-e which
I must have learned back then, from that very tutorial, and it always
annoys me when that doesn't work somewhere.  Hm, ok, Ctrl-l is another
one, if you want to call that movement.  But that's all.

Key bindings like C-b, C-f and a lot of others are still useless today
because pressing the Ctrl key --- doing it the easiest way ---
requires me to move my right hand over to the right to press Ctrl with
my little finger.  And when I do that, it's much easier to use
dedicated movement keys instead, and it doesn't require
thinking.  (CapsLock for Ctrl is easier to reach but requires
configuration and big relearning.)

However, it seems I'm accidentially learning M-a and M-e ---
acciditentially because I pressed M-a when I wanted to press M-q a few
times and figured out what that does.  You never do that when you only
have ESC for Meta.

Your suggestions are good, only they don't work for me.




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

* Re: vterm and Meta?
  2023-08-03 18:49         ` Akib Azmain Turja
@ 2023-08-04 20:30           ` hw
  0 siblings, 0 replies; 36+ messages in thread
From: hw @ 2023-08-04 20:30 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 2023-08-04 at 00:49 +0600, Akib Azmain Turja wrote:
> [..]
> > > > > I use Eat BTW.
> > > > 
> > > > Eat?  Is that another terminal for emacs?
> > > 
> > > Yes.  https://codeberg.org/akib/emacs-eat  :D
> > > Disclaimer:  I'm the author.  ;)
> > 
> > Cool, it looks interesting :)
> > 
> > I haven't seen vterm flicker, though.  Perhaps it's because I'm
> > running emacs on wayland?
> > 
> 
> VTerm doesn't usually flicker in most cases, but some heavy full-screen
> problems (like Emacs) flickers on my machine.
> 
> However, my machine is 11 years old.  So maybe my machine isn't fast
> enough.  ;)

Perhaps you can switch the graphics card for a faster one.  A fast
card makes day and night difference.  11 years is a bit dated but
unless you want to play games should be ok, at least if it was a good
machine to begin with.

> [..]
> > Hm, I've found that I can't use emacs on a remote machine when
> > connecting via ssh in vterm to a tmux session on that machine because
> > the local emacs intercepts the key presses and it uses them for itself
> > before they make it to the remote emacs.
> > 
> > I'm not sure what to do about that yet ...  Mabe eat is the way to go?
> 
> Eat makes running Emacs inside Emacs (inside Emacs...) completely
> effortless.  :D

Hm I think I should try it out :)




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

* Re: vterm and Meta?
  2023-08-04 20:08                           ` hw
@ 2023-08-04 21:20                             ` PierGianLuca
  2023-08-06 16:32                               ` hw
  2023-08-04 21:42                             ` tpeplt
  1 sibling, 1 reply; 36+ messages in thread
From: PierGianLuca @ 2023-08-04 21:20 UTC (permalink / raw)
  To: help-gnu-emacs, hw


> Hm, thinking of it, CapsLock as Alt seems to make way more sense since
> I almost never use that anyway ...  But how do I configure CapsLock as
> Alt in wayland?

Try out Xremap:

https://github.com/k0kubun/xremap

It is extremely flexible and even allows per-app configurations. It works at a deeper level than other keymap-like programs (such as AutoKey for instance), so you don't even notice it's there. I use it on X11, but apparently it works with Wayland too.

Cheers,
Luca



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

* Re: vterm and Meta?
  2023-08-04 20:08                           ` hw
  2023-08-04 21:20                             ` PierGianLuca
@ 2023-08-04 21:42                             ` tpeplt
  2023-08-06 19:41                               ` hw
  1 sibling, 1 reply; 36+ messages in thread
From: tpeplt @ 2023-08-04 21:42 UTC (permalink / raw)
  To: hw; +Cc: help-gnu-emacs

hw <hw@adminart.net> writes:

> On Thu, 2023-08-03 at 18:29 -0400, tpeplt wrote:
>> hw <hw@adminart.net> writes:
>> 
>> > > 
>> > > Here is a keyboard remapping suggestion (bottom row of keyboard):
>> > > 
>> > >    [alt/meta] [ctrl] [      space      ] [ctrl] [alt/meta]
>> > > 
>> >  [...]
>> > 
>> > [1]:
>> > https://www.pckeyboard.com/mm5/merchant.mvc?Screen=PROD&Product_Code=UB40B5A

It sounds as though you have made up your mind not to try the
suggestion, above, which is understandable because many people have
firm, fixed views about the most usable way to configure their keyboard.

For anyone reading this who wants to try it using Gnome, especially if
you have had pain in your hands/RSI, here are the steps to arrange the
bottom row of the keyboard as described above:

1. (Install and) Start the gnome-tweaks application.
2. In the application, click on the "Keyboard&Mouse" entry in the menu
on the left-hand side of the application.
3. Click on the "Additional Layout Options" button.
4. In the Additional Layout Options pane, click on the "Alt and Win
Behavior" pointer.
5. Select the "Ctrl is mapped to Alt, Alt to Win" radio button.
6. Click on the "Alt and Win Behavior" pointer a second time to close
it.
7. Click on the "Ctrl position" pointer.
8. Click on the "Left Alt as Ctrl, Left Ctrl as Win, Left Win as Left
Alt" checkbox, if your keyboard has those keys (including the
Win/Windows key).
9. Click on the "Right Ctrl as Right Alt".
10. Click on the "Ctrl position" pointer again to close it.

Those changes ought to give your keyboard the layout described above.
You can then test it to see whether the arrangement is better for you
when using Emacs.

As a bonus suggestion, move the Backspace key to the CapsLock location.
Backspace is used frequently by many people and it should be located
close to the home row rather than off in the upper right-hand corner.

To move the Backspace key using the gnome-tweaks application, click on
the "Caps Lock behavior" after step 10, above.  Then click on the radio
button labeled "Make Caps Lock an additional Backspace".  Unfortunately,
gnome-tweaks does not provide a means to *swap* the CapsLock and
Backspace keys, so this will configure the keyboard to have *two*
Backspace keys.  The CapsLock capability is moved to the two Shift keys,
which must be pressed *simultaneously* to turn on Caps Lock.  To turn
off Caps Lock, press either Shift key.

>
>> > > The advantage of this approach is that the long thumb reach for either
>> > > <Alt> key is avoided except for rare instances, while the short thumb
>> > > reach is used for frequent instances of <Ctrl> or <Ctrl>-[.  There is
>> > > also an extra benefit for touch typists -- it is much more rare that
>> > > unused fingers need to be lifted from the home keys.
>> > 
>> > I always take my fingers off the home row for moving around, except
>> > for Ctrl-a and Ctrl-e.  That way I can use the cursor keys and
>> > PgDown/PgUp keys --- it's what makes sense to me.
>> > 
>> 
>> If you move the <Ctrl> keys to the sides of the <Space> bar, then many
>> Ctrl sequences become available.
>
> I'm finding it much easier to slightly move my left hand to press left
> Ctrl where it is with my little finger.  With Ctrl and Alt swapped, I
> can't really bend my right thumb to reach right Ctrl whereas I can
> press it with my little finger when the keys aren't swapped.
>

Yes, unless the <Ctrl> keys are moved to the keys immediately to the
left and right of the <SPC> key, the suggestion of using <Ctrl>-[ should
not be used.  The most typed key on the keyboard or a typewriter is the
<SPC> key, so the design should and does place it under the strongest
finger (the two thumbs).  Reaching slightly to the left and right of the
<SPC> key with the thumbs means that 1) a strong finger does the reach
and 2) like Shift keys, your hands can be used together.  For example,
to type <Ctrl>-u, press and hold the left <Ctrl> with your left
thumb while typing the "u" with a finger on your right hand.  Likewise,
to type <Ctrl>-a, press and hold the right <Ctrl> with your right thumb
while typing the "a" with your left pinkie.

The common practice of putting the <Ctrl> key on the <CapsLock> key
means that only one <Ctrl> key is used and so the left hand has to be
used to type both the <Ctrl> key and the second key.  No one would
suggest that the two <Shift> keys be reduced to a single key.
>
> That would be totally weird.  And it would create issues, like how am
> I supposed to press Cltr-l without bending my hand when the Ctrl key
> is misplaced?
>

It should be the same, nearly, as pressing the <SPC> bar with your left
thumb -- one of the most frequent key presses on the keyboard.

>
> If you want to get a Model M, go for it.  It's still overall the best
> keyboard you can get.  The original ones have become expensive and
> hard to find and may be worn out after 30 years.  Fortunately, you can
> get a new one from Unicomp, and that's very likely the better deal.
>

Thank you for the recommendation.  It sounds like a nice keyboard and
keyboards are worth investing in for typists, including programmers.
Although those keyboards are much better than laptop keyboards, my
suggestion to move the Ctrl keys is made after using it on laptop
keyboards for many years.  In fact, a critical consideration when buying
a laptop is whether it has the <Ctrl> and <Alt> keys in the locations
outlined above (that is, to the left and right of the <SPC> key).  I
have rejected laptops that do not have that because it would lead to RSI
and make typing for programming significantly slower and more difficult.

>
> And my thumbs are pretty much the last fingers I'd use to press Ctrl
> when the rest of my fingers are at the home row.  The home row is
> great for typing, not for moving around.  I either type or move
> around, and for moving around, the dedicated movement keys are very
> convenient.  How much do you move around on a typewriter?
>

The point of the suggested move is to make typing easier and less
prone to RSI.  It mostly isn’t even necessary to leave the home row (an
occasional <Alt>-<Tab> or <Super> key) and use the very large number of
Emacs key combinations.  Key combinations become just like another kind
of "shift."

>> A suggestion to try is to reposition the keys and go through the Emacs
>> Tutorial (C-h t).  That would provide practice using many Ctrl key
>> combinations and could help you decide whether this new approach is to
>> your liking.
>
> I did that in the 90ies on my Atari ST.  You can still find pictures
> of the keyboards they used.  How much sense do you think that tutorial
> made with these keyboards (their German version) --- and no, Alt
> didn't work for Meta but ESC did.
>

It didn’t make sense and it lead to RSIs.  Fortunately, since then
keyboards moved from having a single <Ctrl> key to having two, along
with two <Alt> keys.  This, plus the ability to reconfigure the keyboard
has mostly eliminated RSI and increases typing speed (including Emacs’s
commands).

>
> Key bindings like C-b, C-f and a lot of others are still useless today
> because pressing the Ctrl key --- doing it the easiest way ---
> requires me to move my right hand over to the right to press Ctrl with
> my little finger.  And when I do that, it's much easier to use
> dedicated movement keys instead, and it doesn't require
> thinking.  (CapsLock for Ctrl is easier to reach but requires
> configuration and big relearning.)
>
> However, it seems I'm accidentially learning M-a and M-e ---
> acciditentially because I pressed M-a when I wanted to press M-q a few
> times and figured out what that does.  You never do that when you only
> have ESC for Meta.
>
> Your suggestions are good, only they don't work for me.

OK.  That was always a possibility.  It is a suggestion for you to
consider and you still could reconsider now that you have seen it as a
possibility.  (I had RSI for years because I could not see how a simple
reconfiguration could fix the problem for me, and I wished I had seen it
suggested from the beginning.  It is such a significantly better
arrangement that I wish it was documented in the Emacs Manual.  It could
help many people overcome the problem of the complicated key
combinations being difficult and driving them not to use Emacs.)  Here’s
hoping that it might be helpful for some other reader who uses Emacs.

--



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

* Re: vterm and Meta?
  2023-08-04 21:20                             ` PierGianLuca
@ 2023-08-06 16:32                               ` hw
  2023-08-06 17:09                                 ` PierGianLuca
  2023-08-06 17:39                                 ` Yuri Khan
  0 siblings, 2 replies; 36+ messages in thread
From: hw @ 2023-08-06 16:32 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 2023-08-04 at 23:20 +0200, PierGianLuca wrote:
> > Hm, thinking of it, CapsLock as Alt seems to make way more sense since
> > I almost never use that anyway ...  But how do I configure CapsLock as
> > Alt in wayland?
> 
> Try out Xremap:
> 
> https://github.com/k0kubun/xremap
> 
> It is extremely flexible and even allows per-app configurations. It works at a deeper level than other keymap-like programs (such as AutoKey for instance), so you don't even notice it's there. I use it on X11, but apparently it works with Wayland too.

Thanks!  I doubt it works on a "deeper level" with wayland because it
requires a gnome shell extension to figure out which program is
currently focused.  That makes me think it intercepts the keyboard
input, does its thing to that and sends the result to whatever program
currently has the keyboard focus --- or something along these lines.

That seems like a really bad software because it raises all kinds of
security issues, because the overhead (not to mention the
dependencies) must be tremendous and because it doesn't actually fix
the problem by allowing to change the keyboard layout but wedges a bad
layer in between.  (It's not like gnome shell extensions are easy to
set up.  I only did it because I wanted gs-connect so I could send
SMS, but that worked only for a little while and is broken since.  If
gnome had a decent window manager, these extensions wouldn't be needed
anyway.)

And that doesn't even mention that the gnome people still haven't
gotten focus-follows-mouse to work right which fvwm does so well since
ages.  They got it work better than it did, though.

Some people must have a really weird understanding of "deeper level".
Why can't we just modify the predefined keyboard layouts? Somebody
must have made them somehow.




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

* Re: vterm and Meta?
  2023-08-06 16:32                               ` hw
@ 2023-08-06 17:09                                 ` PierGianLuca
  2023-08-06 17:39                                 ` Yuri Khan
  1 sibling, 0 replies; 36+ messages in thread
From: PierGianLuca @ 2023-08-06 17:09 UTC (permalink / raw)
  To: help-gnu-emacs

Hi hw,

> Some people must have a really weird understanding of "deeper level".

I'm absolutely not knowledgeable about this kind of things, so I've probably chosen inappropriate terms, don't take me too literally.

The solution I proposed is just a make-do solution. On Ubuntu+KDE and X11 it doesn't seem to have much of an overhead; at least it's at the bottom of CPU usage in system monitor. "Must be tremendous" doesn't mean "is tremendous".

I completely agree that the situation with keyboard customization (and also locale customization) is completely messed up in Ubuntu and Kubuntu (don't know about other distros or desktop environments).

This (and locale) was one, maybe the only one, kind of customization that was much easier on Windows than on Ubuntu. I'm used to a key configuration similar to that described by Eli (or maybe I remember incorrectly?), with Ctrl closer to space, then Alt, then the 3rd-level/diacritics key, and CapsLock as "Super". It was a nightmare to set it up on Ubuntu. I tried to modify the xkb configuration files in all kinds of ways, but and after several days of trials and searches it became clear that in fact it couldn't be done at all. The only thing that can be easily changed are ordinary letters (for example making letters with diacritics available under non-standard places, say "å" under the "l" key or similar).

If I remember correctly there were several online guides and blogs that made it clear that customizations involving "special" keys are quite complicated.

So I turned to make-do solutions: first with AutoKey, but that did have quite an overhead. Then Xremap, which has been great for me.

Cheers,
Luca



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

* Re: vterm and Meta?
  2023-08-06 16:32                               ` hw
  2023-08-06 17:09                                 ` PierGianLuca
@ 2023-08-06 17:39                                 ` Yuri Khan
  1 sibling, 0 replies; 36+ messages in thread
From: Yuri Khan @ 2023-08-06 17:39 UTC (permalink / raw)
  To: hw; +Cc: help-gnu-emacs

On Sun, 6 Aug 2023 at 23:33, hw <hw@adminart.net> wrote:

> > Try out Xremap:

> That seems like a really bad software because it raises all kinds of
> security issues, because the overhead (not to mention the
> dependencies) must be tremendous and because it doesn't actually fix
> the problem by allowing to change the keyboard layout but wedges a bad
> layer in between.

You guys should really look into building custom keyboards rather than
trying to beat whatever is offered on the market into shape using
software solutions. At least two fully Free keyboard firmwares are
available (QMK for wired keyboards, ZMK for Bluetooth) and you will be
able to put whichever keys you want, wherever is comfortable for you.

For an Emacs user, it really pays off to design a board with many
thumb keys and put all the modifiers there. You also have the option
to program certain keys with one function when quickly pressed and
released, another when held, e.g. combine Space and Super.

(Please direct any responses to this subthread to emacs-tangents, I
feel it would be off-topic here.)



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

* Re: vterm and Meta?
  2023-08-04 21:42                             ` tpeplt
@ 2023-08-06 19:41                               ` hw
  2023-08-06 19:54                                 ` Emanuel Berg
  0 siblings, 1 reply; 36+ messages in thread
From: hw @ 2023-08-06 19:41 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 2023-08-04 at 17:42 -0400, tpeplt wrote:
> hw <hw@adminart.net> writes:
> 
> > On Thu, 2023-08-03 at 18:29 -0400, tpeplt wrote:
> > > hw <hw@adminart.net> writes:
> > > 
> > > > > 
> > > > > Here is a keyboard remapping suggestion (bottom row of keyboard):
> > > > > 
> > > > >    [alt/meta] [ctrl] [      space      ] [ctrl] [alt/meta]
> > > > > 
> > > >  [...]
> > > > 
> > > > [1]:
> > > > https://www.pckeyboard.com/mm5/merchant.mvc?Screen=PROD&Product_Code=UB40B5A
> 
> It sounds as though you have made up your mind not to try the
> suggestion, above, which is understandable because many people have
> firm, fixed views about the most usable way to configure their keyboard.

It's a good suggestion and I considered it.  I'm not gona follow it
because it makes no sense for me, not because I have firm, fixed
views.  I have a collection of keyboards all of wich are different,
all of them except one have a German layout which doesn't have two Alt
keys; some of them have these retarded windows keys that always get in
the way while others don't, and I'm somtimes using keyboards on other
machines.  I have found a way to deal with it and part of that way is
to go with default configurations as far as possible because it means
that I can use emacs and other software with whatever keyboard is
connected.  Also I don't have the time to configure every machine I
run emacs on with the same configuration I have on my workstation at
home, and doing that won't make sense because some of these machines
don't have keyboards and emacs is accessed through ssh through
whatever keyboard the machine has that is used to connect to them. The
default of the last 30+ years is that ESC is the only Meta key you
get.  That my workstation at home is now configured to have Alt as
Meta is an exception.  I probably can't even be bothered to configure
my laptop like that and whenever I can I connect a "real" keyboard to
it of whatever layout which happens to be available.  Its keyboard is
totally different again.

If had a firm, fixed view, I wouldn't get anywhere.  So please don't
assume that would the reason I'm not following your suggestion.

Your suggestion does not work with a Germany keyboard, especially when
it has windows keys that get in the way.  There are probably other
keyboards for different languages with which it doesn't work, either.
Have you considered that?

> [..]
> > I'm finding it much easier to slightly move my left hand to press left
> > Ctrl where it is with my little finger.  With Ctrl and Alt swapped, I
> > can't really bend my right thumb to reach right Ctrl whereas I can
> > press it with my little finger when the keys aren't swapped.
> > 
> 
> Yes, unless the <Ctrl> keys are moved to the keys immediately to the
> left and right of the <SPC> key, the suggestion of using <Ctrl>-[ should
> not be used.

Swapping Alt and Ctrl on the right side of _this_ keyboard would make
Ctrl virtually inaccessible.  Why would I ever press Cltr+[ instead of
Alt for Meta?  If you remember, pressing that requires you to press
AltGr+Shift+Ctrl+8 on a German keyboard.

That's bascially an unpressable key combination.  The only other
program that I know of which uses that is telnet, and it took me years
until I finally realised what they meant.  Telnet used to say
something like "press ^[", and that's one of the most unhelpful hints
you can find.  IIRC, joe used Ctrl+[ for some things which probably
means that wordstar used it, too.  Ctrl+[ may make sense on an US
keyboard and it doesn't on a German one.  I never used that.
AltGr+Shift+Ctrl+8 is just too much.

> The most typed key on the keyboard or a typewriter is the
> <SPC> key, so the design should and does place it under the strongest
> finger (the two thumbs).

You're totally wrong here:

If you have ever used a mechanical typewriter --- and that is where
the keyboard layouts we commonly still use today originate from ---
you will have noticed that space is the key that requires the least
strength to press.  The carriage is spring driven and space only
releases it to go one letter further, which is easy.  With all other
keys, you have to hit them hard for the lever to slam down upon the
ribbon to get the letter printed on the paper, plus printed on the
copies you may also have wound into the machine.  That means each
finger has to slam so hard as to print the letter through the ribbon
onto the paper the ribbon prints on (already hard) and then another
two pieces of paper with copy sheets in between of each of them
(*really* hard).  Two copies is about as much as you can do with a
good mechanical typewriter, and it was usually avoided.  As a typist,
you had to have really strong fingers while your thumbs always had the
easiest job, no matter how many copies you had in the machine.

When typewriters were invented, manual labour was way different from
how it is today and ppl back then probably had incredibly strong
fingers.  Finger strength was probably not a concern at all when it
came to the placement of the keys.  They wanted to place them
conveniently and at the same time couldn't place them too conveniently
because when you type fast on a mechnical typewriter, the levers don't
have enough time to get out of the way of the other levers and then
the levers get stuck on each other and then the machine is jammed
up. That also involved putting levers for frequently used characters
apart from other levers for frequently used characters because the
further the levers were away from each other, the more room they had
not to get into each others way.  Since the levers were directly
connected to the keys, that meant to have to place the keys away from
each other.

Nowadays, how much force and thus strength is needed to press a key
only depends on the design of the key.  That is since electrical
typewriters were invented, and that was a long time ago.  Only the
keyboard layout didn't change much because people are used to it.

> Reaching slightly to the left and right of the <SPC> key with the
> thumbs

On the right side of this keyboard, the key rightmost the space bar is
labled Alt, and it is so far to the right that I can't really bend my
thumb all that way.  There is not slightly here, and every keyboard is
different.

> means that 1) a strong finger does the reach

Wich is irrelevant because the key isn't any harder to press than the
others --- depending on the keyboard, of course, since there are
keyboards with keys that are harder to press than others.

If your fingers are so weak that it does matter, you may need a
keyboard with keys that are particularly easy to press.

> and 2) like Shift keys, your hands can be used together.

I can use my hands together all the time.

> For example, to type <Ctrl>-u, press and hold the left <Ctrl> with
> your left thumb while typing the "u" with a finger on your right
> hand.

Ctrl-U is very difficult to press.  I never do that unless I really
have to, which is almost never.  Perhaps my hands aren't as bendy
yours.

If I were to press it, I would press right Ctrl with my right little
finger.  It's easier to do that than to try to bend my thumb all the
way to reach the Alt key.  And it doesn't require special
configuration.

> Likewise, to type <Ctrl>-a, press and hold the right <Ctrl>
> with your right thumb while typing the "a" with your left pinkie.

That wouldn't be feasible when Ctrl and Alt were swapped.  Pressing
Ctrl with mit right little finger works fine.

You might suggest a keyboard with three keys in the middle of the
space bar, i. e. Space-Ctrl-Alt-Ctrl-Space.  That way, the thumbs can
either press Ctrl on one side or Alt on any side, or bend a little
left or right to press Space.  I might like that.  (And why are there
no keyboards that have different textures for keys to make them more
distinguishable by touch?)

> The common practice of putting the <Ctrl> key on the <CapsLock> key
> means that only one <Ctrl> key is used and so the left hand has to be
> used to type both the <Ctrl> key and the second key.  No one would
> suggest that the two <Shift> keys be reduced to a single key.

Having an additional Ctrl on the otherwise annoying key for CapsLock
gives you more Ctrl keys and doesn't reduce the number of Ctrl keys to
only one.

> > That would be totally weird.  And it would create issues, like how am
> > I supposed to press Cltr-l without bending my hand when the Ctrl key
> > is misplaced?
> > 
> 
> It should be the same, nearly, as pressing the <SPC> bar with your left
> thumb -- one of the most frequent key presses on the keyboard.

No, I press Ctrl with my little finger on the right side.  That key is
where it is supposed to be, i. e. where my finger presses.  If I were
to swap Ctrl and Alt it would suck because I'd have to go out of my
way and relearn for an inconvenient keyboard layout with the only
machine with which I'd have that is my workstation at home, and only
as long as I have an US keyboard connected to it.  And remember,
German keyboards don't have an Alt key on the right, so what do you
suggest how I would configure all those after I painstakingly learned
where to press Alt and Ctrl?  For keyboards that have the retarded
windows keys, I usually put either Alt or Ctrl on them because that
gets less in the way, but only at home.  Unfortunately, pulling those
key caps doesn't really help because the keys remain.

> > If you want to get a Model M, go for it.  It's still overall the best
> > keyboard you can get.  The original ones have become expensive and
> > hard to find and may be worn out after 30 years.  Fortunately, you can
> > get a new one from Unicomp, and that's very likely the better deal.
> > 
> 
> Thank you for the recommendation.  It sounds like a nice keyboard and
> keyboards are worth investing in for typists, including programmers.
> Although those keyboards are much better than laptop keyboards, my
> suggestion to move the Ctrl keys is made after using it on laptop
> keyboards for many years.

Ah, well, I hate laptop keyboards and avoid using them as much as I
can.  They are unsuited for typing and some keys are in very wrong
places, making them unusable for some things and generally not usable
but unfriendly.  It's acceptable for a makeshift solution because
carrying a laptop is more than enough even without carrying a keyboard
along with one.  If I had to actually use my laptop, I'd carry a
keyboard with it.  Why don't they just make laptops with decent
keyboards.

> In fact, a critical consideration when buying
> a laptop is whether it has the <Ctrl> and <Alt> keys in the locations
> outlined above (that is, to the left and right of the <SPC> key).  I
> have rejected laptops that do not have that because it would lead to RSI
> and make typing for programming significantly slower and more difficult.

Try to find a laptop that has Home, End, Del, Insert, PgUp, PgDown and
the like where they are supposed to be ...

> > And my thumbs are pretty much the last fingers I'd use to press Ctrl
> > when the rest of my fingers are at the home row.  The home row is
> > great for typing, not for moving around.  I either type or move
> > around, and for moving around, the dedicated movement keys are very
> > convenient.  How much do you move around on a typewriter?
> > 
> 
> The point of the suggested move is to make typing easier and less
> prone to RSI.  It mostly isn’t even necessary to leave the home row (an
> occasional <Alt>-<Tab> or <Super> key) and use the very large number of
> Emacs key combinations.  Key combinations become just like another kind
> of "shift."

It's also not necessary to torture myself.  And again, try the emacs
way of movement with ESC being the only Meta key you have.  I'm sure
that's gone be fun ;)

> > > A suggestion to try is to reposition the keys and go through the Emacs
> > > Tutorial (C-h t).  That would provide practice using many Ctrl key
> > > combinations and could help you decide whether this new approach is to
> > > your liking.
> > 
> > I did that in the 90ies on my Atari ST.  You can still find pictures
> > of the keyboards they used.  How much sense do you think that tutorial
> > made with these keyboards (their German version) --- and no, Alt
> > didn't work for Meta but ESC did.
> > 
> 
> It didn’t make sense and it lead to RSIs.  Fortunately, since then
> keyboards moved from having a single <Ctrl> key to having two, along
> with two <Alt> keys.

The Atari ST keyboards didn't lead to RSI.  PC keyboards have differnt
keys since a very long time.  German keyboards still have only one Alt
key ...

> This, plus the ability to reconfigure the keyboard has mostly
> eliminated RSI and increases typing speed (including Emacs’s
> commands).

Yes, after 30+ years I could finally configure my workstation to use
Alt as Meta.  It still doesn't work on my laptop or any other computer
...  And it didn't lead to RSI ever.

Just use a good keyboard, not a laptop keyboard.

> [..]
> > Your suggestions are good, only they don't work for me.
> 
> OK.  That was always a possibility.  It is a suggestion for you to
> consider and you still could reconsider now that you have seen it as a
> possibility.

Well, swapping Alt and Ctrl on the right might make some sense, but I
sometimes press Ctrl-a and Ctrl-e with my right hand.  Try that when
swapped ...  And it's too much configuration.

> (I had RSI for years because I could not see how a simple
> reconfiguration could fix the problem for me, and I wished I had
> seen it suggested from the beginning.  It is such a significantly
> better arrangement that I wish it was documented in the Emacs
> Manual.  It could help many people overcome the problem of the
> complicated key combinations being difficult and driving them not to
> use Emacs.)  Here’s hoping that it might be helpful for some other
> reader who uses Emacs.

Perhaps you could write a manual that can be included in Emacs.  I've
never had such isses and always used decent keyboards.

Or quit trying to use laptop keyboards and get a decent keyboard.
Nowadays you can get some decent ones, and which switches you like is
personal preference.  Just stay away from so-called "gaming keyboards"
(or other "gaming" hardware).  They can be incompatible, and stuff
labled "gaming" either sucks and doesn't work right, or is way
overpriced, or both.

Also, move your hands some more instead of forcing them to remain in
the home row and to bend themselves so unnaturally to the keyboard.
It's good for them and the fingers when they can assume different
positions and stretch in different ways and directions, like when
pressing dedicated movement keys.  Otherwise it's no wonder that you
hurt yourself, especially with a laptop keyboard.




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

* Re: vterm and Meta?
  2023-08-06 19:41                               ` hw
@ 2023-08-06 19:54                                 ` Emanuel Berg
  0 siblings, 0 replies; 36+ messages in thread
From: Emanuel Berg @ 2023-08-06 19:54 UTC (permalink / raw)
  To: help-gnu-emacs

hw wrote:

> Your suggestion does not work with a Germany keyboard,
> especially when it has windows keys that get in the way.
> There are probably other keyboards for different languages
> with which it doesn't work, either. Have you
> considered that?

I haven't! But tell me, what is it that is supposed to work
(or not work)?

I have a US layout QWERTY keyboard and the Alt key works as
Meta both in the Linux VTs and in X, in a GUI Emacs.

This is the only setting I ever had to do

xterm*metaSendsEscape: true

in .Xresources, see e.g. [1]

Building your own keyboard sounds like fun tho, but since
a keyboard is just a bunch of rows with buttons surely
programming them with software must be the first stop to
configuring them :)

[1] https://dataswamp.org/~incal/conf/.Xresources

-- 
underground experts united
https://dataswamp.org/~incal




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

end of thread, other threads:[~2023-08-06 19:54 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01 11:55 vterm and Meta? hw
2023-08-01 12:12 ` Thibaut Verron
2023-08-01 14:21   ` hw
2023-08-01 14:40     ` how to configure Meta key with wayland (was: vterm and Meta?) hw
2023-08-01 15:05     ` vterm and Meta? Spencer Baugh
2023-08-01 16:36       ` hw
2023-08-03 19:56         ` Spencer Baugh
2023-08-01 15:09     ` Thibaut Verron
2023-08-01 16:25       ` hw
2023-08-01 19:54         ` Thibaut Verron
2023-08-02  0:39           ` hw
2023-08-02  7:54             ` Thibaut Verron
2023-08-02 14:21               ` hw
2023-08-02 14:29                 ` hw
2023-08-02 15:10                   ` Yuri Khan
2023-08-03 14:02                     ` hw
2023-08-03 19:46                     ` tpeplt
2023-08-03 21:32                       ` hw
2023-08-03 22:29                         ` tpeplt
2023-08-04 20:08                           ` hw
2023-08-04 21:20                             ` PierGianLuca
2023-08-06 16:32                               ` hw
2023-08-06 17:09                                 ` PierGianLuca
2023-08-06 17:39                                 ` Yuri Khan
2023-08-04 21:42                             ` tpeplt
2023-08-06 19:41                               ` hw
2023-08-06 19:54                                 ` Emanuel Berg
2023-08-02 15:05                 ` Thibaut Verron
2023-08-03 13:50                   ` hw
2023-08-01 19:01 ` Akib Azmain Turja
2023-08-02  0:45   ` hw
2023-08-02  9:02     ` Akib Azmain Turja
2023-08-02 18:01       ` Emanuel Berg
2023-08-03 14:15       ` hw
2023-08-03 18:49         ` Akib Azmain Turja
2023-08-04 20:30           ` hw

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.