News for hackers. Stuff that matters.
Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by susam on Saturday October 12, 2024 @04:18PM (#41822173)
Instead of using ctrl and meta modifiers, use a leader key like escape or semicolon or comma or some such thing as the prefix key for key bindings. In fact, this desire for leader-key-based, non-modal text editing led me to write devil-mode for Emacs: <https://susam.github.io/devil/>.
Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by smokel on Saturday October 12, 2024 @04:36PM (#41822337)
Make CapsLock an additional Ctrl. On many old keyboards that is where the Ctrl key was positioned [1].

[1] https://en.m.wikipedia.org/wiki/Caps_Lock#Placement

Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by imiric on Saturday October 12, 2024 @05:32PM (#41822850)
Instead of making it an additional Ctrl key, you can also make it a new separate modifier key with XKB[1]. I've found this very useful over the years for WM-related key bindings, leaving the other modifiers for applications.

Tangentially, I really loathe how Wayland has no alternative to this. I'm expected to configure keyboard layouts in every DE or WM I use, which is a much worse UX.

[1]: https://vincent.bernat.ch/en/extending-xkb#attaching-symbols...

Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by susam on Saturday October 12, 2024 @05:21PM (#41822751)
I know many people like to remap Caps Lock to function as Ctrl. However that setup does not quite work for me. There is only one Caps Lock key on the left side of the keyboard. I need Ctrl on both sides of the keyboard, so that I can use the left Ctrl key while typing Ctrl+P but the right one while typing Ctrl+A.

There are other options as well, like remapping the Enter key to act as Ctrl when chorded or using sticky modifiers. I think using an ergonomic keyboard with two large Ctrl keys on both sides of the keyboard is probably the best solution. I've discussed some of these alternatives in more detail <https://susam.github.io/devil/#why>.

By the way, there are some vendors that still make Unix layout keyboards with the Ctrl key positioned where Caps Lock key usually is: <https://deskthority.net/wiki/Category:Keyboards_with_Unix_la...>.

Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by asciimov on Saturday October 12, 2024 @08:08PM (#41823949)
For the past 3 years I’ve done the following remap Caps -> lctrl/esc, enter -> rctrl/enter, tab -> lalt/tab, backslash -> ralt/ backslash. Also have the physical right alt mapped to multi key/dead greek.

It works really well, and makes emacs much more comfortable to type in.

Downside is this keeps me locked to X11 and fighting the occasional app that reads the key codes directly.

Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by tom_ on Saturday October 12, 2024 @06:53PM (#41823427)
I just leave Ctrl where it is and press it with the knuckle of my little finger. I do it just like the guy in the pic on this page, pressing the control key with his little finger: http://xahlee.info/kbd/how_to_press_control_key.html - because that pic is of my hand. (Xah might not recommend doing this all the time, but I've been doing this for nearly 20 years now and I've had no problems.)
Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by macintux on Saturday October 12, 2024 @06:16PM (#41823190)
I was very disappointed that Apple gave up that fight.

They also at some point joined the PC world in moving the nubs on their keyboard from "d" and "k", where you were more likely to notice if your fingers are not in their proper place on the home row. Now if your right hand is offset slightly to the right, you won't feel anything, which is less immediately noticeable than if the nub were under the wrong finger.

Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by petepete on Sunday October 13, 2024 @02:55AM (#41825790)
I use a HHKB because of this. On the Acorn Archimedes I learnt to type on, it wasn't an extra Ctrl, it was the Ctrl.

Caps lock was rightfully relegated to bottom left.

Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by fsckboy on Saturday October 12, 2024 @05:12PM (#41822652)
emacs is not its keybindings. you can bind your emacs keyboard to do what you are asking for; as you said, you wrote a mode for emacs that works the way you want, and it wasn't necessary to rewrite Emacs.
Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by susam on Saturday October 12, 2024 @06:31PM (#41823292)
> emacs is not its keybindings ... and it wasn't necessary to rewrite Emacs

That's indeed true! But the premise of this question explores the scenario: What if we did rewrite Emacs from scratch?

Re:Ask HN: If you were rewriting Emacs from scratch, what wo... by sping on Monday October 14, 2024 @01:27PM (#41839702)
Making modal editing with a leader key the default rather than an option it currently is, is a pretty trivial thing to bring up as the stand-out "feature" a rewrite could provide.