Avoid alt-enter resize the frame in Windows reddit / emacs ---------------------------------------------------------------------- mastro35 · 2022-09-15 16:53 Hi guys, is there a way to tell windows to NOT resize my Emacs frame when I am in Org-mode and I M-Enter to create a new bullet item? That’s so frustrating… Thanks Davide Ps I know that running it in WSL2 would solve this problem but I prefer to use the windows version ---------------------------------------------------------------------- eli-zaretskii · 2022-09-15 19:11 Did you try to use `w32-register-hot-key`? ---------------------------------------------------------------------- mastro35 · 2022-09-16 06:06 Actually I didn't know about that function and as I read the doc I thought "that's was I was looking for!". Unfortunately it doesn't work... and just for this special case I think. I tried with (w32-register-hot-key \[M-tab\]) and it succesfully disable the ALT-TAB key. But if I run (w32-register-hot-key \[M-return\]) that returns 't', the ALT-ENTER key keep resizing the frame... Even registering all the M- keys doesn't help... ---------------------------------------------------------------------- eli-zaretskii · 2022-09-16 11:29 > But if I run > > > > (w32-register-hot-key [M-return]) > > > > that returns 't', the ALT-ENTER key keep resizing the frame... What if you try `(w32-register-hot-key [M-RET])` instead? ---------------------------------------------------------------------- mastro35 · 2022-09-17 11:31 It doesn't work, returns nil and the ALT+Enter key keep resizing the window. ---------------------------------------------------------------------- eli-zaretskii · 2022-09-17 15:42 What version of Emacs is that? ---------------------------------------------------------------------- mastro35 · 2022-09-17 16:13 28.1 on Windows 11 ---------------------------------------------------------------------- eli-zaretskii · 2022-09-17 19:11 Then I guess this is the second known case that doesn't work... ---------------------------------------------------------------------- spirou1415 · 2022-09-26 10:16 I had the exact same problem. In my case in it was set to go to fullscreen also in emacs (Try C-h k). I had to use (global-unset-key (kbd "M-")) and (local-unset-key (kbd "M-")) to unset it. ---------------------------------------------------------------------- mastro35 · 2022-09-27 15:32 Wow! It works if I exec it in my Org-mode buffer… but it doesn’t if I put it in my init.el file… how come? ---------------------------------------------------------------------- mastro35 · 2022-09-28 12:53 solved with ```elisp (add-hook 'org-mode-hook (lambda () (global-unset-key (kbd "M-")) (local-unset-key (kbd "M-")))) ``` tnx! ---------------------------------------------------------------------- spirou1415 · 2022-09-29 11:48 👍 Seems to me it's a bug in org-mode, and org reactivates the binding. I also get the problem in Linux when I checked. Normally the binding should be bound to org-meta-return and not toggle-frame-maximized. Thanks for the idea with lambda, I added (local-set-key "" 'org-meta-return) to restore functionality.