3

I am running Org-Mode in Cygwin's emacs. Org-mode uses the key combination of Alt+Enter to add a new line at your current level.

However, Windows uses Alt+Enter to toggle full-screen of a window. Is there a way I can prevent this conflict so that Windows doesn't toggle the window state while I'm in Cygwin?

7
  • @techie007 Not a duplicate; overriding M-RET via AHK or similar won't solve the problem, which in any case has only to do with running Emacs in a Windows console anyway -- see my answer. May 30, 2013 at 16:34
  • The problem here is it's an XY problem. But as-is, the question is "How do I override Windows' hotkeys", and therefore it's a dupe (IMO). :) May 30, 2013 at 16:38
  • @techie007 I don't know if I even agree that it's an XY problem; I'm not sure how it could've been asked differently without prior knowledge, which the asker didn't have, that the observed M-RET behavior is specific to the Windows console and not a systemwide shortcut like the CUA stuff discussed in the first question you linked. That being the case, I maintain the contention that it's not a dupe, and the correct answer, as detailed below, is not "use AutoHotkey" but "use a real terminal emulator". :) May 30, 2013 at 16:43
  • Perhaps something like "...However, Windows uses Alt-Enter to toggle full-screen of a window so it conflicts. How can I avoid this conflict?" instead of "How can I disable Alt-Enter in Windows?" May 30, 2013 at 16:45

2 Answers 2

2

Only the Windows console (cmd.exe) treats M-RET in that fashion; run your shell, and Emacs, in a proper terminal emulator such as mintty or rxvt, to solve the problem and get a much more pleasant experience besides. (mintty comes with Cygwin by default, and is considerably better in my experience than rxvt, xterm, or any other terminal emulator available in the Cygwin package manager; unlike those relics of a bygone era, mintty has capabilities roughly on par with modern Linux terminal emulators.)

If you want to get really fancy, which I recommend, then install an X server -- Cygwin packages one, and there's also the third-party Xming version; I've had better results with Xming, but haven't tried Cygwin's X server in long enough that it's probably just as good by now -- and run Emacs in graphical mode, which not only resolves the M-RET problem but also gives you proper color and font support.

7
  • I just tried mintty and it seems to have the same problem?
    – sdasdadas
    May 30, 2013 at 16:35
  • 3
    Huh. Apparently mintty by default treats M-RET the same way the Windows console does -- I forgot I'd disabled that; in any case, you can disable it via right-click on the window icon -> 'Options' -> 'Keys' and uncheck 'Menu and Full Screen shortcuts'. You also lose M-SPC to open the window menu, but I'd argue that capturing a key combination like that one is undesirable in a terminal emulator anyway, especially one in which Emacs is running. Sorry, I should've mentioned that in my answer. May 30, 2013 at 16:39
  • Ah, that worked perfectly. And... I now know how to run an X server in Cygwin (which also worked, but needed a bit of boot up time). Thanks for the two options!
    – sdasdadas
    May 30, 2013 at 16:40
  • Glad to be of help! May 30, 2013 at 16:44
  • "Only the Windows console (cmd.exe) treats M-RET in that fashion" - I don't know what it is I'm missing, but since when has Alt+Enter ever done anything to the Command Prompt in Win7?
    – Karan
    May 31, 2013 at 2:27
12

Fixed this problem on the new Windows Terminal for Windows 10 by adding following keybinding to settings.json keybindings block:

{ "command": "null", "keys": "alt+enter" }

Ref: How can I remove a default key binding in Windows Terminal

1
  • 1
    Thank you! That is what I was looking for. I had it set to unbound but that didn't work. null did the trick.
    – mghaoui
    Nov 27, 2020 at 11:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .