Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emacs and lsst-lspdev #56

Open
kadrlica opened this issue Jul 13, 2018 · 7 comments
Open

emacs and lsst-lspdev #56

kadrlica opened this issue Jul 13, 2018 · 7 comments
Assignees

Comments

@kadrlica
Copy link
Contributor

This is a reminder to track down the issues with emacs on lsst-lspdev. They should eventually be documented in an issue here: https://community.lsst.org/c/support/lsp

@kadrlica kadrlica self-assigned this Jul 13, 2018
@kadrlica
Copy link
Contributor Author

kadrlica commented Jul 23, 2018

Emacs commands that fail on lsst-lspdev (please edit this comment):

  • Meta - The Meta key (which is used generically for emacs commands) is usually mapped to esc and Alt (Linux)/Option (Mac OS X). On Mac OS X, the browser uses Option print a variety of non-ascii characters. For example, one of the most important emacs key combination, M-x, prints '≈'. The esc key does work as Meta on Mac. In my personal case, I've remapped the Mac Command (⌘) key to Meta for emacs, so my muscle memory keeps typing '⌘+w' to copy, which of course has the annoying effect of closing my browser tab...
  • C-_ - Undo (noop)

@kadrlica kadrlica mentioned this issue Jul 27, 2018
7 tasks
@SimonKrughoff
Copy link
Contributor

SimonKrughoff commented Aug 1, 2018

@kadrlica we definitely understand the problem with the Meta key. It's a tricky issue because it is the browser that is catching the keystroke before the terminal emulator can see it. After talking with Adam, we came up with a few (not completely satisfactory).

  • Remap the offending keystrokes. I have tried this and it seems to work to keep the browser from capturing Meta-W. You don't even need to restart your browser.
  • Use a browser extension like shortkeys
  • Use Esc instead of Meta. I realize this is like asking you to learn a new editor, but this solution doesn't require any key binding manipulation.
  • Globally remap default keybindings. For example, some emacs bindings here or here

The C-_ problem is less understandable. It should work. We can look into whether it is being caught by either the JL environment or the terminal emulator. While not ideal, I've confirmed that C-x u does run undo.

@jtmyles
Copy link
Contributor

jtmyles commented Aug 10, 2018

I've also been having this issue with emacs (with the Chrome browser catching up alt/option before the terminal emulator). I've heard there has been an effort to enable logging in to standard interactive login shells on the lsst-lspdev.ncsa.illinois.edu server. Is it possible to use a login shell on this server?

@athornton
Copy link

athornton commented Aug 13, 2018 via email

@kadrlica
Copy link
Contributor Author

kadrlica commented Aug 31, 2018

To narrow the range of investigation, I think I'm going to focus on trying to get Option+w (⌥+w) to copy text. This means that the focus is:

  1. Get the Mac to stop making ⌥+w = Σ
  2. Get the browser to pass ⌥+w to the LSP
  3. Get the LSP Emacs session to interpret ⌥+w as Meta-w

To accomplish this, I've followed @SimonKrughoff fourth bullet to globally remap the default keybindings. I've edited ~/Library/KeyBindings/DefaultKeyBinding.dict to be (where \033 is the escape code):

{
"~c" = (insertText:,"\033c");
"~v" = (insertText:,"\033v");
"~w" = (insertText:,"\033w");
}

This appears to work. It passes M-c, M-v, and M-w to the emacs session in Chrome.

@kadrlica
Copy link
Contributor Author

kadrlica commented Sep 14, 2018

I've been trying Firefox and Chrome on Linux. Firefox is a nightmare due to the Ctrl keys being mapped to various window commands. Chrome is a lot better, but it has several problems

  • Cttrl+b causes the JupyterLab bookmarks bar to open an close instead of moving the cursor backwards.
  • Ctrl+s doesn't appear to be passed to emacs

@kadrlica
Copy link
Contributor Author

A positive update, C-_ is now working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants