OS X meta key [$20] #252

Open
opened 2015-07-29 07:29:18 +02:00 by namelos · 23 comments
namelos commented 2015-07-29 07:29:18 +02:00 (Migrated from github.com)

Hi, this term is so amazing. But I use emacs every day and there is a "Use Option as Meta key" in terminal.app preferences. I am wondering is there any way to do the same in this term?

Thanks for help and keep cool!

--- There is a **[$20 open bounty](https://www.bountysource.com/issues/25105523-os-x-meta-key?utm_campaign=plugin&utm_content=tracker%2F479407&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F479407&utm_medium=issues&utm_source=github).
Hi, this term is so amazing. But I use emacs every day and there is a "Use Option as Meta key" in terminal.app preferences. I am wondering is there any way to do the same in this term? Thanks for help and keep cool! ## <bountysource-plugin> --- There is a **[$20 open bounty](https://www.bountysource.com/issues/25105523-os-x-meta-key?utm_campaign=plugin&utm_content=tracker%2F479407&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F479407&utm_medium=issues&utm_source=github). </bountysource-plugin>
jordonbiondo commented 2015-12-17 16:10:56 +01:00 (Migrated from github.com)

Can't use emacs without this.

Can't use emacs without this.
jasonm23 commented 2016-01-11 05:43:18 +01:00 (Migrated from github.com)

@jordonbiondo we can use Esc for Meta, although it's deeply inconvenient to muscle memory.

👍 to have this.

@jordonbiondo we can use `Esc` for Meta, although it's deeply inconvenient to muscle memory. :+1: to have this.
tvilot commented 2016-02-16 21:01:14 +01:00 (Migrated from github.com)

I would actually like to be able to remap the left command key to be meta. It's closer to the spacebar, and my muscle memory goes there for meta.

I would actually like to be able to remap the left command key to be meta. It's closer to the spacebar, and my muscle memory goes there for meta.
antanst commented 2016-04-04 08:30:33 +02:00 (Migrated from github.com)

That bug is the reason why I can't use this app, although I like it better than Cathode...

That bug is the reason why I can't use this app, although I like it better than Cathode...
articuluxe commented 2017-10-27 17:46:17 +02:00 (Migrated from github.com)

This also is why I can't use this app. For emacs it's a harder requirement than just muscle-memory: I can't even type C-/ for Undo.

This also is why I can't use this app. For emacs it's a harder requirement than just muscle-memory: I can't even type C-/ for Undo.
tvilot commented 2017-10-28 05:05:02 +02:00 (Migrated from github.com)

articuluxe: CTRL+SHIFT+_ (as in 'underscore'). It's actually a standard emacs keybinding which I use on machines where I don't have my custom configurations installed.

articuluxe: CTRL+SHIFT+_ (as in 'underscore'). It's actually a standard emacs keybinding which I use on machines where I don't have my custom configurations installed.
jasonm23 commented 2017-10-28 14:11:15 +02:00 (Migrated from github.com)

@tvilot - C-/ is also a standard Emacs binding (it's also functional on Bash, Zsh and any other place where Readline or compatible (zle etc.) is available.)

@tvilot - <kbd>C</kbd>-<kbd>/</kbd> is also a standard Emacs binding (it's also functional on Bash, Zsh and any other place where Readline or compatible (zle etc.) is available.)
tvilot commented 2017-10-28 17:29:14 +02:00 (Migrated from github.com)

@jasonm23 I know. I was just mentioning the alternative.

@jasonm23 I know. I was just mentioning the alternative.
tvilot commented 2017-10-29 06:33:36 +01:00 (Migrated from github.com)

Can we all here agree that this is "Cool Retro Term" and that we don't expect this thing to behave like a perfect terminal?

Thanks.

Can we all here agree that this is "Cool Retro Term" and that we don't expect this thing to behave like a perfect terminal? Thanks.
jasonm23 commented 2017-10-29 07:06:08 +01:00 (Migrated from github.com)

it's a very active project and it's better to simply

  • ask politely for things we want
  • remember it's open source and we have the power to make things happen if we want, by contributing code, or (less effective) donation.

Talking as if this is a fixed or cannot fix issue is counter productive. If you don't expect or want a particular thing, that's fine, if others do, they should contribute and encourage contribution.

Let's remember this is software, AFAIC learning how to improve it is the entire point of it.

it's a very active project and it's better to simply - ask politely for things we want - remember it's open source and we have the power to make things happen if we want, by contributing code, or (less effective) donation. Talking as if this is a fixed or cannot fix issue is counter productive. If you don't expect or want a particular thing, that's fine, if others do, they should contribute and encourage contribution. Let's remember this is software, AFAIC learning how to improve it is the entire point of it.
tvilot commented 2017-10-29 07:21:27 +01:00 (Migrated from github.com)

@jasonm23 oh, for godsakes. I was just answering a question.

@jasonm23 oh, for godsakes. I was just answering a question.
picospuch commented 2018-03-06 10:54:41 +01:00 (Migrated from github.com)

#432 Does this meet your need?

#432 Does this meet your need?
NightMachinery commented 2018-04-26 14:23:46 +02:00 (Migrated from github.com)

@picospuch t's great. But the Command key still doesn't work?

@picospuch t's great. But the Command key still doesn't work?
picospuch commented 2018-04-28 18:14:54 +02:00 (Migrated from github.com)

@NightMachinary Use option as meta key as Terminal.app does, so that shift + command + c/v work as shortcuts to copy and paste correctly.

@NightMachinary Use option as meta key as Terminal.app does, so that shift + command + c/v work as shortcuts to copy and paste correctly.
picospuch commented 2018-04-29 12:03:23 +02:00 (Migrated from github.com)
for your test, I have packaged a dmg. [https://github.com/picospuch/cool-retro-term/releases/tag/TestForEmacs](https://github.com/picospuch/cool-retro-term/releases/tag/TestForEmacs)
pazos commented 2018-07-13 04:51:59 +02:00 (Migrated from github.com)

for mac, instead of custom shortcuts for copy/paste/fullscreen..., we can use StandardKey.[whatever]. This leaves Modifiers untouched (I mean Shift, Alt & Ctrl) and use an event filter to handle those modifiers (and make the "meta" key switchable)

for mac, instead of custom shortcuts for copy/paste/fullscreen..., we can use StandardKey.[whatever]. This leaves Modifiers untouched (I mean Shift, Alt & Ctrl) and use an event filter to handle those modifiers (and make the "meta" key switchable)
c4pt000 commented 2019-07-14 09:33:05 +02:00 (Migrated from github.com)

use a keymapper to remap the meta key to cool-retro-term

Hi, this term is so amazing. But I use emacs every day and there is a "Use Option as Meta key" in terminal.app preferences. I am wondering is there any way to do the same in this term?

use a keymapper to remap the meta key to cool-retro-term Hi, this term is so amazing. But I use emacs every day and there is a "Use Option as Meta key" in terminal.app preferences. I am wondering is there any way to do the same in this term?
NightMachinery commented 2020-10-10 17:55:57 +02:00 (Migrated from github.com)

@picospuch commented on Apr 29, 2018, 2:33 PM GMT+4:30:

for your test, I have packaged a dmg. picospuch/cool-retro-term@TestForEmacs (release)

Has this gotten merged? It worked just fine.

[**@picospuch**](https://github.com/picospuch) commented on [Apr 29, 2018, 2:33 PM GMT+4:30](https://github.com/Swordfish90/cool-retro-term/issues/252#issuecomment-385240095 "2018-04-29T10:03:23Z - Replied by Github Reply Comments"): > for your test, I have packaged a dmg. [picospuch/cool-retro-term@`TestForEmacs` (release)](https://github.com/picospuch/cool-retro-term/releases/tag/TestForEmacs) Has this gotten merged? It worked just fine.
NateEag commented 2022-03-25 17:18:48 +01:00 (Migrated from github.com)

Judging from this pull request, this change was merged long ago, back in 2018: https://github.com/Swordfish90/cool-retro-term/pull/432

However, I have meta key problems in cool-retro-term 1.2.0 on macOS 11.6.1 (Big Sur). Pressing Option does not send Meta correct Meta combinations when combined with other keystrokes. Tapping Escape followed by another key does send a Meta key combination.

In the fork release @picospuch made back in 2018 (https://github.com/picospuch/cool-retro-term/releases/tag/TestForEmacs) Option works as I would expect.

If the changes got merged, why does this problem still happen in the current release?

Judging from this pull request, this change was merged long ago, back in 2018: https://github.com/Swordfish90/cool-retro-term/pull/432 However, I have meta key problems in cool-retro-term 1.2.0 on macOS 11.6.1 (Big Sur). Pressing Option does not send ~Meta~ correct Meta combinations when combined with other keystrokes. Tapping Escape followed by another key does send a Meta key combination. In the fork release @picospuch made back in 2018 (https://github.com/picospuch/cool-retro-term/releases/tag/TestForEmacs) Option works as I would expect. If the changes got merged, why does this problem still happen in the current release?
NateEag commented 2022-04-04 04:50:05 +02:00 (Migrated from github.com)

Ah - in version 1.2.0, Option does send the Meta keyboard modifier as desired.

However, it also triggers the standard OS X Option+letter custom character insertion logic. So, if you're in Emacs, Option+f doesn't send Meta-f - it instead sends Meta+ƒ.

I found this workaround of hacking the OS X keyboard layout that makes Option+[character] work as expected in emacs -nw -q, but even with that workaround, on multiple servers I use via SSH, Meta+f and Meta+b have no effect in Bash.

Meta+f and Meta+b work in Bash on those servers via Terminal, the old known-to-work build of cool-retro-term (https://github.com/picospuch/cool-retro-term/releases/tag/TestForEmacs), and iTerm 2, without the above workaround.

I've just built 654f8d0761 locally and confirmed that Meta works as expected there, as well as confirming that a local build of HEAD does not.

So, it should be possible to run a git-bisect and figure out what commit broke this.

Ah - in version 1.2.0, Option does send the Meta keyboard modifier as desired. However, it also triggers the standard OS X Option+letter custom character insertion logic. So, if you're in Emacs, Option+f doesn't send Meta-f - it instead sends Meta+ƒ. I found [this workaround of hacking the OS X keyboard layout](https://stackoverflow.com/a/24100077/1128957) that makes Option+[character] work as expected in `emacs -nw -q`, but even with that workaround, on multiple servers I use via SSH, Meta+f and Meta+b have no effect in Bash. Meta+f and Meta+b work in Bash on those servers via Terminal, the old known-to-work build of cool-retro-term (https://github.com/picospuch/cool-retro-term/releases/tag/TestForEmacs), and iTerm 2, without the above workaround. I've just built https://github.com/picospuch/cool-retro-term/commit/654f8d0761da016659a7d0b2212a468608d83825 locally and confirmed that Meta works as expected there, as well as confirming that a local build of HEAD does not. So, it should be possible to run a git-bisect and figure out what commit broke this.
NateEag commented 2022-04-04 07:38:50 +02:00 (Migrated from github.com)

My manual git bisect suggests that commit 28977313daab4c is the one where Option-as-meta starts breaking as I've described above.

My manual git bisect suggests that [commit 28977313daab4c](https://github.com/Swordfish90/cool-retro-term/commit/28977313daab4c?w=1) is the one where Option-as-meta starts breaking as I've described above.
NateEag commented 2022-04-05 05:30:07 +02:00 (Migrated from github.com)

By making some changes in the qmltermwidget project (which are available here), I've got a local build of the 1.2.0 tag that's almost working as I'd expect.

Option+key combinations work correctly, but Option+Shift+key shortcuts still invoke OS X's special character insertion logic. As an example, the Emacs shortcut M-x works, but the shortcut M-> (jump to end of buffer) fails, as the fired key event has a character other than '>' due to the Option+Shift+. keybinding on macOS (it inserts ˘).

I got the semi-working Option key behavior by reverting to an older version of some code, but the approach in that code seems like a workaround to me. There must be a better way to handle it.

By making some changes in the `qmltermwidget` project (which are [available here](https://github.com/NateEag/qmltermwidget/tree/bugfix/macos-modifier-keys)), I've got a local build of the 1.2.0 tag that's almost working as I'd expect. Option+key combinations work correctly, but Option+Shift+key shortcuts still invoke OS X's special character insertion logic. As an example, the Emacs shortcut `M-x` works, but the shortcut `M->` (jump to end of buffer) fails, as the fired key event has a character other than '>' due to the Option+Shift+. keybinding on macOS (it inserts ˘). I got the semi-working Option key behavior by reverting to an older version of some code, but the approach in that code seems like a workaround to me. There must be a better way to handle it.
aaronkollasch commented 2022-10-28 13:57:59 +02:00 (Migrated from github.com)

I was having problems with Option+Arrow keys, but I've since gotten them to work, and I think this is what did the trick:

Use a custom command at startup to set cool-retro-term specific environment variables:

/bin/sh -c 'LC_TERMINAL=cool-retro-term TERM_PROGRAM=cool-retro-term zsh --login'

In your profile, set the TERM variable to xterm-256-color for cool-retro-term

[[ "$LC_TERMINAL" == cool-retro-term ]] && export TERM=xterm-256color

Setting TERM got Option+Arrows to work so perhaps it will help with the rest of your shortcuts, I'm not sure.

Edit: actually, I only have them working over SSH for some reason. I need to do some more digging.

I was having problems with Option+Arrow keys, but I've since gotten them to work, and I think this is what did the trick: Use a custom command at startup to set cool-retro-term specific environment variables: ```sh /bin/sh -c 'LC_TERMINAL=cool-retro-term TERM_PROGRAM=cool-retro-term zsh --login' ``` In your profile, set the `TERM` variable to `xterm-256-color` for cool-retro-term ```sh [[ "$LC_TERMINAL" == cool-retro-term ]] && export TERM=xterm-256color ``` Setting `TERM` got Option+Arrows to work so perhaps it will help with the rest of your shortcuts, I'm not sure. Edit: actually, I only have them working over SSH for some reason. I need to do some more digging.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seeseemelk/cool-retro-term#252
No description provided.