Ymacs Reloaded

Hello. Here's an Ymacs update, after 12 years. Remember Ymacs? It's an Emacs-like editor that works in the browser. Here is what's new.

Get Ymacs from github.com/mishoo/ymacs. Check the Ymacs section on this website for some building/usage information.

The Ctrl-w situation

When I started Ymacs, browsers allowed websites to receive pretty much any key combination, and life was good. But after a while, Chrome decided to forbid sites from catching some keys (Chromium: issue 1, issue 2), and a few years later Firefox followed suit (Firefox: issue 1, issue 2), “to prevent abuse”. 🤦

Customizable keyboard shortcuts was routine feature for a 30kb video game in the 80'es; you'd think it should be a solved problem in today's browsers. Yet, despite people asking for a solution for years, despite that there are literally 1.5 BILLION results for google browser prevent ctrl-w from closing tab, here we are in 2024 — Ctrl-w kills the tab and you cannot disable nor configure this.

We are powerless against this insanity, of course. Ymacs doesn't even get notice that Ctrl-w has been pressed. So I defined alternate combinations for situations where you'd normally use C-w:

Oh, you will press Ctrl-w! Ymacs imitates Emacs so well, and if you work on anything serious you will get into the zone, finger memory will take over and —bang!— all of a sudden, whatever it was that you were working on will have vanished, leaving you blinking stupidly for a few seconds as the horror of what just happened fully sinks in, and then you start cursing every idiot who thought killing the tab on Ctrl-w and making it impossible to configure was a good idea.

This is terribly frustrating, as you can see, so you add a beforeunload handler, so the browser will at least warn before closing the tab. But please note that even with this handler, if your fingers press C-w twice (say, if you wanted to yank two words in isearch) Firefox will still murder the tab without waiting for your pitiful confirmation, and there is nothing you can do about it.

If you need Ctrl-n or Ctrl-t, you are similarly out of luck, but at least the hard-coded action is a little less malign.

No comments yet. Wanna add one? Please?

Add your comment

Apr
19
2024

Ymacs Reloaded

  • Published: 2024-04-19
  • Modified: 2024-04-28 20:05
  • By: Mishoo
  • Comments: 0 (add)

Open demo

This opens Ymacs with the content of this blog post (the code that runs on click is at the bottom). You can't save, obviously.