emacs-oob-reboot icon indicating copy to clipboard operation
emacs-oob-reboot copied to clipboard

CUA bindings vary between platforms

Open jackrusher opened this issue 8 years ago • 9 comments

I've noticed that many suggested keybindings are like:

(define-key dired-mode-map (kbd "C-s") #'dired-isearch-filenames)

... which is a problem because C-s is not the CUA binding for searching under MacOS, which instead uses s-s by default (assuming that the command key (⌘) is bound to super). Might we want a lookup table that does the right thing depending on the OS?

(Also: I think we've got a good opportunity to make use of unclaimed super bindings because most modern hardware comes with a Command/Windows/Tux key.)

jackrusher avatar May 11 '17 11:05 jackrusher

Interesting observation, and as someone who has never used cua-mode, and avoids OSX as much as I can, I was unaware of both these implications.

Might we want a lookup table that does the right thing depending on the OS?

For now, that absolutely sounds like the right thing to do.

I looked up realgud the other day, and that uses a lookup-table as sorts to mimic whatever gud does (or whatever you have configured it to) for parts of its operations.

I think the relevant code is here: https://github.com/realgud/realgud/blob/master/realgud/common/track-mode.el#L61-L86

Feel free to look into that and improve whatever we have.

josteink avatar May 11 '17 11:05 josteink

Why not use remap then? (disclaimer: I don't know what remap actually is / how it actually works).

angrybacon avatar May 11 '17 11:05 angrybacon

Question: does anyone know what Win + C / Win + X / Win + V do on windows? Likewise, Tux + c (and so on) on a Linux machine with such a button?

jackrusher avatar May 11 '17 16:05 jackrusher

Emacs doesn't see Win. I use the key when I want to display the taskbar with Emacs fullscreen. On Gnome Shell, Emacs doesn't see it either and it shows the dashboard thing IIRC.

angrybacon avatar May 11 '17 16:05 angrybacon

@angrybacon actually, I mean outside of emacs. :)

jackrusher avatar May 11 '17 16:05 jackrusher

They're listed here: https://support.microsoft.com/en-us/help/12445/windows-keyboard-shortcuts.

For Linux, that would depend on the distribution?

angrybacon avatar May 11 '17 16:05 angrybacon

This is one potential area for confusion. Do we ape the operating system for these form of bindings, or do we have a single one for Emacs.

I suspect that we are also constrained by Emacs functionality. CUA-mode is pretty clever in the way that it works in not interfering with other bindings. I have no idea whether it could support multiple OS keypresses.

phillord avatar May 11 '17 17:05 phillord

@phillord The windows key mapping chart made for depressing reading. The CUA approach of basing behavior on whether or not there's a region is quite clever, but has a few unavoidable rough spots, so I was hoping that they made more use of the "Win" key for common functions, something like MacOS does with command. The MacOS setup turns out to be very convenient because those bindings are mostly either the same as or non-overlapping with emacs ones (s-S to save a file, s-c/s-x/s-v for copy/cut/paste, &c), which allows one to leave emacs-specific key sequences unmolested. 😕

jackrusher avatar May 12 '17 06:05 jackrusher

@angrybacon If the xmodmap settings for each distro are very different, we're going to have a very hard time providing a good out-of-box experience for keybindings over different distros. (If "emacs doesn't see the Win key", that's a configuration problem in X.)

jackrusher avatar May 12 '17 06:05 jackrusher

I think recent changes to Emacs (eglot, tree-sitter, etc) has helped make Emacs much more usable OOB. Considering repo-purpose obsolete.

Closing all issues and archiving repo. Thanks to all contributors!

josteink avatar Oct 11 '23 07:10 josteink