Hacker News new | past | comments | ask | show | jobs | submit | more susam's comments login

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/>.


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


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...>.


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.)


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.


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...


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.


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.


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.


> 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?


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.


I haven’t kept track of how much traffic it brings to the whole website but I have some data about how much traffic it brings to the particular page that is trending on the HN front page: https://susam.net/from-web-feed-to-186850-hits.html

To summarise that post, it brought me about 95000 hits on the first day. That was a simple, static, standalone HTML page and the traffic was way below what Nginx can handle without breaking a sweat, so never had any trouble on the web server.


The Libera IRC ##math community [1] has been around for over 29 years now! Originally based on the Freenode network, the community migrated to Libera in May 2021 following a controversial shift in Freenode's management.

This community played an instrumental role in my early days of beginning to study mathematics seriously. During its prime, weekly mathematics seminars [2] were organised by the members, which I thoroughly enjoyed. I still vividly remember the IRC user "TRWBW", who seemed to have an answer for every question, no matter how complex. TRWBW's ability to explain even the most challenging concepts with clarity and precision was very impressive. Sadly, he hasn't been seen in several years.

Although many of the original regulars have come and gone over the past three decades, the community continues to remain active. It still remains a good forum for discussing mathematics as well as asking and answering questions.

[1] https://web.libera.chat/##math

[2] https://freenode-math.fandom.com/wiki/Seminars#Past_Seminars


We have a little IRC/Matrix-based computer science and mathematics discussion community called Bitwise. The connection links are:

* https://web.libera.chat/#bitwise (i.e., #bitwise on irc.libera.chat)

* https://app.element.io/#/room/#bitwise:matrix.org (i.e., #bitwise:matrix.org)

Both channels above are bridged together. So joining either one of them is enough to follow all conversations.

This isn't specifically targeted at professional mathematicians though. Most members come from a computing background. However, mathematics is a central topic here, with much of the discussion revolving around computer science and mathematical literature. Recent reading and discussions have been about topics like theorem provers (Z3, Lean, etc.), real analysis, Galois theory, distributed consistency, compiler and interpreter development, Standard ML, etc.


> ... I don't know what pjmlp means by "Lisp-2", which I normally interpret as meaning a Lisp with different namespaces for functions and variables ...

There indeed was a language named LISP 2: https://dl.acm.org/doi/pdf/10.1145/1464291.1464362

I posted it on HN two weeks ago but it didn't get much traction: https://news.ycombinator.com/item?id=41640147


Aha, thanks!


> The sentence “Let x⋆ be the solution to the optimization problem” implicitly asserts that the solution is unique. If the solution is not unique or need not be unique, write, “Let x⋆ be a solution to the optimization problem.”

I know this point is meant to be about precision in writing but this reminded me of Perron's Paradox, which highlights the danger of assuming the existence of a solution without proper justification. The problem can be demonstrated through the following argument:

Let n be the largest positive integer. Then either n = 1 or n > 1. If n > 1, then n^2 > n contradicting the definition of n. Hence n = 1.

This fallacy arises from the mistaken assumption that a largest integer exists in the first place.

The original post is a great submission, by the way. Thank you for sharing it on HN. Bookmarked already!


While not as impressive, I have a small set of fun pages here: https://susam.net/links.html#fun

These are tiny hobby projects I've developed in the limited spare time I get. They serve as creative outlet and keep alive the fun in computing I first discovered many decades ago while learning the Logo programming language.

I'm curious to see what others here do to keep the fun in computing alive for themselves.


My son wanted to know why all planets move in one direction around the sun.

https://strangeloop.nl/max.html

I struggled a bit with finding the right way of controlling this, but with some patience you can set up a cloud of nicely rotating particles, and try to reverse the overall direction of the swirl by adding particles that rotate in the other direction.


Love this! Nice work.


Thanks! Full disclosure: by the time this was done, the actual question that prompted this was long forgotten. I got a "huh, that's nice." for my trouble (:


The original discussion is here: https://groups.google.com/g/comp.lang.lisp/c/T_Tozq2P53I/m/N...

I found it intriguing that the original post there claims that

  (cons (list 1 2) (list 3 4))
intuitively seems to have the length 2 whereas the correct length is 3. I find 3 more intuitive though. It could be because right from my early days of learning various Lisps, I learnt about lists in terms of cons cells.

There are many ways to explain this, such as by drawing diagrams of the cons cells from first principles, printing out each cons and list on a REPL and confirming the equivalences, etc. Here's one that happens to be my take on it. I'll be (ab)using the equals sign (=) to mean that the expression on the LHS and the one on the RHS are equivalent.

First let us build a list of three items using cons cells:

  (cons 4 nil) = (list 4)

  (cons 3 (cons 4 nil)) = (list 3 4)                [1]

  (cons 'x (cons 3 (cons 4 nil))) = (list 'x 3 4)   [2]
Now let us build a list of two items using cons cells:

  (cons 1 nil) = (list 1)

  (cons 1 (cons 2 nil)) = (list 1 2)                [3]
Now substituting LHS and RHS of [3] into 'x in LHS and RHS of [2], respectively, we get

  (cons (cons 1 (cons 2 nil)) (cons 3 (cons 4 nil))) = (list (list 1 2) 3 4)
Simplifying the LHS above using [3] and [1], we get

  (cons (list 1 2) (list 3 4)) = (list (list 1 2) 3 4)
Clearly, the length of RHS is 3.

From the REPL:

  CL-USER> (cons (list 1 2) (list 3 4))
  ((1 2) 3 4)
  CL-USER> (list (list 1 2) 3 4)
  ((1 2) 3 4)
  CL-USER> (length (cons (list 1 2) (list 3 4)))
  3
  CL-USER> (length (list (list 1 2) 3 4))
  3
  CL-USER>
Also, on Emacs:

  ELISP> (cons (list 1 2) (list 3 4))
  ((1 2)
   3 4)

  ELISP> (list (list 1 2) 3 4)
  ((1 2)
   3 4)

  ELISP> (length (cons (list 1 2) (list 3 4)))
  3 (#o3, #x3, ?\C-c)
  ELISP> (length (list (list 1 2) 3 4))
  3 (#o3, #x3, ?\C-c)
  ELISP>
See also: https://gigamonkeys.com/book/they-called-it-lisp-for-a-reaso...


> intuitively seems to have the length 2 whereas the correct length is 3. I find 3 more intuitive though. It could be because right from my early days of learning various Lisps, I learnt about lists in terms of cons cells.

That's just how cons is defined. the first argument is a list and the second is an arbitrary object, and the result has the elements from the list plus the other object. It doesn't take a bunch of algebraic manipulation to understand this definition. It just takes a recognition that an "arbitrary object" could be a list, as well as a recognition that the other definition you imply ("make a new list with both arguments as elements") would have to either be variadic (which in turn would obviate `list`) or would only ever be able to make lists of exactly 2 elements. (The point is that `cons` can serve as a simpler primitive, and `list` can be implemented in terms of it.)


That original post started with

> (list 1 2 3) == (cons 1 (cons 2 (cons 3 nil)))

and I'd have answered that cons could be a variable-arity function such that

> (list 1 2 3) == (cons 1 2 3 nil)

and maybe that'd help this newbie's intuition. (Common Lisp does have this variable-arity cons but by a different name list*, for some reason.)


Note that the value returned by cons is guaranteed to have type cons, and it is guaranteed that a fresh cons is created. Neither is true for list*; note that its return type is t.


To me, the form is not intuitive, but the result is:

  ((1 2) 3 4)
Someone else in that thread mentioned that CONS is basically adding (1 2) to the front of the (3 4) list, and that helped me understand it better.


Something you know because of what you learned cannot be called "intuitive".

Intuitive means that, having studied nothing, you somehow make the right guesses about something.

A device is intuitive if you can chuck the user manual aside as you unbox it, and proceed to use it without difficulty or puzzlement.


Not at all similar to the one in this "Show HN" post but related:

London 2023 countdown: https://www.youtube.com/watch?v=2FcDNi1HkfI&t=49s

London 2024 countdown: https://www.youtube.com/watch?v=r2wBcCIlMGw&t=50s


As the years go by, I find myself increasingly in the minority of those who still prefer the unified diff view.

My favourite tool for diffing has always been “diff -u”. I sometimes even use “diff -U10000” when I want to see the entire file as context.

Thankfully, GitHub still supports unified diff view, so I don’t feel left out while reviewing GitHub pull requests.

In fact, once upon a time, when there was no GitHub or GitLab and there were no “pull requests”, open source developers used to email each other .diff files (often also named .patch files) which were nothing but unified diff files. A reviewer would apply the patch on their copy of source code with something like “patch -p0 < new.diff” and test it locally on their system. That was the CI of that era.


> As the years go by, I find myself increasingly in the minority of those who still prefer the unified diff view.

Wait, so what does the majority prefer these days then? I might be out of the loop, last time I checked (which was today) git still defaulted to unified diffs.


The default is still unified diff but I see most people around me switch the diff view to split view (the side-by-side view).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: